Webhooks
Postbroad sends events to your HTTPS endpoint as signed JSON, following the Standard Webhooks format, so anything that has a Standard Webhooks library can verify them. This is what arrives when a post goes live:
POST /your/endpoint
content-type: application/json
user-agent: Postbroad-Webhooks/1
webhook-id: <delivery id, the same on every retry and replay>
webhook-timestamp: <unix seconds, fresh on every attempt>
webhook-signature: v1,<base64 HMAC-SHA256>[ v1,<second signature>]{
"type": "delivery.published",
"timestamp": "2026-10-25T09:00:03.120Z",
"data": {
"event_key": "...",
"aggregate_type": "delivery",
"aggregate_id": "0b7e8f8e-5a4c-4d0e-9f53-0c8f2a6d1e01",
"revision": 4
}
}type is {aggregate}.{state}, for example delivery.published, delivery.failed,
delivery.unknown, approval.requested or credential.expiring. An endpoint subscribes to exact
types, prefix.* or *, and an empty list means every event. data also carries the fields of the
changed row, so read the resource through the API when you need its full current state. New fields
can appear in data at any time; ignore the ones you do not know.
#Event types
Every type an endpoint can receive, 33 in all. Subscribe to exact types, to
delivery.* style prefixes or to *.
| Object | Event types |
|---|---|
delivery | delivery.pending, delivery.scheduled, delivery.needs_reconnect, delivery.sending, delivery.accepted, delivery.processing, delivery.published, delivery.failed, delivery.unknown, delivery.cancelled |
post | post.draft, post.in_review, post.approved, post.scheduled, post.cancelled |
approval | approval.requested, approval.approved, approval.changes_requested, approval.rejected, approval.expired, approval.voided |
credential | credential.healthy, credential.expiring, credential.broken, credential.missing_permission, credential.disconnected |
hold | hold.placed, hold.released |
exception | exception.open, exception.assigned, exception.snoozed, exception.resolved |
inbound_event | inbound_event.verified |
#Verify the signature
The secret starts with whsec_. The signed text is {webhook-id}.{webhook-timestamp}.{raw body},
the key is the base64 part of the secret decoded to bytes, and the signature is
v1, plus the base64 HMAC-SHA256. Verify against the raw bytes before parsing the JSON, compare in
constant time and reject timestamps more than five minutes from your clock.
import { createHmac, timingSafeEqual } from "node:crypto";
export function verify(secret, headers, rawBody) {
const id = headers["webhook-id"];
const ts = headers["webhook-timestamp"];
if (Math.abs(Date.now() / 1000 - Number(ts)) > 300) return false;
const key = Buffer.from(secret.replace(/^whsec_/, ""), "base64");
const expected = createHmac("sha256", key).update(`${id}.${ts}.`).update(rawBody).digest();
return headers["webhook-signature"].split(" ").some((part) => {
const [version, sig] = part.split(",");
const got = Buffer.from(sig ?? "", "base64");
return version === "v1" && got.length === expected.length && timingSafeEqual(got, expected);
});
}import base64, hashlib, hmac, time
def verify(secret: str, headers: dict, raw_body: bytes) -> bool:
msg_id, ts = headers["webhook-id"], headers["webhook-timestamp"]
if abs(time.time() - int(ts)) > 300:
return False
key = base64.b64decode(secret.removeprefix("whsec_"))
mac = hmac.new(key, f"{msg_id}.{ts}.".encode() + raw_body, hashlib.sha256).digest()
for part in headers["webhook-signature"].split(" "):
version, _, sig = part.partition(",")
if version == "v1" and hmac.compare_digest(base64.b64decode(sig), mac):
return True
return FalseThe header can hold two signatures. That happens for 24 hours after you roll a secret: both the new and the previous secret sign every attempt, so you can switch without dropping events.
#Answer fast, with a 2xx
Reply with any 2xx status within 10 seconds. Do the work afterwards (queue it) and keep the response small: only the first 256 KB of a response is read. Redirects are not followed (a 3xx counts as a failure), and addresses on private networks are refused.
#Retries and dead letters
A non-2xx answer, a timeout or a connection error schedules another attempt. There are up to 8 attempts, due at these offsets from the first one, each reduced by up to 10% jitter:
| Attempt | After the first attempt |
|---|---|
| 1 | immediately |
| 2 | 1 minute |
| 3 | 5 minutes |
| 4 | 30 minutes |
| 5 | 2 hours |
| 6 | 8 hours |
| 7 | 24 hours |
| 8 | 72 hours |
After the eighth failure the delivery becomes a dead letter. An endpoint that keeps failing is protected: after 5 failures in a row its circuit opens and probes once a minute, and after 72 hours of failures (at least 10 of them) it is disabled and its open deliveries wait. Re-enabling it sends them.
#Build an idempotent consumer
Delivery is at least once. The same event can arrive twice (a retry after a slow 2xx, a replay), so make handling safe to repeat:
- Take
webhook-idas the key. It is the same on every attempt of one delivery and on a replay. - In one transaction, insert the id into a table with a unique constraint and do the work. If the insert conflicts, you have seen it: return 2xx and do nothing.
- Do not depend on order.
data.revisiongrows with every change of the same object; ignore an event whose revision is lower than the one you stored. - Treat the event as a signal and read the current object through the API when it matters.
#Manage endpoints
Manage endpoints in the app, under Settings, then API, then Webhooks, or through the
webhook endpoints API. Every change takes an Idempotency-Key. Create
accepts an HTTPS url and an events array; an empty array subscribes to every event. The list
returns the 500 newest endpoints, and the recent activity route up to 100 recent send records.
To hear about some accounts only, send channelIds, 1 to 100 account (channel) ids of your
organization; null or no list means every account. An event about one account (a send,
delivery.*, whose data carries channel_id) then goes only to the endpoints that keep that
account. An event about no single account, such as a post or an approval, still goes to every
endpoint that wants its type.
| Action | Who may do it |
|---|---|
| Create, rotate the secret, delete | A browser session that signed in within the last 10 minutes, or an API key (personal or service) that lists the webhook.manage scope by name |
| Change, disable, re-enable, replay a dead letter | A browser session, or an API key that lists webhook.manage by name |
| Any of these | Never a key that acts for an agent, and never an MCP client |
A key without webhook.manage listed by name is refused with forbidden, even when it holds every
other permission. The signing secret starts with whsec_ and is shown once; the
endpoints reference says how to recover from a lost answer. Never place it
in source control.
#Replay and testing
- Replay. A dead letter can be replayed for 30 days. It keeps its
webhook-idand body and gets a new schedule, timestamp and signature. - Send a test event.
POST /v1/webhook-endpoints/{endpointId}/test, or Send test event in the app, queues one event of typewebhook.testfor that endpoint only. It is signed and retried like any other event and shows in the endpoint's recent activity, so you can check your handler end to end. Nothing happens to any post or account. A disabled endpoint answers409 conflict. - Test locally. Sign a sample with your secret and post it to your own handler. This is the same request Postbroad makes:
import { createHmac } from "node:crypto";
const secret = process.env.WEBHOOK_SECRET; // whsec_...
const body = JSON.stringify({
type: "delivery.published",
timestamp: new Date().toISOString(),
data: { aggregate_type: "delivery", aggregate_id: "test", revision: 1, event_key: "test" },
});
const id = "msg_test_1";
const ts = Math.floor(Date.now() / 1000);
const key = Buffer.from(secret.replace(/^whsec_/, ""), "base64");
const sig = createHmac("sha256", key).update(`${id}.${ts}.${body}`).digest("base64");
await fetch(process.argv[2], {
method: "POST",
headers: {
"content-type": "application/json",
"webhook-id": id,
"webhook-timestamp": String(ts),
"webhook-signature": `v1,${sig}`,
},
body,
});Always check the signature on the raw body before you trust a payload, including in tests.
#Versioning
Payloads follow the API's additive rule: the envelope (type, timestamp, data) and the
Standard Webhooks headers do not change within a version. See versioning.
Last generated 23 Nov 2026, from the contracts the API runs on.