Book a Free Consultation →
Integrations · How-To Guide

How to Design a Webhook Retry Strategy That Does Not Duplicate Records.

Retries are necessary and dangerous. The fix is to separate acknowledgement from processing and make every handler idempotent.

By BotDevelopment Engineering Team Advanced 7 min read Updated November 2026

Webhook providers retry when they do not receive a fast success response. If your handler does the real work before replying, a slow database or a third-party timeout triggers duplicates. A reliable design acknowledges immediately and processes separately.

What You’ll Walk Away With

A webhook endpoint that responds quickly, processes events through a queue, survives retries without duplicate records, and surfaces failures for replay.

Step-by-step

  1. Verify the signature before anything else

    Validate the provider’s signing secret and timestamp before accepting the event. Reject unsigned or stale requests. This protects the endpoint from forged events and makes the rest of the pipeline trustworthy.

    Tip: Use a constant-time comparison for signatures and allow a small clock skew.

  2. Acknowledge in milliseconds

    Return a 2xx as soon as the event is authenticated and durably queued. Do not call downstream APIs in the request path. A fast acknowledgement stops the provider from retrying while your real processing continues.

    Tip: If the queue is unavailable, return a 5xx so the provider retries later instead of dropping the event.

  3. Deduplicate on the provider event ID

    Store the provider’s event ID with a unique constraint. If the same event arrives twice, mark it as a duplicate and skip processing. Do not rely on payload equality; providers may resend an identical body legitimately.

    Tip: Keep deduplication records long enough to cover the provider’s retry window, usually several days.

  4. Make the handler idempotent too

    Even with event deduplication, a job can fail after a partial write and retry. Use an idempotency key on downstream writes, or check for an existing record before creating one. Design each handler so running it twice produces the same end state.

    Tip: Test by deliberately running the same job twice and comparing the destination records.

  5. Back off instead of hammering

    For retryable failures such as timeouts or rate limits, retry with exponential backoff and jitter. Set a maximum attempt count. Do not retry validation errors; send those to a review queue immediately.

    Tip: Respect the downstream Retry-After header when it is present.

  6. Use a dead-letter queue

    After the maximum attempts, move the event to a dead-letter queue with the error, payload, and attempt history. Alert someone. A dead-letter queue turns silent loss into a visible, replayable work item.

    Tip: Build a small replay tool before you need it. During an incident is the wrong time to write one.

  7. Monitor volume, lag, and failures

    Track events received, processed, duplicated, failed, and dead-lettered. Watch queue lag, not just error count. A backlog with no errors is still an outage waiting to happen.

    Tip: Alert on the absence of events during expected busy periods as well as on failures.

Common questions

Can we just retry the whole webhook on failure?

Only if the handler is idempotent. Otherwise a partial success followed by a retry can create duplicates or double-charge a customer.

How long should we keep event IDs?

At least as long as the provider’s maximum retry window. Keeping them longer is cheap and safer.

What should trigger an alert?

Dead-letter events, sustained queue lag, signature failures, and a sudden drop in expected event volume.

Keep Reading

More guides from the same library.

Ready to Automate Your Business?

Tell us about your operations. We will help identify practical automation opportunities and recommend the right approach for your business.

Book a Free Consultation →