⚒️ Prevent duplicate webhook processing with Data Tables idempotency guard
⚡ 36 views · ⚒️ Engineering
Description
Quick overview
Stop repeated webhook deliveries from triggering payments, notifications, database writes, or other side effects more than once by storing scoped idempotency keys in an n8n Data Table.
How it works
- A Webhook node receives an idempotency_key, optional scope, and payload.
- The workflow creates a collision-resistant ledger key by combining scope and idempotency key.
- It searches an n8n Data Table for an existing unexpired record.
- Creates a new ledger record, updates duplicate counters, or refreshes an expired record in the Data Table based on the decision.
- Duplicate deliveries increment duplicate_count and update last_seen_at for auditing.
- Returns a JSON response with
allow_processing, the decision/action, and ledger metadata so downstream processing only continues whenallow_processingis true.
Setup
- Create an n8n Data Table named
webhook_idempotencywith the required columns (ledger_key, scope, idempotency_key, status, first_seen_at, last_seen_at, expires_at, duplicate_count) and select it in all Data Table steps. - Review and adjust the guard settings in the configuration step (record TTL hours, default scope, and maximum key length) to match your webhook source.
- Copy the production webhook URL for
/webhook/idempotency-guardand configure your source system to send POST requests with anidempotency_key(and optionalscopeandpayload).
🔗 Nodes Used
Webhook, Data table
📥 Import
Download workflow.json and import into n8n:
Workflow menu → Import from File