When to use actions
Actions are ideal when you want to:- Create unified interfaces across different APIs (e.g., a single
create-contactthat works with Salesforce, HubSpot, Attio, etc.) - Write data asynchronously to external APIs as fast as rate limits allow (e.g., creating hundreds of invoices after a monthly billing run)
- Abstract multi-step operations into a single interface (e.g., create an opportunity and link it to a contact and company in one call)
- Enforce type safety for all interactions with external APIs
Key facts
- Actions run in Nango’s infrastructure, powered by Functions
- Actions take an input and return an output—you control the code, API requests, transformations, and data models
- All platform features are available: data validation, per-customer config, retries, rate-limit handling, and pagination helpers
- Actions run synchronously by default but can also run asynchronously for batch writes
- Actions run in the context of a Connection (API key or access token of your user)
- Actions can call other actions to build workflows
- Actions can be exposed to LLMs via the MCP Server
- Actions can be used to build unified APIs
- All action invocations and API requests are logged in Nango’s logs
How to build an action
If you are using a function template, you can skip to using 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:
nangoobject reference to understand the SDK methods available in actions- Our integration templates 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 messagesreturnwill synchronously return results from the action trigger request
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.
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.
How to use an action
Pre-built integration templates
For common use cases, pre-built integration templates 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. Integration templates 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