create-contact action that works with Salesforce, HubSpot, Attio, and any other CRM through a unified interface.
When to use actions
Actions are ideal when you want to:- Create unified interfaces across different APIs (e.g., one
create-contactthat abstracts Salesforce, HubSpot, and Attio) - Write data to external APIs — creating records, sending messages, triggering workflows
- Abstract multi-step operations into a single call (e.g., create an opportunity and link it to a contact and company in one request)
- Enforce type safety for all interactions with external APIs
Key facts
- Actions run in Nango’s infrastructure, scoped to a connection
- Actions take a typed input and return a typed output — you control the code and data models
- Actions run synchronously by default, returning results directly in the API response
- Actions can also run asynchronously for batch workloads
- Actions can call other actions to compose workflows
- Actions can be exposed as LLM tools via Nango’s built-in MCP server
- The output of an action cannot exceed 2 MB
- All invocations and API calls are logged in the Nango dashboard
Build an action
Step 1 — Set up your integrations folder
If you don’t have anango-integrations folder yet, follow the functions setup guide.
Step 2 — Start dev mode
Step 3 — Create the action file
Action files live inside anactions/ folder nested under the integration folder. For an action that fetches available fields on the Salesforce Contact object:
salesforce-contact-fields.ts
index.ts:
index.ts
Step 4 — Implement your action
Write the logic in theexec method. Here is a complete action that fetches available fields on the Salesforce Contact object:
salesforce-contact-fields.ts
SDK methods available in actions
| Method | Description |
|---|---|
nango.get(config) | Authenticated GET request |
nango.post(config) | Authenticated POST request |
nango.put(config) | Authenticated PUT request |
nango.patch(config) | Authenticated PATCH request |
nango.delete(config) | Authenticated DELETE request |
nango.log(message) | Write a custom log to the Nango dashboard |
nango.getMetadata() | Read per-connection metadata |
nango.setMetadata(data) | Write per-connection metadata |
nango.triggerAction(key, id, name, input) | Call another action from within this action |
nango.paginate(config) | Iterate through paginated API responses |
Step 5 — Test locally
nango dryrun --help to see all options.
Step 6 — Deploy
Use an action from your backend
Triggering an action synchronously
- Node SDK
- cURL
Triggering an action asynchronously
Asynchronous execution is ideal for batch writes or workloads where you want Nango to handle rate limits and retries transparently without blocking your request.Action workflows
Actions can call other actions usingnango.triggerAction() from within the exec method. Each invocation appears separately in the Nango logs.
Action configuration reference
| Field | Type | Description |
|---|---|---|
description | string | Human-readable description of the action |
version | string | Semantic version; increment on breaking changes |
input | z.ZodType | Zod schema for the action’s input (use z.void() for no input) |
output | z.ZodType | Zod schema for the action’s return value |
exec | function | The action implementation |