Skip to main content
This page describes the fields you set when you register a webhook in the dashboard (Settings > Webhooks > Add webhook +).

Endpoint URL

The URL that receives notifications. It must be a public https URL with a valid TLS certificate that is not self-signed. Bodyguard denies webhooks registered with an http URL.

Events

A webhook is triggered by one or more events that you subscribe to: One webhook can subscribe to several events. You can also add another webhook with a different URL to handle other events separately.
Bodyguard also sends a webhook.validate event, which you cannot subscribe to. Your endpoint must answer it with a 2xx status code when you enable the webhook, and when you change the URL or the custom headers of an enabled webhook.
For the content of each event, see Payloads.

Signing secret

Bodyguard generates a signing secret for each webhook. It starts with whsec_ followed by a base64-encoded value. The dashboard displays it only once, when you create the webhook, so copy it then. See Connect your webhook. Bodyguard uses it to sign every request, and you use it to verify that a request comes from Bodyguard and was not altered. See Quick start.
Treat the signing secret like a password. Store it in a secrets manager or an environment variable, and never expose it in client-side code.

Custom headers

Custom headers are optional HTTP headers that you add to a webhook as key/value pairs. Bodyguard includes them in every request it sends to your endpoint, including webhook.validate events. For example, use them to send a token expected by your API gateway. Custom headers follow these rules:
  • A webhook can have up to 20 custom headers.
  • Each key and each value is limited to 256 characters.
  • A key must be a valid HTTP header name.
  • Keys are case-insensitive: you can’t set the same key twice, even with a different case.
  • Standard headers, set by Bodyguard or by the HTTP protocol, can’t be used as custom headers, whatever their case: for example Content-Type, webhook-signature, or User-Agent.
If you change the custom headers of an enabled webhook, Bodyguard sends a webhook.validate event with the new headers. If your endpoint doesn’t answer with a 2xx status code, the update fails and the webhook keeps its previous headers.
Custom headers don’t replace signature verification. Always verify the webhook-signature header of each request, as described in the Quick start.

Contacts

Each new webhook requires at least one contact. Bodyguard sends alerts to every contact if it encounters issues reaching your endpoint, such as the emails described in Handling errors. Each contact must be a user registered to your organization on the dashboard.

Webhook statuses

Each webhook has a status that describes its current state: The ERROR status is set automatically. While a webhook is DISABLED or ERROR, Bodyguard doesn’t send its events, and they can’t be replayed when you enable the webhook again. To enable a webhook in error, fix the issue, then enable it manually from the dashboard. See Handling errors.

Next steps

Payloads

Headers, payload structure, and an example for each event type.