---
title: Webhooks and signatures
description: The alert webhook payload, delivery and retry rules, and how to verify the ZevSight-Signature header in Node.js, Python and Go.
url: https://docs.zevsight.com/respond/webhooks
---

# Webhooks and signatures

> The alert webhook payload, delivery and retry rules, and how to verify the ZevSight-Signature header in Node.js, Python and Go.

A webhook channel POSTs JSON to your HTTPS endpoint whenever an alert starts, repeats, is acknowledged or resolves.

## Set up

Add a **Webhook** channel on **Alerts → Channels** with:

- **URL.** HTTPS, a public host, no credentials in the URL, up to 2,048 characters.
- **Signing secret** (optional, recommended). 16 to 256 characters. The dashboard can generate one such as `whsec_` followed by 48 hex characters.

## Payload

```json
{
  "type": "alert.started",
  "alert": {
    "id": "01937a4e-8c2f-7d3a-9b1e-4f6a2c8d0e5b",
    "rule": { "id": "<RULE_ID>", "name": "Checkout API is down", "kind": "check" },
    "severity": "sev2",
    "project": "prj_8KdT3mQ2wXr7nB4cVhY9p",
    "service": "checkout",
    "environment": "production",
    "targets": [{ "environment": "production", "service": "checkout" }],
    "started_at": "2026-11-29T09:41:07Z",
    "resolved_at": null,
    "cause": "status 503 · 2 of 3 regions",
    "url": "https://app.zevsight.com/...",
    "runbook_url": null
  },
  "sent_at": "2026-11-29T09:41:08Z"
}
```

| `type` | Sent when |
|---|---|
| `alert.started` | The alert opens |
| `alert.reminder` | The escalation policy repeats while the alert is open |
| `alert.acknowledged` | Someone acknowledged |
| `alert.resolved` | It resolved |
| `test` | You pressed **Test**. Body: `{"type":"test","message":"…","sent_at":"…"}` |

`alert.rule.kind` is `check`, `heartbeat`, `log` or `manual`. Snoozing is not sent to channels.

## Delivery

- Headers: `Content-Type: application/json`, `User-Agent: ZevSight-Alerts/1`, and `ZevSight-Signature` when a secret is set.
- Each request times out after 10 seconds. Answer with any `2xx` quickly and do the work afterwards.
- Up to 3 attempts, 500 ms then 2 s apart. `409`, `429`, `5xx` and network errors are retried; other `4xx` responses are final.
- Redirects are not followed.
- Delivery is at least once. Use `alert.id` plus `type` to drop duplicates.

## Verify the signature

```http
ZevSight-Signature: t=1764409268,v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd
```

- `t` is the Unix time in seconds when the request was signed.
- `v1` is the hex HMAC-SHA256 of the string `<t>.<raw body>`, keyed with your signing secret exactly as you entered it (the whole string, including any `whsec_` prefix).

To verify:

1. Read the **raw** request body, before any JSON parsing.
2. Compute `HMAC-SHA256(secret, t + "." + body)` and hex-encode it.
3. Compare it to `v1` in constant time.
4. Reject requests whose `t` is too old for your taste. ZevSight does not set a window; five minutes is a sensible choice, and also limits replays.

> **Warning**
>
> Verify against the exact bytes you received. Re-serialising parsed JSON changes whitespace and key order, and the signature will not match.

### Node.js

```js

const SECRET = process.env.ZEVSIGHT_WEBHOOK_SECRET;
const app = express();

app.post('/zevsight', express.raw({ type: 'application/json' }), (req, res) => {
  const header = req.get('ZevSight-Signature') ?? '';
  const parts = Object.fromEntries(header.split(',').map((p) => p.split('=', 2)));
  const t = Number(parts.t);
  if (!parts.v1 || !Number.isFinite(t) || Math.abs(Date.now() / 1000 - t) > 300) return res.sendStatus(400);

  const expected = crypto.createHmac('sha256', SECRET).update(`${parts.t}.`).update(req.body).digest('hex');
  const ok = expected.length === parts.v1.length &&
    crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1));
  if (!ok) return res.sendStatus(401);

  const event = JSON.parse(req.body.toString('utf8'));
  res.sendStatus(204);
  handle(event); // after answering
});
```

### Python

```python
import hashlib, hmac, os, time
from flask import Flask, request, abort

SECRET = os.environ["ZEVSIGHT_WEBHOOK_SECRET"].encode()
app = Flask(__name__)

@app.post("/zevsight")
def zevsight():
    parts = dict(p.split("=", 1) for p in request.headers.get("ZevSight-Signature", "").split(",") if "=" in p)
    t, v1 = parts.get("t", ""), parts.get("v1", "")
    if not t.isdigit() or abs(time.time() - int(t)) > 300:
        abort(400)
    body = request.get_data()  # raw bytes
    expected = hmac.new(SECRET, t.encode() + b"." + body, hashlib.sha256).hexdigest()
    if not hmac.compare_digest(expected, v1):
        abort(401)
    event = request.get_json()
    return "", 204
```

### Go

```go
func verify(secret string, header string, body []byte) bool {
	var t, v1 string
	for _, p := range strings.Split(header, ",") {
		k, v, _ := strings.Cut(p, "=")
		switch k {
		case "t":
			t = v
		case "v1":
			v1 = v
		}
	}
	ts, err := strconv.ParseInt(t, 10, 64)
	if err != nil || v1 == "" || math.Abs(float64(time.Now().Unix()-ts)) > 300 {
		return false
	}
	mac := hmac.New(sha256.New, []byte(secret))
	mac.Write([]byte(t + "."))
	mac.Write(body)
	expected := hex.EncodeToString(mac.Sum(nil))
	return hmac.Equal([]byte(expected), []byte(v1))
}
```

## Status page subscriber webhooks

Status pages can also notify webhook subscribers about published reports and maintenance. See [Subscribers](/status-pages/subscribers).
