Skip to main content

Documentation

Learn how to use the Headless platform

Webhooks

2 min read

Receive notifications when content changes in your project.

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

  1. Go to Project Settings > Webhooks
  2. Click Create Webhook
  3. Enter the destination URL
  4. Select events to trigger on:
    • entry.create
    • entry.update
    • entry.delete
    • entry.publish
    • entry.unpublish
  5. Optionally filter by content type
  6. 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

  1. Go to Project Settings > Webhooks
  2. Click on your webhook
  3. Copy the Signing Secret

Retry Policy

Failed webhook deliveries are retried:

  1. Immediate retry
  2. 1 minute later
  3. 5 minutes later
  4. 30 minutes later
  5. 2 hours later

After all retries fail, the webhook is marked as failed.

Testing Webhooks

  1. Click on a webhook
  2. Click Send Test
  3. A sample payload is sent to your URL
  4. Check the delivery log for results

Delivery Logs

View recent webhook deliveries:

  1. Go to Project Settings > Webhooks
  2. Click on a webhook
  3. View the Delivery Log
  4. 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:

  1. Go to Project Settings > Webhooks
  2. Click on the webhook
  3. Toggle Active to off
  4. Click Save

The webhook will not fire until re-enabled.