Manage webhooks in Netlify Connect
After you create and configure a data layer, you can generate a webhook for your data layer and use it to trigger a data layer sync from an external system.
For most data sources, you need to generate an authenticated webhook and add it to your data source instance to notify Netlify when data changes. Once notified, Netlify will kick off a new data sync for your data layer.
Keep in mind the following before you set up your webhook:
- Webhooks should act only as notifications to let Connect know that content updates are available and that Connect should start a new sync to get the latest data.
- Webhooks should be stateless and they should not contain information about what needs to be updated.
- If multiple webhook notifications come in at the same time, the newest one will take precedence and all others will be dropped.
- If a new webhook notification comes in while a sync is in progress, Connect will process that webhook immediately after the current sync finishes.
Team Owners and Developers can add or delete webhooks at any time. Netlify records the addition and deletion of webhooks in the team audit log.
Webhook format
Section titled “Webhook format”The format for a data layer webhook is https://webhook.netlify-connect.com/hooks/data_layer/data_source/publish/{data_layer_id}/{webhook_id}
.
Every data layer has a default webhook that is the same as above but without the unique webhook ID: https://webhook.netlify-connect.com/hooks/data_layer/data_source/publish/{data_layer_id}
.
However, we recommend that you add a new authenticated webhook for your data layer and use that instead of the default. When you create a new webhook, Netlify generates a custom ID and appends it to the webhook URL to give you a unique webhook URL.
Add a webhook
Section titled “Add a webhook”- Navigate to the Connect page for your team in the Netlify UI.
- Select the data layer from the Data layers list, and then select Data layer settings.
- On the data layer settings page, select Webhooks.
- Select Add a webhook.
- Enter a Name for this webhook.
- Select Create webhook.
You can now send a POST request to the webhook to trigger a sync for your data layer. For example:
curl -X POST -d {} https://webhook.netlify-connect.com/hooks/data_layer/data_source/publish/{data_layer_id}/{webhook_id}
Add headers to customize the request
Section titled “Add headers to customize the request”If you wish to only update a single data source or add a webhook body, add a x-connect-data-source
header to the request with the data integration’s slug as the header’s value.
Delete a webhook
Section titled “Delete a webhook”To delete a webhook from your data layer:
- Navigate to the Connect page for your team in the Netlify UI.
- Select the data layer from the Data layers list, and then select Data layer settings.
- On the data layer settings page, select Webhooks.
- Select the webhook you want to delete.
- Select Delete webhook.
- A confirmation prompt will appear. Review the details and then select Delete.
After you delete all of your webhooks, the default webhook will be authenticated again.
Did you find this doc useful?
Your feedback helps us improve our docs.