Deduplicate inbound leads from a webhook with a data table

Go to Workflow
0 views
Built by MORSOF MORSOF
Created on September 13, 2026

Description

Quick overview
This workflow receives lead submissions via a webhook, validates and normalizes the data, and stores unique leads in an n8n Data Table using an idempotency key and payload hash to prevent duplicates and detect conflicting replays.

How it works
Receives a POST webhook request containing lead details and an Idempotency-Key header.
Validates required fields (including email format and idempotency key), normalizes the lead fields, and rejects invalid requests with a 400 response.
Hashes the normalized lead payload to create a payload fingerprint for replay detection.
Creates (or reuses) an n8n Data Table named lead_intake_template and looks up an existing row by the idempotency key.
If the idempotency key exists with a different payload hash, returns a 409 conflict response to indicate the key was reused with different data.
If the idempotency key already exists with the same payload hash, returns a 200 response identifying the submission as a duplicate and returns the existing lead ID.
If no match exists, inserts a new lead row with status pending and returns a 202 response with the new lead ID.

Setup
Copy the production webhook URL from the “Receive Lead” trigger and configure your lead source (form, site, or backend) to POST to it.
Ensure the sender includes an Idempotency-Key (or X-Idempotency-Key) header on every submission and provides at least a valid email field in the JSON body.
Update the webhook path (lead-intake-data-table) and Data Table name (lead_intake_template) if they need to match your environment or naming conventions.

Nodes Used (2)

Code
n8n-nodes-base.code
Crypto
n8n-nodes-base.crypto