Webhooks
A webhook sends a site's alerts to a URL of yours as a small signed JSON request, so they can land in a chat channel, an incident tool or a script. It is another way to receive the alerts you already switch on in the site's settings, not a feed of events: each request carries one site-wide figure and nothing about a single visit.
Set up
- Open the site, then Settings → Reports & alerts, and switch on the alerts you want under Alerts. A webhook is sent when an alert fires, with or without email recipients.
- Under Webhooks, add your endpoint's URL and choose which notifications it gets. A site can have up to 5 endpoints. Owners and admins can manage them.
- Copy the signing secret (
whsec_…). It is shown once and stored encrypted; if you lose it, make a new one. - Press Send test to send a
pingand see what your endpoint answered.
The URL must be https on the standard port, with a host name that resolves to public addresses only and a certificate a browser would accept. Addresses in private or reserved ranges, IP addresses written in the URL, other ports, and user names or passwords in the URL are refused. If your URL has a token in its query, the settings page and the delivery log show it without the query.
Notifications
type | Sent when | data |
|---|---|---|
tracking_stopped | No events have arrived for the hours you set. Once per outage. | metric: "hours_without_events", value, threshold |
tracking_resumed | Events arrive again after a tracking_stopped alert. | Empty |
traffic_spike | Visitors in the last 5 minutes reach your number. At most every 12 hours. | metric, window: "5m", value, below_floor, privacy_floor, threshold |
traffic_drop | Fewer visitors than your number in the last 24 hours. At most every 24 hours. | As for a spike, with window: "24h" |
ping | You press Send test. | Empty |
These are the same alerts as the emails, decided once: an email and a webhook about the same event carry the same number.
Payload
POST /hooks/nordtally HTTP/1.1
Host: example.com
Content-Type: application/json
User-Agent: Nordtally-Webhooks/1 (+https://nordtally.com/docs/webhooks)
Nordtally-Webhook-Id: 6f1c2c0e-8a53-4a4e-9a65-0d4f1d2c3b4a
Nordtally-Webhook-Timestamp: 1795521600
Nordtally-Webhook-Signature: v1=5d2c…e41b
{"version":1,"id":"6f1c2c0e-8a53-4a4e-9a65-0d4f1d2c3b4a","type":"traffic_spike","occurred_at":"2026-11-24T12:00:00.000Z","site":{"id":"YOUR_SITE_ID","domain":"example.com"},"data":{"metric":"visitors","window":"5m","value":80,"below_floor":false,"privacy_floor":3,"threshold":50}}| Field | Meaning |
|---|---|
version | 1. Fields may be added within a version; a field that changes meaning or goes away makes a new one. Ignore fields you don't know. |
id | The delivery's id, also in the Nordtally-Webhook-Id header. The same on every retry. |
type | One of the notifications above. |
occurred_at | When the alert was evaluated, ISO 8601 in UTC. A retry keeps it. |
site.id, site.domain | The site's public id (the data-site value of its snippet) and its domain. |
data.metric | visitors, or visits on strict-mode sites, which store no visitor identifier; hours_without_events for tracking_stopped. |
data.value | The count, or the whole hours without events. null when the count is below the privacy floor. |
data.below_floor, data.privacy_floor | Whether the count was withheld, and the site's privacy floor for shared views. |
data.threshold | The alert's setting at the time. |
A webhook leaves your workspace like an alert email does, so it follows the same rule: a count below the site's privacy floor for shared views is never written out. A traffic drop to fewer than that many visitors reads like this, and zero is not told apart from one or two:
{
"version": 1,
"id": "0b9f5a52-0d0c-4b7e-8c57-3f1b8c1f6a10",
"type": "traffic_drop",
"occurred_at": "2026-11-24T12:00:00.000Z",
"site": { "id": "YOUR_SITE_ID", "domain": "example.com" },
"data": {
"metric": "visitors",
"window": "24h",
"value": null,
"below_floor": true,
"privacy_floor": 3,
"threshold": 100
}
}Verify the signature
Every request has three headers:
| Header | Value |
|---|---|
Nordtally-Webhook-Id | The delivery id. |
Nordtally-Webhook-Timestamp | Unix time in seconds when this attempt was signed. |
Nordtally-Webhook-Signature | v1= followed by the signature in lower-case hex. |
The signature is HMAC-SHA256 over the timestamp, a full stop and the raw request body (timestamp + "." + body), keyed with your signing secret exactly as shown, whsec_ included. To verify a request:
- Compute the same HMAC over the bytes you received, before parsing them.
- Compare it with the header in constant time.
- Refuse a timestamp more than five minutes from your clock, so a captured request can't be replayed later. Nordtally signs each attempt with the current time, retries included.
- Treat an
idyou have already handled as done.
import { createHmac, timingSafeEqual } from 'node:crypto';
import express from 'express';
const SECRET = process.env.NORDTALLY_WEBHOOK_SECRET; // whsec_…
const TOLERANCE_SECONDS = 300;
const app = express();
// The signature covers the bytes as sent: read the raw body, do not re-serialise parsed JSON.
app.post('/hooks/nordtally', express.raw({ type: 'application/json' }), (req, res) => {
const timestamp = req.get('Nordtally-Webhook-Timestamp') ?? '';
const signature = req.get('Nordtally-Webhook-Signature') ?? '';
if (Math.abs(Date.now() / 1000 - Number(timestamp)) > TOLERANCE_SECONDS) {
return res.status(400).send('stale');
}
const expected =
'v1=' + createHmac('sha256', SECRET).update(`${timestamp}.`).update(req.body).digest('hex');
const a = Buffer.from(signature);
const b = Buffer.from(expected);
if (a.length !== b.length || !timingSafeEqual(a, b)) {
return res.status(400).send('bad signature');
}
const event = JSON.parse(req.body.toString('utf8'));
// event.id is the same on every retry: skip one you have already handled.
console.log(event.type, event.site.domain, event.data);
res.sendStatus(204);
});
app.listen(3000);import hashlib
import hmac
import json
import os
import time
from flask import Flask, abort, request
SECRET = os.environ["NORDTALLY_WEBHOOK_SECRET"].encode() # whsec_…
TOLERANCE_SECONDS = 300
app = Flask(__name__)
@app.post("/hooks/nordtally")
def nordtally_webhook():
timestamp = request.headers.get("Nordtally-Webhook-Timestamp", "")
signature = request.headers.get("Nordtally-Webhook-Signature", "")
body = request.get_data() # the raw bytes, not re-serialised JSON
if not timestamp.isdigit() or abs(time.time() - int(timestamp)) > TOLERANCE_SECONDS:
abort(400)
expected = "v1=" + hmac.new(
SECRET, timestamp.encode() + b"." + body, hashlib.sha256
).hexdigest()
if not hmac.compare_digest(signature, expected):
abort(400)
event = json.loads(body)
# event["id"] is the same on every retry: skip one you have already handled.
print(event["type"], event["site"]["domain"], event["data"])
return "", 204New secret in the settings replaces the secret at once: requests are signed with the new one from the next attempt, and the old one is gone. Trust the signature, not the sender's address: we don't publish a list of addresses webhooks come from.
Answering, retries and failures
- Answer with any
2xxwithin 10 seconds. The response body is ignored. Do slow work after answering. - Anything else is a failed attempt: another status, a timeout, a certificate that doesn't validate, or a redirect. Redirects are not followed.
- A failed delivery is tried again after about 5 minutes, 15 minutes, 1 hour, 3 hours, 6 hours and 12 hours: seven attempts over roughly 22 hours, then it is given up. Retries go out on a five-minute tick, so they can be a few minutes later than that.
- Delivery is at least once. If your answer is lost on the way, the same
idarrives again. Order between notifications is not guaranteed; useoccurred_at. - An endpoint with no successful delivery for three days and at least ten failed attempts in a row is switched off, and what was still queued for it is dropped. The settings page shows it as switched off; send a test and resume it there. Nordtally doesn't email anyone about it.
- The settings page keeps the last 10 deliveries of each endpoint: time, type, attempts, the status or kind of error, and how long it took. Payloads and your responses are not kept.
What is never sent
- Single page views, events, sessions or visits. There is no event stream.
- Pages, referrers, sources, campaigns, countries, devices or custom properties.
- Visitor or session identifiers, IP addresses or user agents.
- A count below the site's privacy floor for shared views.
For numbers on request, use the Stats API.