Documentation Index
Fetch the complete documentation index at: https://nango.dev/docs/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Functions are Nangoβs runtime for custom integration logic. When you build integrations directly, every provider forces you to solve the same hard problems: OAuth credentials, token refresh, per-customer permissions, retries, rate limits, data freshness, observability, and safe execution. Nango handles that infrastructure, and functions let you write the provider-specific logic that is unique to your product. You write functions in TypeScript and deploy them to Nango. Your app can call them from any language, framework, backend job, or agent workflow. Each execution runs for a specific integration and connection, so the function has scoped access to the right customerβs credentials without exposing those credentials to your app or agent.How functions fit
- Your user authorizes an external API through Nango Auth.
- Your app stores the resulting
connectionId. - You deploy functions for the integration.
- Nango runs the function on demand, on a schedule, from an external webhook, or after a connection lifecycle event.
- Your app receives the function result, sync records, or webhooks from Nango.
Capabilities
- Scoped external API access β run API calls with the credentials and scopes of one connection.
- Any app stack β trigger functions through HTTP APIs or SDKs from any backend language.
- Multiple trigger types β call functions on demand, run them on a schedule, route external webhooks into them, or react to connection lifecycle events.
- Agent-ready tools β expose selected functions to agents through the API or Nangoβs MCP server while keeping provider credentials out of the model loop.
- Built-in integration infrastructure β retries, rate-limit handling, logs, OpenTelemetry export, records storage, checkpoints, and per-connection metadata.
- Local development and CI/CD β dry run functions against real connections, snapshot test them, and deploy them with your application pipeline.
Template catalog
Nangoβs template catalog contains template functions for common provider use cases. Use it to ship faster, inspect implementation patterns, or bootstrap a custom function. Template functions are normal Nango functions. You can deploy them as-is when they fit your use case, or pull the source into your functions project and customize it. You can browse template functions in three places:- The template catalog on the Nango website.
- The integration page in the Nango dashboard.
- The source code in the Nango integration templates repository.
index.ts if needed, adjust inputs, outputs, record models, metadata, or provider mapping logic, then run nango dryrun and deploy with nango deploy.
Template action functions can also be exposed as agent tools. Enable the action function, discover its schema with the Get integration functions config API, then execute it through tool calling, the action trigger API, or Nangoβs MCP server.
Function AI Builder
Nangoβs Function AI Builder is a workflow for building functions with the coding agent, IDE, and model of your choice. Instead of using a black-box integration generator, you get TypeScript function code that you can review, test, customize, deploy, and maintain in your own repo. Use both sources of context when asking an agent to build a function:- Add Nangoβs documentation MCP server:
https://nango.dev/docs/mcp - Install the Nango function builder skill:
If your coding agent is already running, restart it after installing the skill so it can load the new instructions.
index.ts, adds schemas, writes or updates tests, runs nango dryrun, iterates on failures, and leaves the function ready for nango deploy.
Step-by-step guide
Install and initialize
Install the Nango CLI globally:Initialize your integrations folder at the root of your repo and commit it to source control:This creates a
nango-integrations/ folder with example configuration. The .nango subdirectory must be committed because the CLI uses it to track deployed state.Configure environment keys
Add your secret keys to a Get your secret keys from Environment Settings > API Keys. The CLI picks up the matching key for whichever environment you deploy to.
.env file inside nango-integrations/:nango init creates nango-integrations/.gitignore with .env ignored. Keep the .env file untracked so Nango secret keys are not committed.Keys are matched by environment name:
NANGO_SECRET_KEY_<ENV_NAME>. If you rename an environment in the UI, update the variable name in .env to match.Team setup
Team setup
Give each engineer their own Nango environment. This prevents overwriting each otherβs deployed functions and lets each person configure webhooks independently, for example by pointing to a local ngrok tunnel.Each engineer adds their environmentβs key to their local Use a shared
.env:dev or staging environment as a stable baseline written to only by CI. See the CI/CD guide.For agents
For agents
Run
nango init nango-integrations to scaffold the folder. Ask the user for their secret key from Environment Settings > API Keys and write it to nango-integrations/.env. Confirm that nango-integrations/.gitignore ignores .env.For additional context while building, use Nangoβs documentation MCP: https://nango.dev/docs/mcp.Understand the folder layout
Each integration gets its own folder, with subfolders by function type. Each new function file must be imported in
index.ts imports every function file you want deployed:index.ts, for example import './github/syncs/github-issues';.Run dev mode
Keep dev mode running while you write code:
nango dev continuously type-checks and compiles your function files, surfacing errors immediately.Choose a function type
Choose the function type by starting from the event that should cause Nango to run your logic.
| If you need to⦠| Guides | Trigger types | Common examples |
|---|---|---|---|
| Keep external API data fresh in your app, or react to changes | Sync function | Schedule, manual sync trigger, or external webhook reconciliation | Sync contacts/files/events/tickets, RAG, change detection / triggers |
| Run an operation when your app or agent asks for it | Action function | HTTP API, SDK, async action queue, or MCP/tool call | Create an issue, send a message, fetch details, perform a write |
| Process an external provider webhook inside Nango | Webhook function | External API sends a webhook to Nango | Update records from a webhook payload, normalize events, mark data for reconciliation |
| React when a Nango connection is created, validated, or deleted | Event function | Nango connection lifecycle event | Validate credentials, register provider webhooks, seed metadata, clean up subscriptions |
Build the function
Follow the specific function type guide for implementation details:
- Sync functions β build scheduled data replication, checkpoints, metadata-driven parameters, and record consumption.
- Action functions β build action function operations your app, jobs, or agents can call.
- Webhook functions β process external API webhooks inside Nango.
- Event functions β react to Nango connection lifecycle events.
Test and deploy
Dry run a function against a real connection:If the function reads connection metadata, pass test metadata:Deploy your functions:For function-type-specific commands, see the Sync function guide, Action function guide, and Testing.
Receive webhooks from Nango
Nango sends webhooks to your app when important events happen: a connection is created, a sync run finishes, an async action completes, or an external webhook is forwarded.Configure your app endpoint in Environment Settings > Webhook URLs. Webhook URLs are environment-specific, and you can configure up to two URLs per environment. Your endpoint should accept For sync webhooks, fetch changed records from the records API, process them in your app, and persist the last processed cursor. For forwarded external webhooks, see Webhook forwarding.Read Receive webhooks from Nango for signature verification, retry behavior, failure payloads, and the full webhook reference.
POST requests, verify the X-Nango-Hmac-Sha256 signature, and return a 2xx response after processing.Common webhook payloads:Auth creation
Sync completion
Async action completion
Related guides
- Template catalog β use template functions directly or pull their source code to customize.
- Function AI Builder β use Nango docs, MCP context, and skills with coding agents.
- Function tool calling β expose action functions to agents, LLM SDKs, and MCP clients.
- Unified APIs β build provider-specific functions behind one stable model.
- Logging β control custom function logs locally and in cloud environments.
- Storage β store per-connection metadata and read it inside functions.
- Data validation β validate function input, output, and provider API responses.
- Testing β dry runs, mocks, and snapshot tests.
- Rate limits β handle provider
429responses and long-running retries. - CI/CD β deploy functions with your application pipeline.