{"product_id":"replay-safe-webhook-dedupe-in-n8n-first-event-only","title":"Replay-Safe Webhook Dedupe in n8n: First Event Only","description":"\u003ch3\u003eReplay-safe event ingestion for n8n webhooks—accept only the first delivery\u003c\/h3\u003e\n\u003cp\u003eThis n8n automation workflow receives HTTP POST events, validates their \u003cem\u003eevent envelope\u003c\/em\u003e, and deduplicates them using a \u003cstrong\u003esource:event_id\u003c\/strong\u003e key so replayed or duplicated deliveries are safely rejected while the first one is accepted.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eReceives POST webhooks\u003c\/strong\u003e at an n8n webhook endpoint using the “Receive Event” trigger.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eValidates the JSON body\u003c\/strong\u003e: it checks required fields such as \u003ccode\u003eevent_id\u003c\/code\u003e (or \u003ccode\u003eeventId\u003c\/code\u003e) and \u003ccode\u003esource\u003c\/code\u003e (or \u003ccode\u003eorigin\u003c\/code\u003e), then normalizes them.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eBuilds a deduplication key\u003c\/strong\u003e in the format \u003cstrong\u003esource:event_id\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eHandles invalid requests safely\u003c\/strong\u003e: if validation fails, it returns \u003cstrong\u003eHTTP 422\u003c\/strong\u003e with an \u003ccode\u003einvalid_event_envelope\u003c\/code\u003e error payload.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eDeduplicates using n8n history\u003c\/strong\u003e: it checks whether the dedupe key has been seen in prior executions.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eAccepts only the first event\u003c\/strong\u003e: for first-seen keys, it returns \u003cstrong\u003eHTTP 202\u003c\/strong\u003e confirming acceptance and includes \u003ccode\u003eevent_id\u003c\/code\u003e, \u003ccode\u003esource\u003c\/code\u003e, and \u003ccode\u003ededupe_key\u003c\/code\u003e.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eSaaS operators ingesting third-party webhook events that may be retried or replayed during network issues.\u003c\/li\u003e\n  \u003cli\u003eAutomation engineers building reliable webhook consumers where idempotency is required.\u003c\/li\u003e\n  \u003cli\u003eEvent-driven systems that need predictable behavior across retries within a replay window.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eNodes\/logic:\u003c\/strong\u003e \u003ccode\u003ewebhook\u003c\/code\u003e, \u003ccode\u003eif\u003c\/code\u003e, \u003ccode\u003ecode\u003c\/code\u003e, \u003ccode\u003eremove duplicates\u003c\/code\u003e, \u003ccode\u003erespond to webhook\u003c\/code\u003e, plus a sticky note for guidance.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eDedupe method:\u003c\/strong\u003e relies on n8n’s built-in deduplication history (configured size is \u003cstrong\u003ecurrently 10,000 keys\u003c\/strong\u003e).\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eSetup:\u003c\/strong\u003e copy the webhook URL from the “Receive Event” trigger, ensure stable \u003ccode\u003eevent_id\u003c\/code\u003e\/\u003ccode\u003eeventId\u003c\/code\u003e and \u003ccode\u003esource\u003c\/code\u003e\/\u003ccode\u003eorigin\u003c\/code\u003e, and adjust endpoint path\/method\/response codes if needed.\u003c\/li\u003e\n\u003c\/ul\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":46223950774451,"sku":"N8N-20897","price":26.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/jU4l6HQGtBHzaRWfgOR8Y_5oDTcM0M.png?v=1791969626","url":"https:\/\/buyflowscripts.com\/products\/replay-safe-webhook-dedupe-in-n8n-first-event-only","provider":"N8N Commerce","version":"1.0","type":"link"}