Receive
Accept the webhook and preserve the provider context, timestamps and identifiers needed to reason about the event.
D2 Automation Knowledge · Event safety
Assume the same logical event can arrive more than once. Reliable webhook processing protects the business action with stable identity, durable state and replay-safe side effects — not with the hope that the transport delivers exactly once.
Direct answer
Define the logical business event you need to protect, derive a stable event or business key, persist claim or processed state durably, make repeat-sensitive side effects conditional, reconcile ambiguous outcomes before retrying, and force both automatic retries and manual replay through the same duplicate controls.
Idempotency model
The key idea is that duplicate safety belongs to the business transition and side effect. Workflow executions and HTTP requests are implementation details around that boundary.
Accept the webhook and preserve the provider context, timestamps and identifiers needed to reason about the event.
Derive the logical business event key that represents the transition or side effect you need to protect.
Persist a durable claim, unique key or state transition before repeat-sensitive work begins.
Check payload structure, supported state and any preconditions before external side effects are attempted.
Perform downstream writes conditionally, using provider idempotency keys, upserts or unique constraints where appropriate.
Store confirmed, failed or uncertain result state with enough context to distinguish what definitely happened from what may have happened.
Retry or replay through the same identity and duplicate controls instead of creating a privileged recovery path.
Confirm the authoritative business outcome, not merely that the replayed workflow execution turned green.
Identity hierarchy
One HTTP delivery attempt. Useful for tracing transport, but not always sufficient to represent the logical business event.
request ID · delivery timestamp · attempt
The durable identity of the transition whose effect should happen once, such as order paid, refund confirmed or lead created.
provider event ID · business key · transition
A durable record proving the system has claimed, completed or classified the event so restarts and parallel workers do not depend on memory.
unique key · claimed · completed · uncertain
The business action that must not repeat: CRM create, notification, order mutation, payment action, inventory update or another external write.
destination key · upsert · idempotency key
When the caller cannot prove whether a write completed, preserve uncertainty explicitly and reconcile before repetition.
timeout · unknown outcome · reconcile
Retries and operator replay use the same identity, validation and side-effect controls as live traffic.
retry · replay · verify
Choosing the key
Best when the provider documents it as stable and unique for the logical event you are protecting.
Useful when the protected action is tied to one business-state change such as paid → fulfilled or refund requested → approved.
Use a destination-side unique key or upsert when the business entity itself should exist once regardless of repeated delivery.
Use when an external API supports idempotency for repeat-sensitive writes and the key semantics match your business action.
Fallback when no stable event ID exists; construct from authoritative fields and document collision and ordering assumptions.
Side-effect protection matrix
Ambiguous outcomes
Do not infer failure. Query the destination by stable business or idempotency key before issuing the write again.
On restart, inspect durable side-effect state or authoritative destination state before repeating downstream work.
Use a durable claim or uniqueness boundary so the second execution observes in-progress or completed state instead of racing the first.
Run replay through the same identity and duplicate controls, then verify the final authoritative business state.
Common anti-patterns
Each retry can have a new execution ID, so workflow uniqueness does not equal business-event uniqueness.
Restart, failover or parallel workers can forget or disagree about what has already been processed.
A unique webhook execution can still repeat an outbound API call after an ambiguous timeout.
Payload metadata or ordering can change between deliveries even when the business transition is the same.
Recovery becomes an alternate path that can repeat the very side effects idempotency was designed to protect.
A successful workflow run does not prove that the business side effect occurred once and only once.
Production checklist
Name the protected business event and side effect before choosing an idempotency key.
Confirm whether the provider event ID represents the logical event or only one delivery attempt.
Persist claim or processed state in a durable store when duplicate safety matters across restarts or workers.
Use destination uniqueness, upsert or provider idempotency controls where they accurately represent the business rule.
Make duplicate-sensitive side effects conditional on durable state, not only workflow execution history.
Represent in-progress, completed, failed and uncertain states when concurrent delivery or ambiguous outcomes are possible.
Reconcile timeout outcomes before repeating irreversible or externally visible writes.
Ensure retries and manual replay pass through the same validation and idempotency controls as live delivery.
Keep correlation IDs, attempts and side-effect evidence so operators can explain why an event was skipped or replayed.
Test duplicate delivery, concurrent delivery, crash-after-side-effect and operator replay scenarios before treating the workflow as production-ready.
Related architecture
Design retry and replay paths around failure semantics without bypassing duplicate protection.
Read moreHandle timeout ambiguity, retries, API idempotency and integration recovery as one production contract.
Read moreSee durable event identity, state and recovery principles applied to event-driven customer operations.
Read moreFAQ
Webhook idempotency means the same logical business event can be delivered or processed more than once without repeating a protected side effect. The workflow derives a stable event or business key, stores durable claim or processed state, makes downstream writes conditional and treats replay as normal recovery rather than a special bypass path.
A delivery ID often identifies one transport attempt, while the business event may be represented by multiple deliveries or retries. The idempotency key should represent the business transition whose side effect must happen once, such as order ID plus status transition or a provider event ID that is documented as stable for that logical event.
Not for durable guarantees. Process memory can disappear on restart and is not shared reliably across scaled workers. Important claim or processed state belongs in a durable store, uniqueness-enforcing destination or authoritative system that survives retries and process replacement.
Build a deterministic business key from the fields that define the protected transition, then document collision, ordering and replay assumptions. The key must represent the action you are preventing from happening twice, not merely the request body as received.
A timeout only proves the caller did not receive a usable response. Before retrying a duplicate-sensitive write, query the destination by idempotency or business key, inspect authoritative state, or otherwise reconcile whether the side effect already happened.
No. Replay should pass through the same validation, idempotency and side-effect protection as live delivery. A recovery tool that bypasses duplicate controls creates a second path capable of repeating irreversible business actions.
Need duplicate-safe event processing?
Authorship & accountability
D2 AI & Automation TeamProduction automation, APIs, data pipelines and AI-assisted systems
D2 keeps claims, assumptions and evidence separate. Citations are attached only when a relevant source or evidence asset is available; unresolved material is not automatically presented as a verified fact.
Review D2's evidence methodology →