Source Functions
Source functions return object arrays that can be used to dynamically populate dropdown options, or fetch custom fields.
Populate dropdown options
Functions like slack-post-message
require the user to provide an ID value for the channel
parameter. Source functions help populate such arguments.
For example, when you show the Function UI to the user so they can select a channel
, we call the source function slack-list-conversations
(using the user's auth credentials) to populate the channel
dynamic dropdown.
In fact, when you predict the arguments with Integry AI, we call the same source function to get the list of channels so we can predict the most relevant option.
When you get a function, the description of a field will mention if there is a source function available to list the options for that field.
See line 9 of this sample response for GET /functions/slack-post-message
:
Fetch custom fields
Apps like Hubspot let the user completely customize objects to represent their business. Hence, functions like hubspot-create-contact
don't have any typical standard parameters like email, name, etc. Instead, it requires an object parameter called properties
in which all the fields of the contact to be created have to be passed. Source functions help populate such arguments.
When you show the Function UI to the user so they can fill the Contact object fields, we call the source function hubspot-list-properties
(with objectType
: Contact) to fetch all the custom fields for the Contact object.
Similarly, when you predict the arguments with Integry AI, we call the same source function to get the list of fields so we can predict the most relevant values for the fields.
When you get a function, the description of an object field will mention if there is a source function available to list the fields for that object.
Sample response for GET /functions/hubspot-create-contact
:
Call a source function
You can call a source function like any other function via the API or SDK.
In fact, they can typically be called headlessly because they usually don't have any required parameters. You should cache the data to avoid repeated calls.
Good candidates to cache are channel list, user list, issue types, project names, etc. Ultimately, it depends on your use-case, but you can also implement a generic solution for supporting function data.
List all source functions
You cannot list all source functions, per se, because they are context-dependent. Instead, you can list all query-type functions with GET /functions?type=query.
To get all query-type functions for just one app, call GET /functions?type=query&app=<app_name>
.
See /functions
for more options.
Last updated