---
title: Configuring webhook notifications
summary: null
url: >-
  https://www.fastly.com/documentation/guides/security/client-side-protection/webhook-notifications
---

This guide describes how to configure webhook payloads and receiver setup in order to send webhook notifications. 

> **HINT:** You can also configure webhooks using the [Client-Side Protection API](https://www.fastly.com/documentation/reference/api/client-side-protection).

## Before you begin

Before you begin, ensure you have completed the following:

- Set up an HTTPS receiver that accepts POST requests. The URL must include a host and cannot include user information or a fragment. The destination must resolve only to public IP addresses. The sender checks IPv4 and IPv6 addresses when opening each connection and does not follow redirects.
- Configure your receiver to read the raw request body. Webhook notifications contain JSON and include the `Content-Type: application/json` header.

## Configuring a Page webhook

Follow the steps in our guide on [Managing websites and Pages](https://www.fastly.com/documentation/guides/security/client-side-protection/managing-websites-and-pages). When adding a new page or editing an existing page, select the **Webhook notifications** checkbox and enter your HTTPS receiver URL in the **Webhook URL** field. 

Each webhook has a signing key that your receiver uses to verify notifications. Make sure to copy the signing key and store it in a secure location. 

> **IMPORTANT:** This key won't appear again. If you lose or need to rotate a key, refer to [rotating the signing key](https://www.fastly.com/documentation/guides/security/client-side-protection/webhook-notifications#rotating-the-signing-key).

## Notification format

A notification identifies the Page by name and ID and contains the detected script and response-header changes:

```json
{
  "page_name": "Checkout",
  "protected_resource_id": "5Y9x3Qm7dN2f8Bk1vL6pRa",
  "website": "https://www.example.com",
  "script_changes": [
    {
      "script_uri": "https://www.example.com/checkout.js",
      "change_type": "Added",
      "before_hash": "",
      "after_hash": "sha256-RFWPLDbv2BY+rCkDzsE+0fr8ylGr2R2faWMhq4lfEQc=",
      "date": "2026-10-15T12:00:00Z"
    }
  ],
  "header_changes": []
}
```

## Verifying incoming notifications

You can configure your receiver to verify every incoming notification automatically before processing it. By using the `X-Fastly-Signature` header, which contains an HMAC-SHA256 signature of the exact raw request body, you can have your receiver check the notification's authenticity and whether its body has been modified.

In the example below, the signing key is used to verify the notification. If the current signing key or any previous keys still within the rotation window verifies the signature, the function returns `true`. Otherwise, the function returns `false`. 

> **NOTE:** This example uses the signature key to verify the request body, but doesn't include information about when the notification was sent or if it was already processed.

```javascript

function verifyNotification(rawBody, headers, signingKeys) {
  const signature = headers["x-fastly-signature"];
  if (
    !Buffer.isBuffer(rawBody) ||
    typeof signature !== "string" || !/^[0-9a-f]{64}$/i.test(signature)
  ) {
    return false;
  }

  const received = Buffer.from(signature, "hex");
  return signingKeys.some((signingKey) => {
    if (typeof signingKey !== "string" || signingKey.length === 0) {
      return false;
    }

    const expected = createHmac("sha256", signingKey).update(rawBody).digest();
    return timingSafeEqual(expected, received);
  });
}
```

## Managing webhook URLs and signing keys

Once you configure a Page webhook, the webhook URL and signing key are no longer visible or editable after saving. To change these values, you'll need to [override the webhook URL](https://www.fastly.com/documentation/guides/security/client-side-protection/webhook-notifications#overriding-the-webhook-url) or [rotate the signing key](https://www.fastly.com/documentation/guides/security/client-side-protection/webhook-notifications#rotating-the-signing-key).

### Overriding the webhook URL

To override and replace a saved webhook URL:

1.   Log in to the [Fastly control panel](https://manage.fastly.com).

2.   Go to **Security** > **Client-Side Protection** > [**Pages**](https://manage.fastly.com/security/pages).

3. Click the pencil <span class="inline-icons"><img src="https://www.fastly.com/documentation/img/icons/pencil.png" alt="Pencil icon" /></span> to the right of the Page you want to edit.
4. Next to the **Webhook URL** field, click **Override**.
5. Click **Override** to confirm you want to replace the saved webhook URL. 
6. Enter the replacement URL.
7. Click **Update page**. 

> **HINT:** Only the webhook URL is changed. The signing key remains the same.

### Rotating the signing key

To replace a lost key or rotate a key as part of regular maintenance: 

1.   Log in to the [Fastly control panel](https://manage.fastly.com).

2.   Go to **Security** > **Client-Side Protection** > [**Pages**](https://manage.fastly.com/security/pages).

3. Click the pencil <span class="inline-icons"><img src="https://www.fastly.com/documentation/img/icons/pencil.png" alt="Pencil icon" /></span> to the right of the Page you want to edit.
4. Under **Webhook signing key**, click **Rotate**.
5. Read the confirmation and click **Rotate key**.
6. Click **Copy** and add the replacement key to your receiver's secret configuration.
7. Click **Done** to close the dialog.
8. Click **Update page**. 

> **IMPORTANT:** Previously configured keys remain valid for 72 hours plus five minutes of clock tolerance after each rotation. Be sure to retain every key that is still within this period if you rotate more than once. Queued notification deliveries retain their original URL and signing key.
