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.- Node SDK
- REST API
Reading metadata in functions
Inside any sync or action, usenango.getMetadata() to access the connection’s metadata.
hubspot/contacts-sync.ts
Common use cases
Custom field mappings
Custom field mappings
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.Feature flags per customer
Feature flags per customer
Enable or disable integration features per customer without deploying new code.
Filtering records
Filtering records
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.