Process7 min read
Getting every lead into a custom CRM: Meta lead forms, website forms and WhatsApp chats in one pipeline
By Sannan MalikPublished
Short answerGive every source the same lead record, and keep the source's own ID on it. Meta lead ads arrive as a webhook with a lead ID you then fetch, website forms post straight to your API, and WhatsApp chats arrive as message webhooks. Before saving, normalise phone numbers to E.164, lowercase emails, match on WhatsApp user ID, phone and email in that order, and start the response clock from when the lead was created.
What each source actually sends you
A Meta lead ad does not push the lead itself. Meta's leadgen webhook sends a notification with a leadgen_id, the page_id, form_id, ad_id, adgroup_id and a created_time. Your server then requests that lead ID from the Graph API and gets field_data back: a list of name and values pairs such as full_name and email, plus any custom questions under their own field IDs. Meta's Retrieving Leads page says real-time pings can arrive with a delay of up to a few minutes.
Getting there takes setup. Meta's Lead Ads page says your app must pass App Review with the leads_retrieval and pages_manage_ads permissions, and that Business Verification follows approval. An app still in Development mode cannot retrieve leads, except those submitted by people with a role on the app. I would start that review in week one.
A website form is the easy one. You choose the fields, so make them match the lead record from the start.
A WhatsApp chat is not a form at all. The Cloud API messages webhook carries the person's profile name, their wa_id, a user_id and the first message. If they tapped a Click to WhatsApp ad, the message also carries a referral object with the ad's source_url, headline and a ctwa_clid click ID. That is your campaign data for chat leads, so store it.
The lead record, and where each field comes from
One table, one row per enquiry, linked to one contact. Blank cells are fields your team fills in, not fields to invent.
| Field | Meta lead form | Website form | WhatsApp chat |
|---|---|---|---|
| Source ID | leadgen_id | Your form submission ID | Message id (wamid) |
| Source and campaign | form_id, ad_id, adgroup_id | Page URL and UTM tags you capture | referral.source_url, headline, ctwa_clid when from an ad |
| Name | full_name from field_data | Name field | contacts.profile.name |
| Phone, stored in E.164 | Phone field if the form asks for it | Phone field | wa_id or from, when the phone number is available |
| Email, lowercased | email from field_data | Email field | Usually none; ask in the chat |
| WhatsApp user ID | None | None | contacts.user_id (BSUID) |
| What they want | Custom questions in field_data | Your enquiry fields | Text of the first message |
| Consent checkboxes | custom_disclaimer_responses, fetched separately | Your own checkbox, stored with the wording | Record what they agreed to in the chat |
| Created at | created_time | Submission time | Message timestamp |
| Owner, status, first response at | Set by the CRM | Set by the CRM | Set by the CRM |
Dedupe rules to write down before the first lead arrives
Duplicates are the cost nobody quotes. One person fills in your Instagram form, messages on WhatsApp an hour later, and two salespeople call them. I would agree these rules with the sales lead in writing.
One WhatsApp detail matters more as usernames arrive, which Meta's BSUID page says will roll out gradually in 2026. Meta's messages webhook reference says the user's phone number is omitted when the user has adopted a username and their number is unavailable, and that an integration relying only on phone fields will not be able to process those messages. The BSUID, sent as user_id, is in every messages webhook. Meta's BSUID page adds that it is regenerated if the user changes phone number, which triggers a system webhook. So the CRM has to accept a WhatsApp contact with no phone at all.
- Normalise every phone to E.164 before saving: a plus sign, the country code, the number, no spaces. A made-up UAE mobile typed as 050 123 4567, 00971 50 123 4567 or +971501234567 is stored once, as +971501234567. Meta's webhook examples show wa_id as digits without the plus, so add it.
- Store numbers that cannot be parsed as typed, flagged for a person to fix. Do not guess the country.
- Lowercase and trim emails before comparing. I would not strip dots or plus tags, because that is not safe for every email provider.
- Match in this order: WhatsApp user ID, then phone, then email. Never merge on name alone.
- A match attaches the new enquiry to the existing contact. It does not delete anything and keeps both source IDs.
- If the contact already has an open lead, the new enquiry joins it and notifies its owner instead of creating a second lead. A closed lead gets a fresh one.
- Key every insert on the source ID, so a webhook delivered twice cannot create two leads.
Assignment and the response clock
I would pick one assignment rule per source and keep it boring. Round robin among the people on shift works for most teams. Language or branch rules come next, if the form or the ad tells you which one applies.
The clock should start at the source's own created time, not when your server received the lead. Meta's created_time and WhatsApp's message timestamp give you that. Stop it at the first human reply or logged call, recorded as first_response_at. An automatic thank-you message does not count. Then set one escalation: a lead with no first response after an agreed number of minutes goes to the team lead. Every response-time report comes from those two timestamps.
What you are allowed to send back on WhatsApp, and what Meta charges for it, is a separate subject. My post on WhatsApp Business pricing and templates covers it.
One safety net: Meta lets you read leads in bulk by form and filter on time_created. A nightly job that pulls the last day's leads and skips known leadgen_ids catches anything a missed webhook dropped. I would also save every lead to your own database as it arrives, rather than treating Meta as the place leads are kept.
A made-up Tuesday: nine enquiries, five people
Everything in this table is invented, including the numbers, to show the rules above working on one day.
| Time | Source | What arrived | Rule applied | Result |
|---|---|---|---|---|
| 09:02 | Meta form | Layla, 050 111 2233, layla@example.com | No match | New lead, assigned to Omar |
| 09:40 | Layla, wa_id 971501112233, from an Instagram ad | Phone matches after adding + | Joins Layla's open lead, Omar notified | |
| 10:15 | Website | Dan, +44 7700 900123, dan@example.com | No match | New lead, assigned to Sara |
| 10:16 | Website | Same submission again | Same source ID | Ignored |
| 11:30 | Username only, no phone, BSUID AE.88412 | No match on BSUID | New lead, assigned to Omar; ask for phone and email | |
| 13:05 | Meta form | Priya, phone blank, PRIYA@Example.com | No match | New lead, assigned to Sara |
| 14:20 | Website | Priya, 055 444 5566, priya@example.com | Email matches after lowercasing | Joins Priya's open lead |
| 15:50 | Meta form | Ahmed, 0501112233 | Phone matches Layla | Held for review: same phone, different name |
| 16:45 | BSUID AE.88412 again, now gives email | BSUID matches | Joins the 11:30 lead |
What I build, and what it costs
A custom CRM is custom software, so it is a fixed quote after a written scope, not a package. The scope I would write lists each source, the lead record above, the dedupe rules in plain sentences and the assignment rule per source. Meta's own fees and any messaging provider costs are third-party fees and are not included.
Two case studies are close to this. My Forex CRM is a white-label brokerage CRM covering client onboarding, partner portals, KYC and AML workflow support and role-based access. My AI-Powered Lead Discovery work combines source monitoring, data validation, deduplication, CRM-oriented workflows and permission and suppression controls.
If you need less than a full CRM, such as a staff app where sales see and claim leads with a small dashboard behind it, my Scale package at $2,500 covers up to 50 screens, an admin dashboard, a Node.js backend with PostgreSQL and integrations with the services you use. The Meta and WhatsApp connections would be named in that written scope.
Questions
- Do I need Meta's App Review just to pull my own leads?
- For a custom integration, yes. Meta's Lead Ads page says the app must pass App Review with the leads_retrieval and pages_manage_ads permissions, then Business Verification. Meta also lists CRM partners that support lead ads, if you would rather not run your own integration.
- What if a WhatsApp lead never shares a phone number?
- Keep the lead under their business-scoped user ID. Meta says it appears in every messages webhook and can be used to message the user. Ask for a phone or email in the chat if your team needs one, and merge when it arrives.
Sources
Platform rules and fees in this article were checked against these official pages on 16 November 2026. They change, so confirm before you rely on them.
Sannan Malik is a software architect and product builder with 8+ years in software, CEO of Alpha Notic FZE and a Certified Scrum Product Owner. He builds mobile apps and business software for companies in the UAE, the wider Gulf, the UK, the US, Canada and Australia.