Skip to main content
A webhook channel sends a signed JSON POST to your HTTPS endpoint every time an alert attached to it fires (alert.triggered) or recovers (alert.recovered). Each request carries an HMAC-SHA256 signature over a timestamp and the raw body, so your endpoint can prove the request came from CrispStats and is recent. This page covers the payload, the headers, how to verify the signature and how to handle retries. Set up the channel and the alerts that use it in the dashboard; see alert channels.
CrispStats creates a signing secret (whsec_…) for every webhook channel when you add it, and signs every delivery with it. The dashboard does not show this secret yet, so you cannot verify signatures until it does. Until then, treat incoming requests as unverified: use an endpoint URL that is hard to guess and act only on what you can confirm in the dashboard.

Endpoint requirements

Events

Headers

Payload

The body is a JSON object. Fields under message are written for people and are the same text the email, Slack and Discord channels show; data carries the raw numbers behind the alert.
string
required
The delivery id, the same value as the X-CrispStats-Delivery header.
string
required
alert.triggered, alert.recovered or alert.test.
string
required
When the alert fired, ISO 8601 UTC.
object
required
object
required
object
required
object
required
The raw values that triggered the alert. Its fields depend on the rule type. { "test": true } on alert.test.
This is the body of a test delivery, whose content is fixed:
Alert deliveries have the same shape, with your site, rule and figures filled in.

Verify the signature

1

Read the raw body

Read the request body as bytes before any JSON parsing. Parsing and re-serializing changes the bytes and breaks the signature.
2

Check the timestamp

Read X-CrispStats-Timestamp. Reject the request if it is more than 300 seconds away from your current time, in either direction. This stops an old request from being replayed.
3

Compute the expected signature

Compute HMAC-SHA256 with the channel’s signing secret as the key, over the string {timestamp}.{raw body}: the timestamp, a full stop, then the body. Encode the result as lowercase hex.
4

Compare in constant time

X-CrispStats-Signature holds one or more v1=<hex> values separated by commas or spaces. Accept the request if any v1 value equals your result, using a constant-time comparison.
5

Deduplicate

Store each X-CrispStats-Delivery id you have processed, and skip a request whose id you have seen. Then answer 200.
Both samples below are complete servers on port 8080 that use only the standard library. They read the secret from CRISPSTATS_WEBHOOK_SECRET.
In a framework, make sure you get the unparsed body: in Express use express.raw({ type: "application/json" }) on the webhook route, and in Flask use request.get_data().

Retries and duplicates

  • A 429 or 5xx answer is retried once, after the Retry-After you send (seconds or an HTTP date) or after 1 second. If Retry-After is longer than 5 seconds, the delivery fails without a retry.
  • A timeout or network error is not retried, because the request may have arrived. A 4xx other than 429, and any 3xx, fail at once.
  • If a delivery run is interrupted, the firing is picked up again later and sent with the same delivery id.
Because the same delivery can arrive more than once, always deduplicate on X-CrispStats-Delivery. Answer quickly and do slow work after responding, so you stay inside the 8-second timeout.

Next steps

Alert channels

Add a webhook channel and send a test.

Alert rule types

What each rule type watches and when it fires.

Alerts overview

How alerts, cooldowns and recoveries work.
Last modified on November 17, 2026