Receive webhook notifications

Learn how to receive webhook notifications through GitBook’s integration

The Webhook integration allows you to receive real-time notifications when events occur in your GitBook spaces. This integration supports configurable webhook URL, HMAC signature verification, and automatic retry logic with exponential backoff.

Features

  • Real-time event delivery: Receive instant notifications for selected events

  • HMAC signature verification: Secure webhook delivery with cryptographic verification

  • Automatic retry logic: Built-in retry mechanism with exponential backoff for failed deliveries

  • Configurable events: Choose which events to receive (site views, content updates, page feedback)

Getting started

Before following the rest of the guide, make sure the Webhook integration is installed into your organization.

Supported events

The webhook integration can be installed either in spaces or in sites. The list of events you can select depends on where the integration is installed.

For spaces:

  • Content updates - When content in your space is modified

For sites:

  • Site views - When users visit pages on your site

  • Page feedback - When users provide feedback on pages

Content updated events (space_content_updated)

Triggered when content in a space is modified.

Payload example:

Site view events (site_view)

Triggered when a user visits a page on your GitBook site.

Payload example:

Page feedback events (page_feedback)

Triggered when users provide feedback on pages.

Payload example:

Configuration

Required settings

  • Webhook URL: The endpoint where events will be sent

  • Event types: Select which events to receive

Webhook security

HMAC signature verification

All webhook requests include an HMAC-SHA256 signature in the X-GitBook-Signature header for verification.

Header format:

Where:

  • t: Unix timestamp of the request

  • v1: HMAC-SHA256 signature of the payload

Signature verification example

Retry logic

The integration includes automatic retry logic for failed webhook deliveries:

  • Max retries: 3 attempts

  • Backoff strategy: Exponential backoff with jitter

  • Base delay: 1 second

  • Jitter: ±10% of base delay

  • Retry conditions:

    • Network errors (timeouts, connection refused)

    • Server errors (5xx status codes)

    • Rate limiting (429 status codes)

  • No retry: Client errors (4xx except 429)

Retry schedule example

Attempt
Base delay
Jitter range
Total delay range
Schedule

1

1s

±0.1s

1.0-1.1s

1s

2

2s

±0.2s

2.0-2.2s

2s

3

4s

±0.4s

4.0-4.4s

4s

Error handling

HTTP status codes

  • 200: Success

  • 400: Bad Request (client error, no retry)

  • 429: Too Many Requests (rate limited, will retry)

  • 500: Internal Server Error (server error, will retry)

Best practices

1. Webhook endpoint design

2. Idempotency

Handle duplicate events gracefully:

3. Async processing

Process events asynchronously to respond quickly:

Last updated

Was this helpful?