Webhooks and Event Delivery
Core Concepts (5)
- 1.Webhooks invert the call: the provider pushes to the consumer
- 2.Delivery is at-least-once, so receivers must deduplicate
- 3.Signatures prove the sender and protect against tampering
- 4.Slow or failing receivers need retries and a dead letter path
- 5.Events should carry an identifier, a type, and a version
Map to Your Experience
Have you received an automated notification twice, or not at all? What do you think happened behind the scenes?
Design Brief: Design a Webhook Platform
Learn
Polling wastes effort: most checks find nothing new. A webhook flips the model so that the provider sends an HTTP request to a consumer-supplied address when something happens. It reduces latency and load, but it moves responsibility onto the provider, who now must deliver reliably to endpoints they do not control.
Start with the envelope. Every event should carry a unique identifier, a type name, a timestamp, a schema version, and the data. The identifier lets receivers deduplicate, the type lets them route, and the version lets you evolve the payload. Decide whether to send the full resource or only a reference. Full payloads are convenient but can become stale and expose data, while references force a follow-up call that returns current state.
Delivery will be at-least-once. Receivers may be down, slow, or return errors, so the provider retries with exponential backoff over hours or days, then parks the event in a dead letter store and alerts the consumer. Receivers must treat duplicates and out-of-order arrival as normal, which means acting idempotently and checking timestamps or sequence numbers.
Security is not optional. Sign each delivery with a shared secret using an HMAC over the body and a timestamp, and reject old timestamps to prevent replay. Publish how to verify, and support secret rotation with an overlap period. Deliver only over encrypted connections and consider allowing consumers to restrict source addresses.
Finally, build the consumer experience. Offer a dashboard showing recent deliveries with status codes, a button to resend an event, and a test event sender. Most webhook support tickets disappear once consumers can see and replay their own failures.
Map
Pick a service that notifies you by webhook, such as a payment or code host. List the events it sends, what you would do if one arrived twice, and what you would do if it arrived an hour late.
Design
Specify the webhook platform: the event envelope with an example, the retry schedule, the dead letter handling, and the signature scheme including rotation. Describe which delivery tools you would give consumers. Keep your answer concrete: name real numbers, owners, and examples wherever you can, and note any assumption you had to make so a reviewer can challenge it.
Requirements
- •Define the event envelope
- •Describe retry and failure handling
- •Specify how receivers verify authenticity
Constraints
- •Receivers are of mixed quality
- •Must not block the core invoicing path
Must Cover
Trade-off Axis
delivery guarantees vs provider cost
Referenced Patterns
Competencies Advanced
Ready to Design?
Open this day in the Design Studio. The studio follows this track: its days, concepts, patterns and trade-offs are loaded, and you keep one design across the whole track.
Open in Studio →