Analytics
Webhooks
Send cohorts to your own app, Zapier or an email tool: signed JSON, in batches, with retries.
Set one up
- 1
Add a webhook
A project admin opens People → Destinations and adds a name and URL. It must behttps://and reachable on the public internet; private and local addresses are refused. - 2
Copy the signing secret
From the webhook's menu, Signing secret reveals awhsec_…value. Store it as a secret in the receiving app. - 3
Send a test, then a cohort
Send test posts aping. Then open any cohort and choose Send to…. Every send is logged with its result.
What we send
A POST with JSON, up to 500 people per request. People always include their IDs; traits are only the ones picked when sending.
{
"object": "cohort.batch",
"id": "8b0c…:1", // delivery id and batch number: the same on retries
"delivery": "8b0c…",
"cohort": { "id": "3f1e…", "name": "Dropped off after signup" },
"batch": 1,
"batches": 3,
"people": [
{
"id": "a51d…",
"user_ids": ["user_123"],
"anonymous_ids": ["9f2c…"],
"other_ids": [{ "kind": "email_sha256", "value": "5d41…" }],
"traits": { "email": "sam@example.com" }
}
]
}Verifying signatures
Each request has an Incrementality-Signature header: t=<unix time>,v1=<signature>. The signature is the HMAC-SHA256 of <t>.<raw body> with your signing secret, in hex. Check it against the raw body, before parsing, and refuse requests older than 5 minutes.
import { createHmac, timingSafeEqual } from "node:crypto";
export function verify(rawBody, header, secret) {
const { t, v1 } = Object.fromEntries(header.split(",").map((p) => p.split("=")));
if (Math.abs(Date.now() / 1000 - Number(t)) > 300) return false;
const expected = createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex");
return v1.length === expected.length && timingSafeEqual(Buffer.from(v1), Buffer.from(expected));
}import hashlib, hmac, time
def verify(raw_body: bytes, header: str, secret: str) -> bool:
parts = dict(p.split("=", 1) for p in header.split(","))
if abs(time.time() - int(parts["t"])) > 300:
return False
signed = parts["t"].encode() + b"." + raw_body
expected = hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, parts["v1"])Retries and duplicates
- Answer with any 2xx within 10 seconds. Redirects aren't followed: point the webhook at the final URL.
- Timeouts,
429and5xxanswers are retried twice (after 1 and 3 seconds). Other4xxanswers are not retried. - A retry carries the same
id, so store the ids you've handled and skip repeats. - The send log on the cohort and on Destinations shows each send: delivered, partly delivered (with the error), failed or stopped.
Consent and privacy
People whose latest recorded choice was no marketing (from your consent banner, or the browser's Global Privacy Control) are left out of every send, and the send screen says how many. People only seen through server events, with no recorded choice, are included: send only those you're allowed to contact. Deleted people are never sent.