Webhooks from Nango to your app
You can configure Nango to send a webhook to your app every time a sync finishes and new data is available.
To set this up, go to Project Settings page and set your webhook receive URL there.
You can change the webhook delivery so it sends every time a sync finishes regardless if new data is available in project settings.
The webhook from Nango is a POST request with the following body:
If your sync returns multiple models, you may receive multiple webhooks for the same sync run (one for each model).
For full type safety, the @nangohq/node package exports a type annotation for the webhook. Example usage:
Webhooks with non-2xx responses are retried with exponential backoff.
Webhook Verification
You can validate that the webhook indeed comes from Nango by looking at the
X-Nango-Signature header which is a SHA-256 hash built using the secret
key found in your project settings combined with the payload of the request body:
If the value of the X-Nango-Signature matches that of hash (as seen above)
then the request passed validation.
Webhooks from external APIs to Nango
You can handle incoming webhooks from external APIs using Nango:
- Configure the webhook with your application as you would normally do
- Write a sync script that returns the data models you want (it can perform additional API requests if needed)
- Upon webhook reception, trigger the sync script and pass it the webhook payload- Upon webhook reception, trigger the sync script and pass it the webhook payload