- How to create your own action
- How to use an action in your own app
How to build an action
Step 1 - Initial Functions setup
If you don’t have anango-integrations
folder yet, follow the initial Functions setup guide first.
Otherwise, you can skip to the next step.
Step 2 - Start dev mode
Before you plan to modify your integration functions, run:Step 3 - Create the action file
In yournango-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:
salesforce-contact-fields.ts
index.ts
file:
index.ts
Step 4 - Implement your action
In theexec
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 actions- Our reference implementations repo has 600+ examples of syncs and actions implemented by Nango
- Leveraging AI agents guide to build actions with Claude Code, Cursor, and other AI agents
salesforce-contact-fields.ts
await 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 request
The output of an action cannot exceed 2MB.
Step 5 - Test your action locally
Easily test your action function locally as you develop them with thedryrun
function of the CLI:
nango dryrun --help
to see all options.
By default,
dryrun
retrieves connections from your dev
environment. You can change this with a CLI flag.Step 6 - Deploy your action
To run your action in Nango, you need to deploy it to an environment in your Nango account. To deploy all integrations in yournango-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.
Most teams automate deployments to production in their CI.
How to use an action
Pre-built reference implementations
For common use cases, pre-built reference implementations are available to help you get started fast. Select your integration in the Integrations tab and navigate to the Endpoints tab. Available pre-built action integrations will appear in the endpoint list. Select the relevant one and enable it with the toggle. Reference implementations are a starting point. You will likely need to customize them or create your own custom action.Triggering an action synchronously
You can trigger actions from your backend with the REST API or Node SDK.- cURL (standard endpoint)
- Node SDK