Idempotent Lead Webhook Workflow w/ Postgres & HTTP APIs
Idempotent Lead Webhook Workflow w/ Postgres & HTTP APIs
Regular price
£71.99
Regular price
£71.99
Sale price
Unit price
/
per
⬇
Instant Digital Download
∞
Unlimited Downloads
★
Lifetime Access in Your Account
Couldn't load pickup availability
🔥
128+ Sold
Popular with n8n builders
⚡
23 people viewing
High interest right now
✅
9 added today
Fast-moving digital product
Idempotent Lead Webhook Workflow w/ Postgres & HTTP APIs
Regular price
£71.99
Regular price
£71.99
Sale price
Unit price
/
per
Prevent duplicate lead processing with an Idempotent Webhook + PostgreSQL
This n8n automation receives lead submissions via a webhook and guarantees that the same Idempotency-Key is processed at most once. If a request is retried, it automatically replays the stored response—so your enrichment, CRM updates, and notifications never run twice for the same lead attempt.
What this workflow does
- Receives a POST webhook containing an Idempotency-Key (and optional X-Client-Id) plus a JSON lead payload.
-
Ensures PostgreSQL idempotency support by creating the
idempotency_keystable and required indexes (if needed), then validates the request. - Builds a canonical payload fingerprint to detect mismatched retries.
-
Atomically claims or replays:
- If the Idempotency-Key is new, it claims it with a lease.
- If the key already exists, it either replays the stored completed response or returns an error for in-progress/mismatched payload/store-unavailable scenarios.
-
On first-time processing:
- Calls an external enrichment API.
- Computes a deterministic lead score and tier.
- Creates/updates the lead in a CRM API.
- Sends a notification via a third HTTP endpoint.
- Stores the final outcome (HTTP status + response body) in PostgreSQL and replies to the webhook with Idempotency-Key and an Idempotent-Replayed flag.
Use cases
- Retry-safe lead intake for SaaS forms, ensuring duplicate webhooks don’t double-enrich or overwrite CRM data.
- Idempotent inbound processing for partner integrations where clients may resend payloads on timeouts.
- Reliable lead routing when enrichment/CRM calls are occasionally slow or transiently unavailable.
Technical details
-
PostgreSQL idempotency using
idempotency_keyswith a lease and stored response replay. - HTTP APIs for enrichment, CRM updates, and notifications.
- n8n nodes: if, code, wait, webhook, postgres, sticky note.
Setup note: Configure PostgreSQL credentials so the database user can create tables/indexes and read/write the idempotency_keys table.
