Webhooks
Webhooks deliver the event catalogue to HTTPS endpoints you register in the portal (Developers, Webhooks) or through the API (up to 20 per organisation, each with its own secret shown once).
Endpoints
POST /v1/webhooks with the URL, the subscription and optional filters:
{
"url": "https://example.com/postbuddy",
"description": "CRM sync",
"events": ["item.*", "postbatch.completed"],
"filters": { "isTest": false },
"bulkDelivery": "chunk"
}The subscription names event types, families (item.*) or everything (*); filters narrow deliveries to a Postflow, a Postbatch or to live or test items. The response carries secret once. GET /v1/webhooks/{id}/deliveries lists the delivery log with the attempt history and the payload; POST /v1/webhooks/{id}/deliveries/{deliveryId}/replay sends an event again; POST /v1/webhooks/{id}/test sends a webhook.test envelope. A disabled endpoint is re-enabled with PATCH {"active": true}; POST /v1/webhooks/{id}/replay-missed then delivers the subscribed events of the disabled period.
Bulk work: one event per chunk
Work that changes many cards at once sends one list event per chunk of up to 1,000 cards: a Postflow batch or file, a Postbatch and its approval, the release of held cards to the next run, the cutoff, the steps of a production run (handed to the printer, offered to the carrier, completed) and the cards of a cancelled run going back. The list event has the plural type of the card event (items.created, items.ready, items.scheduled, items.in_production, items.handed_to_carrier, items.completed and the others in the catalogue) and carries the cards in data.items, each exactly the item its card event would carry (id, externalId, status, postflowId, postbatchId, isTest, integrationInstallationId, and the design version, run or batch where the card event names one), never personal data, with their number in data.count:
{ "id": "evt_01J…", "type": "items.ready", "version": 1, "createdAt": "…", "organisationId": "org_…", "isTest": false, "data": { "items": [{ "id": "itm_…", "status": "READY", "externalId": "crm-1001", "postflowId": "pf_…" }], "count": 1 } }A change to one card (a single create, a repair, a cancel, an approval of one card, a scan) sends the card event as before. One list event holds the cards of one organisation and one mode, so isTest holds for all of them. A subscription to a card event covers its list form: an endpoint on item.ready or item.* receives items.ready; a subscription to items.ready alone receives bulk work only, not the card event of a single change. An endpoint's filters apply per card: an endpoint filtered on a Postflow receives the list event with that Postflow's cards only (the same event id with fewer cards), and none when no card of the chunk passes.
bulkDelivery chooses how an endpoint receives bulk work: chunk (the default, also for endpoints made before) delivers the list event; per_card delivers every card of it as its own card event, the same envelope a single change sends. Those card events have an id fixed by the list event and the card, so a dispatch or a replay never makes a card's event twice; they are not in GET /v1/events, which shows the list event. Switch it in the portal (the endpoint's deliveries, Per card for bulk work too) or with PATCH /v1/webhooks/{id} {"bulkDelivery": "per_card"}. A receiver that handles both forms reads the cards with webhookItems(event) (webhook_items(event) in Python).
Events of a part of PostBuddy your plan does not include cannot be subscribed to (422 with the code feature_not_entitled): postbatch.* and import.* need Postbatches, postflow.updated and ingestion.completed Postflows, item.in_flow, item.disqualified, item.control_group (and their list forms), postflow.flow_published and postflow.split_winner the journey builder, qr.scanned QR tracking, run.* the run schedule and experience.* Experiences. An endpoint keeps such a subscription when the part is switched off, also when you change its events, but those events are not delivered until the part is switched on again.
Event feed
Integrations that cannot receive webhooks poll GET /v1/events (newest first, cursor pagination, 30 days of retention, filters on type and a period). The feed uses the same envelope as the deliveries and holds the list events of bulk work as they are: ask for type=item.ready,items.ready to read both forms.
Delivery
POST https://example.com/postbuddy
X-Webhook-Id: whd_01J…
X-Webhook-Event: item.ready
X-Webhook-Timestamp: 1790000000
X-Webhook-Signature: v1=3f9a…
Content-Type: application/json
{ "id": "evt_01J…", "type": "item.ready", "version": 1, "createdAt": "…", "organisationId": "org_…", "isTest": false, "data": { "item": { "id": "itm_…", "status": "READY" } } }Answer any 2xx within 10 seconds. Failed deliveries are retried with exponential backoff over 24 hours (1 min, 5 min, 30 min, 2 h, 6 h, 12 h, 24 h); after ten consecutive exhausted events the endpoint is disabled and Developers are notified. A list event is one delivery with one answer: a failure retries the whole list.
Verify the signature
The signature is v1= plus the hex HMAC-SHA256 of timestamp + "." + rawBody with the endpoint secret; reject timestamps older than five minutes. Always verify on the raw body, before parsing.
import { verifyWebhookSignature } from '@postbuddy/sdk/webhooks';
app.post('/postbuddy', express.raw({ type: 'application/json' }), (req, res) => {
try {
const event = verifyWebhookSignature({
secret: process.env.WEBHOOK_SECRET!,
headers: req.headers,
rawBody: req.body,
});
handle(event);
res.sendStatus(204);
} catch {
res.sendStatus(400);
}
});from postbuddy import verify_webhook_signature, WebhookSignatureError
try:
event = verify_webhook_signature(secret, request.headers, request.get_data())
except WebhookSignatureError:
abort(400)Handlers must be idempotent: the same event id can be delivered more than once. A delivery is taken by one worker at a time and posted with the same X-Webhook-Id and event id on every attempt; a worker that stops between taking a delivery and recording its answer leaves it to be posted again about two minutes later. Store the event ids you handled (or the cards' states) and skip one you have seen.
import { verifyWebhookSignature, webhookItems } from '@postbuddy/sdk/webhooks';
const event = verifyWebhookSignature({ secret, headers: req.headers, rawBody: req.body });
for (const item of webhookItems(event)) await updateCard(item.id, item.status);