Zero-Drop Webhook Relays: Connecting Ad Platforms to CRMs with Automated Failovers
Zero-Drop Webhook Relays: Connecting Ad Platforms to CRMs with Automated Failovers
When marketing teams run paid ad campaigns on Meta, Google, or TikTok, they often rely on simple direct integrations into their CRM. On paper, it works: a homeowner fills out a lead form, the ad platform fires a webhook, and the contact record appears in GoHighLevel or HubSpot.
In practice, direct point-to-point connections break under real-world conditions:
- The destination CRM API encounters a temporary 502/504 gateway timeout during scheduled updates.
- Burst traffic from an ad campaign spikes past CRM rate limits (e.g., 10 requests/second).
- The destination endpoint fails to respond within the ad platform's 5-second webhook timeout window, causing the ad network to drop the event permanently.
When you are spending $50 to $150+ per qualified lead, dropping even 5% of webhooks burns thousands of dollars every month.
The Architecture of a Resilient Webhook Relay
To guarantee zero dropped leads, production automation architecture decouples lead ingestion from CRM processing through a resilient relay layer:
1. Instant 200 OK Ingestion Gateway
The incoming webhook endpoint does only two things: 1. Validates the signature header (HMAC SHA-256) to ensure the request genuinely originated from Meta or Google. 2. Writes the raw JSON payload immediately into a persistent queuing buffer (Redis / Kafka / PostgreSQL queue) and returns an HTTP200 OK in under 50 milliseconds.
By responding immediately, the ad platform never times out, and the event is safely written to disk.
2. Idempotency & Deduplication
Ad platforms frequently deliver duplicate webhooks when retry headers trigger. The relay worker computes a deterministic hash from the unique lead ID and timestamp. If a duplicate hash is detected within a 24-hour window, it is logged and discarded, preventing duplicate contacts or split text threads in your CRM.3. Exponential Backoff & Retry Queue
Downstream workers consume messages from the queue and execute the CRM API calls. If the CRM returns a429 Too Many Requests or 5xx Server Error, the worker catches the error, delays the payload using exponential backoff (e.g., retrying at 5s, 30s, 2m, 10m), and preserves the event until delivery succeeds.
4. Dead-Letter Queues (DLQ) & Alerting
If a lead fails after 5 consecutive attempts (for example, due to an unhandled schema change or revoked OAuth token), it is routed to a Dead-Letter Queue. An automated webhook alert notifies engineering via Slack with the full payload intact, allowing for manual one-click reprocessing.Decoupling ingestion from downstream CRM APIs ensures that 100% of the ad spend you pay for is accounted for and delivered into your sales team's hands.