Integration configuration (nango.yaml)
Example
Integrations fields
Integration configuration fields are under integrations.<INTEGRATION-ID>
.
Lists the syncs for a given integration.
Lists the actions for a given integration.
Sync fields
Sync configuration fields are under integrations.<INTEGRATION-ID>.syncs.<SYNC-NAME>
.
Describes the sync.
Defines the schema of the data you want to sync. References a schema from the Models section of this configuration file.
Each sync has a corresponding generated endpoint to fetch the data, configured in the endpoint
field below.
Syncs can have multiple output models. This is useful when there is some form of dependency between the two models, e.g.
- Fetching the data for a model from the external API requires fetching the data from another model first
- You want the records of one model to be persisted before the records of another model
When defining multiple output models, you must define as many endpoints. The 1st endpoint will return the 1st model, the 2nd endpoint the 2nd model, etc.
Here’s an example:
Defines the endpoint to use to fetch the output model.
The value is formatted as follows: <METHOD> <URL-PATH>
. e.g.: GET /tasks
.
Possible method values are: GET
, POST
, PUT
, PATCH
, DELETE
.
The method/endpoint combination can be shared across syncs to unify the communication with external APIs.
Specifies whether each sync execution replaces all of the data (full
) or upserts it (incremental
).
Learn more about incremental vs. full refresh syncing.
Specifies the frequency of the sync. Supports ms notations.
Defaults to 24h.
Defines the schema of the data required to run the sync. References a schema from the models.
Sync inputs are passed from your app to the sync script via the connection metadata (step-by-step guide).
Lists the necessary scopes to execute the sync.
This list is just indicative; it doesn’t trigger any automatic configuration (yet). List necessary scopes on the external API developer portal and your Nango UI integration settings.
Defaults to no scope.
If true
, automatically starts synchronizing between the external API and Nango when a new connection is created. Otherwise, it needs to be triggered via the API or Nango UI.
Defaults to true
.
If true
, automatically detects deleted records and flags them when you fetch the latest data.
Defaults to false
.
Lists the types of external webhooks the sync script will handle. Multiple syncs can listen to the same subscription. Learn more about handling external webhooks in syncs: step-by-step guide.
Action fields
Action configuration fields are under integrations.<INTEGRATION-ID>.actions.<ACTION-NAME>
.
Describes the action.
Defines the schema of the data returned by the action. References a schema from the models section of this configuration file.
Each action has a corresponding generated endpoint to trigger it, configured in the endpoint
field below.
Defines the endpoint to use to trigger the action.
The value is formatted as follows: <METHOD> <URL-PATH>
. e.g.: POST /tasks
.
Possible method values are: GET
, POST
, PUT
, PATCH
, DELETE
.
The method/endpoint combination can be shared across actions to unify the communication with external APIs.
Defines the schema of the data required to trigger the action. References a schema from the Models.
Action inputs are passed as parameters when triggering the action.
Lists the necessary scopes to trigger the action.
This list is just indicative; it doesn’t trigger any automatic configuration (yet). List necessary scopes on the external API developer portal and your Nango UI integration settings.
Defaults to no scope.
Model types
The models
section contains the schemas referenced in the inputs & outputs of the above integrations
section.
Basic types
For each model, you must define its fields and data types. Data types are based on Typescript types, with some tweaks:
nango.yaml type | Corresponding Typescript type |
---|---|
bool or boolean | boolean |
string | string |
char | string |
integer or int or number | number |
date | Date |
You can also pass existing Typescript types such as undefined
, null
, and more.
Arrays
Your can use array types if the []
notation:
Type & string unions
You can use union types such as:
You can also use string unions to enforce specific values:
You can mix types and strings in unions:
When you use the |
notation, we check each element against known Typescript types, to categorize it as type (if match) or string (if no match).
Reference other models
Your can use other models as types:
Extend types
You can have a model extend the properties of another base model:
Dynamic field keys
You can allow dynamic keys in models:
Which translates to the following generated Typescript model:
Deploying your configuration
Changes to your integration configuration become active once you deploy them to a Nango environment using the nango deploy
CLI command.
These changes can have significant impacts, in particular, if you:
- Add a sync
- Remove a sync or an action
- Change a model or a script
Adding a sync
Unless you sync configuration specifies auto_start=false
, the deployment will kick off the data synchronization between the external API and Nango, for all relevant connections.
This change will be reflected in the Nango UI in Integrations > select your integration > Script tab.
Removing a sync
Removing a sync will erase all the cached data related to that sync, for all relevant connections. The synced records will no longer be accessive via the Nango API & SDKs.
This change will be reflected in the Nango UI in Integrations > select your integration > Script tab.
Changing the integration ID in your configuration is the equivalent of deleting the sync with the old integration ID, and creating a new one. So, the data cached by the old sync will be deleted (for all relevant connections).
Removing an action
Removing an action will cause the failure of any request to trigger this action.
This change will be reflected in the Nango UI in Integrations > select your integration > Script tab.
Changing a model or script
For full refresh syncs, as the data is replaced on each sync execution, the new model and script logic will apply to all records as soon as the sync executes following the deployment.
For incremental syncs, you can end up with model disparities, as older records will have outdated content. You will still be able to fetch them from the Nango cache. In some cases, it’s better to trigger a full resync via the API or the Nango UI, so that all historical records are fetched again using the new script & model.
Importing models in scripts
The models defined in your nango.yaml
configuration are used to generate Typescript models (in the nango-integrations/models.ts
file).
You can then import the relevant models from models.ts
in your integration scripts.
If your app uses typescript, you can import these same models to enforce strong typing to the Nango API & SDK responses.
Questions, problems, feedback? Please reach out in the Slack community.
Was this page helpful?