Idempotency and Retry-safe Processing
Webhook delivery is at-least-once. Duplicates are a normal condition.Idempotency key
Usewebhook-id as your dedupe key.
Minimal idempotency table
webhook_id(unique)event_typereceived_atprocessing_statuslast_error(optional)
Processing algorithm
- Verify signature.
- Start transaction.
- Insert idempotency key if missing.
- If key already exists and processed, return 200.
- Perform side-effect safely.
- Mark processed and commit.
Replay-safe behavior
When operators replay windows, dedupe should prevent double side-effects while still returning success for already applied events.Failure taxonomy
- Transient: timeout, upstream unavailable -> retryable.
- Permanent: validation fail, unknown entity -> non-retryable or dead-letter path.
API contract examples
1) Signature verification input
Use this canonical message format for verification:2) Event envelope consumed by receivers
3) API spec to validate payload and replay behavior
Usedocumentation/api-specs/backend-api/webhooks-openapi.yaml for:
- Delivery history endpoints
- Replay task endpoints
- Analytics and timeseries endpoints
Go-live checklist
- Raw-body signature verification passes integration tests.
- Idempotency guard keyed by
webhook-idis deployed. - Queue-first processing path is in place.
- Replay runbook tested on staging data.
- Alerting for receiver failures and backlog is active.
