How to create & use actions in Nango
nango-integrations
folder yet, follow the initial Functions setup guide first.
Otherwise, you can skip to the next step.
nango-integrations
folder, create the file for your new action function.
Action files should be within an actions
folder, which is nested under the integration’s folder.
For example, if you want to create a new action to fetch the available fields on the contact object from salesforce
, your structure should look like this:
index.ts
file:
exec
method, implement the logic of your action. Edit MyObject
to contain the properties you need.
The following can help you with your implementation:
nango
object reference to understand the SDK methods available in actionsawait nango.get()
to perform an API request (automatically authenticated by Nango)await nango.log()
to write custom log messagesreturn
will synchronously return results from the action trigger requestdryrun
function of the CLI:
nango dryrun --help
to see all options.
dryrun
retrieves connections from your dev
environment. You can change this with a CLI flag.nango-integrations
folder, run:
--action
parameter:
nango deploy -h
for more options to deploy only parts of your integrations.
To fetch the synced data in your product, follow the steps in the next section.