What are Webhooks?
Webhooks allow your external systems to be notified when events occur in your CMS:
- A new entry is created
- An entry is updated or deleted
- Content is published or unpublished
Creating a Webhook
- Go to Project Settings > Webhooks
- Click Create Webhook
- Enter the destination URL
- Select events to trigger on:
entry.createentry.updateentry.deleteentry.publishentry.unpublish
- Optionally filter by content type
- Click Create
Webhook Payload
When an event occurs, we send a POST request to your URL:
JSON
{
"event": "entry.publish",
"timestamp": "2025-01-21T10:30:00Z",
"project": {
"id": "proj_123",
"slug": "marketing-site"
},
"contentType": {
"id": "ct_456",
"apiId": "blogPost"
},
"entry": {
"id": "entry_789",
"data": {
"title": "My Blog Post",
"slug": "my-blog-post"
}
}
}Webhook Security
Signature Verification
Each webhook includes a signature header:
Text
X-Webhook-Signature: sha256=abc123...Verify by computing HMAC-SHA256 of the payload with your webhook secret:
JavaScript
const crypto = require('crypto');
function verifySignature(payload, signature, secret) {
const expected = crypto
.createHmac('sha256', secret)
.update(payload)
.digest('hex');
return `sha256=${expected}` === signature;
}Getting Your Secret
- Go to Project Settings > Webhooks
- Click on your webhook
- Copy the Signing Secret
Retry Policy
Failed webhook deliveries are retried:
- Immediate retry
- 1 minute later
- 5 minutes later
- 30 minutes later
- 2 hours later
After all retries fail, the webhook is marked as failed.
Testing Webhooks
- Click on a webhook
- Click Send Test
- A sample payload is sent to your URL
- Check the delivery log for results
Delivery Logs
View recent webhook deliveries:
- Go to Project Settings > Webhooks
- Click on a webhook
- View the Delivery Log
- See status, response code, and timing
Common Use Cases
Static Site Rebuild
Trigger a rebuild when content changes:
JSON
{
"url": "https://api.netlify.com/build_hooks/xxx",
"events": ["entry.publish", "entry.unpublish"]
}Cache Invalidation
Clear CDN cache when content updates:
JSON
{
"url": "https://your-api.com/invalidate-cache",
"events": ["entry.update", "entry.delete"]
}Slack Notifications
Send to a Slack webhook when content is published:
JSON
{
"url": "https://hooks.slack.com/services/xxx",
"events": ["entry.publish"]
}Disabling Webhooks
To temporarily disable a webhook:
- Go to Project Settings > Webhooks
- Click on the webhook
- Toggle Active to off
- Click Save
The webhook will not fire until re-enabled.