Article
Process a webhook twice without duplicating the work
A webhook delivery can repeat after a timeout. A durable receipt lets an integration acknowledge it and still finish the right job.
Model one concrete event
Imagine a scheduling app publishing a booking confirmation to a CRM. First verify the provider's signature using its documented method. Then capture the provider's event identifier, the booking identifier and the event type. These identify different things. A later cancellation concerns the same booking and should have its own event identifier.
Give the receiver a short job
Store the verified receipt and enqueue the work in a single transaction. Enforce uniqueness on the provider and event identifier. Once that transaction commits, acknowledge delivery. If the sender retries the same event, the receipt already exists and the worker can continue from its recorded state. If the worker calls a downstream service, use a stable operation key when that service supports one. A timeout can otherwise leave the outcome uncertain.
Test a duplicate and a late arrival
Deliver the confirmation twice and check that the CRM contains one booking. Deliver a cancellation, then simulate a delayed confirmation with a different event identifier. Receipt deduplication cannot determine the latest booking state. Consult a source-provided version or retrieve the current booking before applying the stale update. Keep the receipts and the final decision together so support can reconstruct the sequence from one booking reference.