Skip to main content
Many integrations need customer-specific behavior: custom field mappings, record filters, or feature toggles. Customers running custom schemas in their CRMs or ERPs need integrations that adapt to their setup without you forking code. Nango solves this with connection metadata — arbitrary JSON stored on each connection that your functions can read at runtime.

How it works

Each connection can carry a metadata object. You set it from your backend (when a customer configures their integration), and read it inside any sync or action function to customize behavior per customer.

Setting connection metadata

Set metadata from your backend after a customer configures their integration.
When reading metadata inside a sync with nango.getMetadata(), values are cached for up to 60 seconds. Changes made mid-execution will take effect on the next sync run.

Reading metadata in functions

Inside any sync or action, use nango.getMetadata() to access the connection’s metadata.
hubspot/contacts-sync.ts

Common use cases

Customers using CRMs or ERPs often store data in custom fields with provider-specific names. Let customers map their custom fields to your internal fields through your UI, then persist the mapping in metadata.
1

Fetch available custom fields

Use an action to retrieve the customer’s custom fields from the external API.
2

Show mapping UI to the customer

Display the external fields in your product UI and let the customer map them to your internal fields.
3

Save the mapping to metadata

4

Use the mapping in your sync

Read fieldMapping from metadata inside your sync function and use the mapped field names in API requests.
Enable or disable integration features per customer without deploying new code.
Let customers define which records to sync — by status, date range, team, or any other criteria.

Best practices

  • Start with defaults — only add per-customer config when you see the same need recurring across customers.
  • Use a typed schema — define a TypeScript interface for your metadata to catch errors early.
  • Build a config UI — capture customer config in your product, then persist it with setMetadata. Never ask customers to set metadata manually.
  • Version your schema — when you add or rename metadata keys, handle both old and new formats in your functions during the transition.
  • Fold universals back into defaults — if a per-customer config becomes universal, move it into the function’s default behavior to reduce complexity.
You can view and edit connection metadata in the Nango dashboard: Connections tab → select a connection → Authorization tab.