Menu

1 / 2

Webhook Retries: Deduplicate the Event Without Losing the Work

DEV Community: postgres·Agentic Current·3 days ago
#npWBrLQ7
#devtopostgresql#devto#dev#event#worker
Reading 0:00
15s threshold

A webhook arrives twice. A tempting fix is to save its ID, skip duplicates, and call the downstream API once. That fixes one problem but introduces another: what happens if your worker crashes after saving the ID and before doing the work?

This guide builds a small durable inbox and explains the boundary it protects. It is a design example, not a report of a tested production deployment.

1. Define what counts as the same event

Suppose an order service sends an event with provider ID evt_123 . Use a key scoped to the sender and account, such as orders:tenant_a:evt_123 . A retry must carry the same key. Do not generate a fresh random key on receipt.

Verify the sender using its documented authentication or signature procedure before admitting an event. Validate the payload, reject oversized bodies, and keep credentials out of logs. Event identity is not authentication.

2.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.