Claude Templates / B-tier · Situational
Infrastructure
The Webhook Receiver Playbook
Receiving third-party webhooks (and sending your own) without losing events.
WEBHOOK-RECEIVER-PLAYBOOK.md · 6 sections · 1,658 words · 13 KB · markdown
By Moe Ameen, founder of BILT · Published · Updated
The Webhook Receiver Playbook covers both directions of webhooks. For inbound providers like Stripe, Postmark and GoHighLevel, Claude Code builds verified routes, a webhook_events table for idempotency and a webhook_failures dead-letter table. For outbound webhooks to customer URLs, it builds a publisher with HMAC signing, SSRF guards and retries, plus a versioned, frozen payload contract.
Key takeaways
- Inbound: verify the signature, dedupe the event, process.
- Failed events land in a dead-letter table for review.
- Outbound: HMAC-signed, SSRF-guarded, retried with backoff.
- Payloads are versioned and frozen once published.
Signature verification, an idempotency table, fast-ack-then-process, and retry with backoff. Covers both directions: webhooks you receive from providers and webhooks you push to your customers' endpoints.
What does the Webhook Receiver Playbook build?
It builds /api/<provider>/webhook routes with verified auth, idempotency and dead-letter tables, and an outbound publisher for events your customers subscribe to.
At about 1,650 words, it is one of the shorter files in the library.
When do you need it?
Use it as needed: the first time a provider sends you events or a customer asks for webhooks.
If Stripe is your only webhook, the Stripe Billing playbook already covers its handler.
What do you need first?
You need App Infrastructure, a list of inbound providers and outbound event types, and somewhere to store per-destination secrets.
A worker queue such as Trigger.dev helps for slow side effects.
What's inside
What does the playbook give you?
- //Signature verification per provider
- //An event-dedupe table and the fast-ack pattern
- //Retry with exponential backoff and a dead-letter path
- //Outbound webhook delivery with per-customer secrets
- //A dead-letter table for events that fail processing
When to use it
As needed.
Build these first
Straight from the file
What does the writing look like?
Covers: HMAC signing, SSRF guards, retry with backoff, contract versioning, idempotency, signature verification, dead-letter queues.
Table of contents
Which sections does the file cover?
- 0. Use this spec
- 1. Two flows, one mental model
- 2. Inbound webhooks
- 3. Outbound webhooks
- 4. Common pitfalls
- 5. Kickoff prompt
How do you run it?
Drop WEBHOOK-RECEIVER-PLAYBOOK.md into your repo, then tell Claude Code: “Read WEBHOOK-RECEIVER-PLAYBOOK.md and implement it in this codebase.” It's written for an agent to execute end to end. Search the file for angle-bracket placeholders and swap in your own project names, domains, and keys before the first run.
Who is this for, and who should skip it?
Best for
- Apps receiving events from several providers
- Products offering webhooks to customers
- Teams that have lost events to retries or timeouts
Not ideal for
- Apps with a single Stripe webhook (Stripe Billing covers it)
- Teams using a hosted webhook gateway
- Products with no external integrations
- Builders who won't adapt paths: the file points to a reference app you won't have
What else do people ask?
What does the Webhook Receiver Playbook ask for?
The Webhook Receiver Playbook asks which providers send you webhooks, which customer URLs or event types you send to, whether you have Trigger.dev or another queue, and where you keep per-destination secrets. The kickoff prompt pauses for review after the proxy.ts allowlist and the first inbound route.
Do I need Trigger.dev?
No, but the Webhook Receiver Playbook asks whether you have Trigger.dev, another queue or none, and that answer decides sync versus async handling. It recommends pushing long side effects to a worker, since Stripe retries webhooks that take over 10 seconds and Postmark retries any non-2xx response.
What timeout and retry schedule does it use for outbound webhooks?
The Webhook Receiver Playbook gives each attempt a 30-second timeout and retries 3 times with 1s, 5s and 30s backoff. After the last failure the delivery goes into the webhook_failures dead-letter table.
What is in the Webhook Receiver Playbook download?
The Webhook Receiver Playbook is a markdown file of about 1,700 words. It has TypeScript for three inbound auth patterns (Stripe signature, HTTP Basic, custom HMAC), the idempotency check, outbound HMAC signing and the timeout wrapper, one SQL block for the outbound_destinations, webhook_events and webhook_failures tables, an SSRF block list and the outbound header set.
Why does my new webhook route return 401 before the signature check runs?
The Webhook Receiver Playbook says every inbound webhook route has to be added to PUBLIC_API_PREFIXES in src/proxy.ts. Otherwise the default-deny rule for /api/* rejects it at the edge before your handler runs, so the provider sees a 401 and nothing is logged on your side.
How do we know this?
This page is based on the playbook file itself, WEBHOOK-RECEIVER-PLAYBOOK.md, which Moe Ameen wrote from the Kompozy codebase (called BKE in the file). We read the file on November 4, 2026; the facts here come from it, not from independent testing in other codebases.
More infrastructure playbooks
Email Infrastructure
Postmark, the SPF/DKIM/DMARC recipe, drip campaigns, and transactional vs marketing routing.
Read + download →A-tierTrigger.dev Workers
The three-file pattern for anything that can't finish inside an HTTP request.
Read + download →B-tierScheduler Engine
One queue for every future-dated action: drips, reminders, scheduled sends.
Read + download →