Quick overview
This workflow receives POST webhooks and validates each event’s envelope, then deduplicates events by a derived source:event_id key to safely accept only the first delivery and reject invalid requests with a structured error response.
How it works
- Receives an HTTP POST request via an n8n webhook endpoint.
- Validates the JSON body fields (event_id/eventId and source/origin), normalizes them, and builds a deduplication key in the format source:event_id.
- If validation fails, returns a 422 response with an invalid_event_envelope error payload.
- If validation succeeds, checks whether the deduplication key has been seen in previous executions using n8n’s built-in deduplication history.
- For a first-seen key, returns a 202 response confirming the event was accepted and includes the event_id, source, and dedupe_key.
Setup
- Activate the workflow and copy the webhook URL from the “Receive Event” trigger to configure it in the system that sends events.
- Ensure the sender includes a JSON body with a stable event_id (or eventId) and source (or origin) that match the workflow’s format rules.
- Adjust the webhook path, HTTP method, or response codes if your source system expects different endpoint settings.
- Review and tune the deduplication history size (currently 10,000 keys) to fit your replay window and memory requirements.