Webhook Idempotency Spec Generator
Plan duplicate protection, retry schedules, alerts and safe replay for your webhook. Export the engineering spec as Markdown or HTML.

Document preview
Engineering spec: 6 sections (Trigger source: Store order · Runtime: n8n · Deduplication store: Postgres unique key · Event ordering: Out of order is allowed · Retry policy: Exponential, 5 retries · Alert channel: Slack or Teams)
Engineering spec: 6 sections
Architecture and scope
Trigger source: Store order · Runtime: n8n · Deduplication store: Postgres unique key · Event ordering: Out of order is allowed · Retry policy: Exponential, 5 retries · Alert channel: Slack or Teams
Verify the provider signature and account before enqueueing. Acknowledge only after durable intake; claim the key in the selected runtime before side effects.
Accept events out of order. Apply only newer versions, or fetch the current source record before writing when no version exists.
Idempotency key and retention
sha256(JSON.stringify([provider, tenant_id, event_id, order_id]))
Use stable provider IDs, never delivery timestamps. Track outcomes per destination step; if the same key arrives with a different payload hash, quarantine it.
Use UNIQUE (tenant_id, dedup_key). Claim with INSERT ... ON CONFLICT DO NOTHING. Keep completed keys for at least 30 days and never purge in-flight claims.
Verify the provider replay window and target retention before setting production TTLs.
Retry and backoff schedule
For 429 honor Retry-After within the retry window; reconcile uncertain writes before repeating them.
| Attempt | Delay | Retryable | Send to DLQ |
|---|---|---|---|
| 1 | 0 s | 408, 429, 5xx | Other 4xx or invalid data |
| 2 | 5 s | 408, 429, 5xx | Other 4xx or invalid data |
| 3 | 10 s | 408, 429, 5xx | Other 4xx or invalid data |
| 4 | 20 s | 408, 429, 5xx | Other 4xx or invalid data |
| 5 | 40 s | 408, 429, 5xx | Other 4xx or invalid data |
| 6 | 80 s | None after this attempt | All remaining failures |
DLQ and safe replay
- Store event ID, key, payload reference, failed step, attempts, timestamps and redacted reason. Limit access and retention.
- Fix the cause, check the target for prior writes, then replay one event with the original key from the first unfinished step. Verify the outcome before replaying a batch.
Observability and alerts
Route DLQ entries and queue age above 5 minutes to Slack or Teams. Assign a named responder; count accepted, deduplicated, retried and failed events. Correlate by event ID without logging raw payloads.
Pre-launch tests
- Send the same event twice concurrently. Expect one write and one duplicate result.
- Deliver update #3 before #2 and verify the configured ordering policy.
- Interrupt after the first destination write. Replay from the DLQ and verify that the first write is preserved and later steps finish once.
Reviewed specialists
Browse source-backed specialists alphabeticallyHow the estimate works
The generator pairs a deterministic event key with a storage contract, a bounded retry schedule and tests for duplicates and partial failures. Verify provider-specific replay and retention windows before implementation.
Frequently asked questions
What does an idempotency key prevent?
It identifies repeated delivery of the same event so retries can reuse the recorded outcome and avoid repeating destination actions.
When should an event enter the dead-letter queue?
Move permanent failures to the queue immediately and move transient failures there when the retry limit is reached. Review the cause and any prior writes before replay.


