Mohamed Elghannam

Section 01 of 09

Lead-gen system architecture

01Lead-gen system architecture

One pipeline for every channel. A lead from the website, a Meta instant form, TikTok, Snapchat or an Instagram comment lands in the same CRM within seconds, is assigned to a rep, and reports back to the ad platforms as a server-side event with the same event ID the browser pixel used.

  1. Capture

    Website forms post to a Cloudflare Worker (Turnstile, honeypot, rate limit, event ID), then to n8n. Meta instant forms arrive through the native GoHighLevel integration. Instagram comments reach n8n through the Meta webhook.

  2. Normalise and route

    n8n validates, maps attribution fields (platform, campaign, ad set, ad, form, first-touch UTMs), blocks duplicates, tags the project and consent source, opens an opportunity and round-robins the lead to an active rep with a WhatsApp alert.

  3. Report back

    Lead and browse events go server-side to Meta, TikTok, Snapchat and GA4 with a hashed visitor ID. Pipeline stage changes are polled every 10 minutes and sent as CRM conversion events, so the platforms optimise on qualified leads, not raw form fills.

  4. Assist the team

    Nurture suggestions, nudges, a conversation coach, a knowledge bot and an ops console sit on top. Nothing in the system messages a customer automatically; reps send, the system prepares.

Blue: acquisition. Amber: automation layer (Worker and n8n). Teal: sales and measurement. The dashed line is the feedback loop to the ad platforms.AcquisitionAutomationSales and measurementMeta, TikTok, Snapchat formsWebsite formsTurnstile, honeypot, event_idInstagram commentsCloudflare Worker /api/leadrate limit, visitor ID cookien8n intake and routervalidate, attribute, dedupe, tagGoHighLevel CRMcontact, opportunity, round-robinServer-side eventsMeta CAPI, TikTok, Snap, GA4Sales repsWhatsApp alert, daily batchesCoach, nudges, knowledge botOps console and weekly KPI

Diagram Blue: acquisition. Amber: automation layer (Worker and n8n). Teal: sales and measurement. The dashed line is the feedback loop to the ad platforms.

Deduplication and the feedback loop

The browser pixel and the server send the same event with the same event_id, so the platform counts it once. The visitor ID cookie is hashed and sent as external_id, which lifts the match quality. Stage changes in the CRM become conversion events (Lead → Contacted → Interested → Qualified) so the campaigns learn from what sales actually qualifies.

Browser and server events carry the same ID; the platform keeps one. CRM stage changes feed the same conversion dataset.BrowserServer (Worker and n8n)Ad platforms and CRMPixel eventLead, event_id = XBeacon to /api/evafter tags load, or on pagehideServer eventsame event_id = X, hashed external_idlead_capi_keys12-month retention, purged dailyFunnel events every 10 minstage change → CRM eventMeta / TikTok / Snap / GA4one Lead, not twoCRM pipeline stages

Diagram Browser and server events carry the same ID; the platform keeps one. CRM stage changes feed the same conversion dataset.

Want this for your projects?

The whole stack, or one piece of it. WhatsApp is fastest.