Reliable webhook integrations need more than an endpoint that returns 200 OK. This checklist explains how to verify webhook signatures, tolerate retries and delays, prevent duplicate side effects with idempotency, and recover safely when delivery or processing fails.
Overview
A webhook is an inbound request that tells your application an event occurred elsewhere. The sender may deliver the same event more than once, retry after a timeout, send events out of order, or stop delivering while your service is unavailable. Your endpoint must therefore treat delivery as an unreliable transport rather than as a single guaranteed transaction.
A robust design separates four concerns:
- Authenticity: confirm that the request was created by the expected provider and was not modified.
- Acceptance: validate the request, record it durably, and acknowledge it using the HTTP behavior required by the provider.
- Processing: perform business work asynchronously where practical, with idempotency protection around side effects.
- Recovery: retain enough information to retry, replay, investigate, or quarantine a failed event.
A useful lifecycle looks like this:
Provider
|
| signed HTTP request
v
Webhook endpoint
|-- reject: invalid signature, malformed payload, stale timestamp
|
| durable event record or queue
v
Fast acknowledgement
|
v
Worker -> idempotency check -> business action -> result
| |
| +--> success record
+--> retry with backoff or dead-letter queue
The exact HTTP status codes, signature scheme, retry window, and required response time belong to the provider's contract. Treat those values as configuration that should be reviewed when an integration changes.
Checklist by scenario
When receiving a new webhook
- Create a dedicated HTTPS endpoint rather than exposing a general-purpose API route.
- Record the provider name, event type, event identifier, received time, request identifier, and processing status.
- Preserve the raw request body before parsing it if signature verification depends on the original bytes.
- Verify the signature using the provider's documented algorithm and secret-management approach.
- Validate required headers, content type, payload structure, and any timestamp included by the sender.
- Apply payload-size limits and reject unexpected methods or content types.
- Store or enqueue the event durably before acknowledging it, unless the provider's contract requires a different flow.
When the same event arrives twice
Use the provider's event ID as the first choice for deduplication. If no stable event ID exists, derive an idempotency key from documented immutable fields rather than from the arrival time or the entire request indiscriminately. Store the key with a uniqueness constraint so concurrent workers cannot both pass the check.
A generic idempotency-key implementation can follow this pattern:
key = provider_event_id
begin transaction
existing = find event where idempotency_key = key
if existing exists:
if existing.status = "completed":
return existing.result
if existing.status = "processing":
return "already accepted"
if existing.status = "failed" and retry_is_allowed(existing):
mark existing as "processing"
else:
return "quarantined"
insert event(key, payload_hash, status="processing")
commit
result = perform_business_action_safely()
update event set status="completed", result=result
The business action also needs protection. A database uniqueness constraint, an idempotent upsert, or a provider-supported idempotency key can prevent duplicate orders, messages, subscriptions, or account changes. An application-level if not exists check alone may fail under concurrency.
When delivery is delayed or temporarily rejected
Use a retry strategy that distinguishes transient failures from permanent failures. Network errors, timeouts, overloaded dependencies, and many server-side errors are usually candidates for retry. Invalid signatures, unsupported event types, malformed payloads, and authorization failures generally require investigation rather than immediate repetition.
| Strategy | Useful for | Trade-off |
|---|---|---|
| Fixed delay | Simple, predictable integrations | Can create synchronized retry bursts |
| Exponential backoff | Temporary outages and overloaded services | Needs a maximum delay and attempt limit |
| Exponential backoff with jitter | Multiple workers or high-volume senders | Less predictable timing, but reduces retry collisions |
| Manual replay | Events requiring operator review | Requires audit controls and a safe replay tool |
Do not assume that a provider retries every non-success response in the same way. Confirm its documented behavior, then test your endpoint with timeouts, connection failures, selected response codes, and delayed acknowledgements.
When processing cannot succeed
After the configured retry policy is exhausted, move the event to a dead-letter queue or quarantine store. Keep the original payload, headers needed for diagnosis, failure reason, attempt count, timestamps, and a correlation ID. Provide a controlled replay action that reuses the original event ID and therefore remains protected by idempotency.
What to double-check
Signature verification
- Read the raw body before JSON parsing, normalization, or re-serialization.
- Use constant-time comparison for calculated and received signatures where your language provides it.
- Keep signing secrets outside source code and rotate them using an overlap plan when the provider supports multiple active secrets.
- Check signed timestamps when available, using a deliberately chosen clock-skew window.
- Log verification outcomes and identifiers, but never log secrets or unrestricted sensitive payloads.
- Test altered bodies, missing signatures, wrong secrets, stale timestamps, duplicate signatures, and malformed headers.
A signature proves that a request matches a secret-based calculation; it does not prove that the requested business action is safe to repeat. Authentication and idempotency solve different problems and should be implemented separately.
Endpoint and queue behavior
Define what your endpoint considers accepted. If it writes to a durable queue or database, acknowledge after that write succeeds. If the write fails, return the response that causes the sender to retry according to its contract. Avoid acknowledging an event that exists only in process memory.
Measure more than endpoint availability. Track accepted events, signature failures, duplicate events, queue age, processing latency, retry counts, dead-letter volume, and replay outcomes. These signals distinguish a sender delivery problem from a worker or downstream dependency problem. For broader release verification, see the deployment smoke tests checklist.
Security boundaries
Limit which event types the endpoint accepts, authorize administrative replay operations, and separate webhook secrets by environment and integration where practical. Do not trust fields such as account IDs, roles, or prices merely because they appear in a signed payload; validate them against the expected integration and your own records.
Common mistakes
- Performing all work before responding: slow database calls or third-party requests can trigger sender retries and duplicate processing. Prefer durable acceptance followed by a worker when the workflow permits.
- Using only an in-memory duplicate check: it disappears on restart and does not coordinate multiple instances.
- Generating a new idempotency key on every retry: retries must map to the same logical event key.
- Retrying permanent failures: repeated malformed or unauthorized requests add noise and can hide the real configuration problem.
- Discarding failed payloads: without a dead-letter record, operators cannot determine what was lost or safely replay it.
- Logging complete requests by default: payloads may contain personal, financial, or operationally sensitive data.
- Testing only the happy path: duplicate delivery, partial writes, worker crashes, clock skew, and downstream timeouts are core integration cases.
- Changing response behavior without checking the contract: a provider may interpret status codes, redirects, response bodies, and timeout thresholds differently.
When to revisit
Review this checklist before a seasonal planning cycle, a major application release, or a change to queues, workers, authentication, or downstream systems. Revisit it whenever the webhook provider changes its event schema, signature process, retry behavior, endpoint requirements, or SDK.
Run a small provider-agnostic test set after meaningful changes:
- Send a valid signed event and confirm durable acceptance and successful processing.
- Send the exact event twice and confirm only one business side effect occurs.
- Alter one body field and confirm signature verification fails.
- Send an old or invalid timestamp, when timestamps are part of the scheme.
- Force a queue or database failure and confirm the sender receives a retryable outcome.
- Make the worker fail repeatedly and confirm the event reaches quarantine or a dead-letter queue.
- Replay the quarantined event and confirm the operation remains idempotent and auditable.
Keep the provider's current contract, environment configuration, test results, and runbook together. If webhook behavior is part of a deployment, include these checks alongside application health checks and review secret handling in your CI/CD secrets checklist. A webhook integration is ready for production when it can reject forged input, absorb duplicates, recover from temporary failure, and explain every event that did not complete.