Quick overview
This workflow receives POST webhooks, validates and normalizes the event payload, and uses an n8n Data Table to enforce idempotent processing with durable state tracking. It calls a simulated downstream API on httpbin.org with bounded retries and backoff, then returns deterministic webhook responses.
How it works
- Receives an incoming POST request via an n8n Webhook endpoint.
- Normalizes the request body, validates required fields (eventId, eventType, customerId, amount, and ISO-8601 timestamp), and returns HTTP 400 for invalid payloads.
- Checks the n8n Data Table for an existing eventId and, if found, returns a deterministic response based on the persisted status (duplicate, in-flight, terminal no-op, retryable exhausted, or resumes the next retry stage).
- If the eventId is new, writes a “received” state to the Data Table, marks the event as “processing,” and makes a downstream HTTP request to httpbin.org.
- Classifies the downstream HTTP result as success, retryable failure, or terminal failure, updates the Data Table status accordingly, and responds to the webhook with processed or failure details.
- For retryable failures, waits with bounded backoff (2 seconds then 4 seconds) and retries the downstream call up to a maximum of three attempts before persisting a final failed state and returning an error response.
Setup
- Create an n8n Data Table named “Webhook Reliability State” with columns: eventId (string, matchable), eventType (string), customerId (string), amount (number), timestamp (string), status (string), attemptCount (number), lastError (string), createdTimestamp (string), and updatedTimestamp (string).
- Confirm all Data Table steps in the workflow are configured to use the “Webhook Reliability State” table.
- Copy the Webhook URL for the “webhook-reliability” path and configure your source system to send POST requests with the expected JSON fields.
- If you replace the httpbin.org call with a real downstream API, update the HTTP request URL and add any required n8n credentials for that service.