Skip to content

Webhook Delivery System Design: Retries, Signatures and Ordering

Design a webhook sender that survives slow endpoints, duplicate deliveries and outages, with signed payloads, bounded retries and an architecture diagram.

· Founder & developer

Published

Left-to-right webhook pipeline from App through Outbox, Event bus, Dispatcher and Delivery workers to Customer endpoints. A Vault supplies signing secrets; Retry queue, Dead-letter queue and Delivery log sit below.

A customer endpoint accepts your order notification, updates its database, and loses the connection before your worker receives the response. Your worker cannot tell whether the notification failed or succeeded. Retrying can create a duplicate; not retrying can lose an event.

Webhook delivery system design starts with that uncertainty. You need durable events, a delivery record per destination, bounded retries, signatures, and receivers that tolerate duplicates. This guide follows one event from a database transaction to an external HTTPS endpoint, then explains the failure paths you should draw beside it.

Separate events from delivery attempts

An event describes something that happened. A delivery connects that event to a subscribed endpoint. An attempt records one HTTP request for that delivery. Keep their identifiers separate: one event can produce several deliveries, and each delivery can have several attempts.

Write the business change and an outbox row in the same database transaction. A relay publishes committed rows into an event queue. The transactional outbox pattern explains why saving a row and publishing directly to a broker are otherwise two independent failure points.

The dispatcher resolves subscriptions and creates durable delivery records, one per subscribed endpoint, so it fans out like a pub/sub topic rather than a work queue. Enforce a uniqueness constraint on the event and destination pair. Workers claim due deliveries with a lease, send the request, and record the result before releasing that lease. After a worker crash, an expired lease permits another worker to continue.

Record Stable identity Changes between attempts
Event Event ID Nothing in the original payload
Delivery Event ID and endpoint ID State, next attempt time
Attempt Attempt ID Timestamp, response, duration, error

Store the endpoint configuration version used for each attempt. Otherwise a customer changing its URL during a retry can make the audit trail misleading. Keep payload retention and access controls deliberate, because a delivery log can contain customer data.

Retries are a policy, not a loop

Treat delivery as at least once. A timeout means the outcome is unknown, and a successful HTTP response is evidence of acceptance, not evidence that every downstream business action completed. A receiver should durably accept the event before acknowledging it.

Retry transient connection failures, timeouts and suitable server errors. Treat rate limiting separately and honor a valid retry delay within your own retry horizon. Persistent authentication or endpoint configuration errors need customer attention, rather than an endless stream of requests.

The following is an illustrative policy for your own service, not a provider default. Apply jitter so a large outage does not schedule every customer for the same instant.

Outcome Example action Reason
Successful 2xx response Mark delivery accepted Stop automatic attempts
Connection failure or timeout Retry after 1 minute, then 5 minutes The receiver may be temporarily unavailable
Repeated transient failures Increase delay, capped at 1 hour Reduce pressure during an outage
Retry horizon reaches 24 hours Move to the failure queue Give operators a bounded recovery workflow
Invalid URL or persistent authorization error Pause and notify the owner Repeating unchanged input will not repair it

Use a job scheduler or a queue with delayed delivery; do not hold a worker asleep until the next attempt. The notification system design article covers a related separation between notification intent and delivery channels.

Track the oldest due delivery, not just queue depth. A queue can look small while one important event has been stuck for hours. Provide a manual redelivery action that preserves the event ID and creates a new attempt record.

Sign the exact bytes you send

HTTPS protects the transport. A webhook signature lets the receiver authenticate the sender and detect a changed payload. Use a maintained verification library and a documented signing convention instead of inventing cryptographic parsing rules.

The Standard Webhooks specification signs the message identifier, attempt timestamp and body together. Its symmetric scheme uses HMAC-SHA256. Conceptually, the signed input is:

event_id + "." + attempt_timestamp + "." + raw_body

The receiver verifies the raw request body before parsing or reserializing JSON, compares signatures with a constant-time function, and rejects timestamps outside its allowed window. The event ID stays stable across retries; the attempt timestamp changes. These fields serve different purposes: deduplication and replay protection.

Keep secrets per endpoint in a secret manager. Support rotation with a documented overlap period, then retire the old secret. Never put credentials in destination URLs or delivery logs. The diagram shows a Vault feeding the workers, rather than the application database handing secrets to every component.

Make the receiver fast and idempotent

Verify the signature, validate the event type, store a durable receipt, and acknowledge quickly. Process the business work asynchronously after that receipt. GitHub's webhook guidance requires a 2xx response within 10 seconds and recommends asynchronous processing; other providers have their own deadlines.

Deduplicate using a stable event identifier scoped to the provider and destination. Put the processed-event record and local side effect in one transaction where possible. If the side effect is an external API call, carry an idempotency key into that API or model a recoverable state machine. A unique receipt row alone does not make an external payment or email atomic.

Do not promise event ordering unless you implement and operate it. Retries and parallel workers can deliver an older event after a newer one. Stripe documents this explicitly: consumers must not depend on delivery order and can retrieve current objects through the API.

Include event time for context, but do not use a timestamp alone as a deduplication key or total order. For state synchronization, fetch the current resource or apply a documented resource version. For a true event history, use a separate sequence and gap-recovery contract.

Isolate destinations and constrain outbound requests

Give each endpoint a concurrency budget so one slow customer cannot occupy every worker. A fair dispatcher can partition work by endpoint without creating a physical broker queue for every URL. Use rate limiting and circuit breakers to bound pressure, while keeping durable deliveries available for recovery.

A customer-supplied URL is also an outbound network permission. Follow the OWASP SSRF prevention guidance: validate destinations and enforce the policy at connection time. Reject internal, loopback and link-local targets, including IPv6 equivalents, and apply the same checks to every redirect or disable redirects.

DNS can change between validation and connection. Connect only to a validated address while preserving hostname verification, and restrict worker egress as another layer. Bound connection time, total request time, request size and response size. Do not let a delivery worker become a general-purpose internal network client.

The webhook delivery diagram

Left-to-right webhook pipeline from App through Outbox, Event bus, Dispatcher and Delivery workers to Customer endpoints. A Vault supplies signing secrets; Retry queue, Dead-letter queue and Delivery log sit below.

12 components · 10 connections

Open in Archboard
Diagram contents
  • App
  • Outbox
  • Event bus
  • Dispatcher
  • Delivery workers
  • Customer endpoints
  • Vault
  • Retry queue
  • Dead-letter queue
  • Delivery log
  • commit
  • relay
  • event
  • job
  • HTTPS
  • signing secret
  • attempt result
  • retryable
  • due retry
  • expired
A committed event moves through an outbox, event queue and dispatcher to delivery workers. Separate retry, failure and audit paths keep one unavailable endpoint from blocking the others.

How to read it:

  • The main row carries an event from App to Customer endpoints through durable handoffs.
  • Outbox represents the record committed with the business change; the relay is named on its outgoing edge.
  • Retry queue returns due work to Dispatcher, while exhausted deliveries enter Dead-letter queue.
  • Delivery log records attempts independently from the event payload, and Vault supplies signing material.

Drawing webhook systems clearly

Label the happy path with the artifact being transferred: committed event, delivery job, signed HTTP request. A generic arrow marked data hides the point where a durable event becomes a network attempt.

Keep retry and audit paths below the main flow. Distinguish a failed attempt from a permanently failed delivery, and annotate whether a worker is holding a lease or waiting on a remote response. The broader event-driven architecture guide provides context for the internal event bus.

Build it in Archboard

  1. Sign in with Google or GitHub and create a diagram.
  2. Add Container nodes for App, Dispatcher and Delivery workers from the C4 Model pack, plus an External System named Customer endpoints.
  3. Add Database nodes for Outbox and Delivery log, and Queue nodes from the Data pack for Event bus, Retry queue and Dead-letter queue.
  4. Place a Vault from the Security pack above the workers. Use dashed edges for retry and secret retrieval paths.
  5. Add a Markdown block from the Core pack with the example retry horizon, stable event ID and fresh attempt timestamp. Keep secrets out of the diagram.

The example uses 11 diagram nodes, within the Free plan.

FAQ

How do you make webhook delivery reliable? Persist the event and delivery intent, retry uncertain attempts within a defined horizon, isolate destinations, and make receivers idempotent.

Can webhooks guarantee exactly-once processing? HTTP delivery alone cannot. The receiver must coordinate deduplication with its side effects, including any external calls.

Should a webhook receiver return 200 before processing? Return success after durable acceptance, then process asynchronously. Acknowledging before persistence can lose the event.

How are webhook signatures different from HTTPS? HTTPS secures the connection. A signature authenticates the payload and signed metadata using the provider's documented convention.

Do webhook events arrive in order? Not necessarily. Parallelism and retries can reorder attempts, so consumers need a state-version or reconciliation strategy.

Start free — one seat, no credit card.

Related posts

← Back to blog

Open a canvas in a minute

Sign in with Google or GitHub. Free for a single seat. Upgrade when the team joins.