Category: Automations › WhatsApp Lead Capture · Best for: Businesses advertising on several channels who want one lead inbox on WhatsApp · Platform: n8n · Steps: 17
What it does
Leads from Facebook and Instagram lead ads, Google Ads, your website, Messenger, comments and Instagram DMs go into one CRM sheet and your WhatsApp, and every lead gets the right auto-reply.
Leads answered in the first five minutes are far more likely to buy. This workflow puts every new lead in front of you on WhatsApp the moment it arrives and greets the lead for you, so nobody waits for a callback.
Works with: Facebook Lead Ads, Google Ads, Instagram, Google Sheets, WhatsApp
What you get
- The n8n workflow file (
workflow.json), ready to import - This setup guide, including the WhatsApp message templates to create
- Email support if you get stuck
Before you start
-
An n8n account. Easiest: n8n Cloud (free trial). Self-host for free with Docker:
docker run -it --rm -p 5678:5678 -v n8n_data:/home/node/.n8n docker.n8n.io/n8nio/n8n. Other services need to reach your n8n, so a self-hosted n8n must be on a public HTTPS address. -
A WhatsApp Business Cloud API number from Meta (free to set up; Meta charges per conversation, see WhatsApp pricing). Your personal WhatsApp number can't be used.
-
These credentials in n8n (Credentials → Add credential):
- Facebook Lead Ads (
facebookLeadAdsOAuth2Api): click Connect in n8n and sign in with the Facebook account that manages the Page. On self-hosted n8n you first create a Meta app with the Facebook Login product. n8n guide - Meta app (webhooks) (
facebookGraphAppApi): your Meta app's App access token (APP_ID|APP_SECRET) and App secret. n8n uses it to subscribe the webhook for you. Add the Messenger product (and Instagram for DMs) to the app. n8n guide - Meta page access token (
facebookGraphApi): a Page access token withpages_messaging(andinstagram_manage_messagesfor Instagram), from Graph API Explorer or a system user. Used to send the instant replies. n8n guide - Google Sheets (
googleSheetsOAuth2Api): click Sign in with Google in n8n. n8n guide - WhatsApp Business Cloud (
whatsAppApi): at developers.facebook.com make an app of type Business, add WhatsApp, then create a permanent access token for a system user in Business Settings. In n8n paste the token and your WhatsApp Business Account ID. n8n guide
- Facebook Lead Ads (
Create your WhatsApp templates (once)
Meta only lets a business start a WhatsApp chat with an approved template. Create these in WhatsApp Manager → Message templates → Create template, language English (en). Approval usually takes minutes.
1. new_lead_alert (category: Utility, sent to you):
New lead from {{1}}
Name: {{2}}
Contact: {{3}}
Message: {{4}}
2. lead_welcome (category: Marketing, sent to the lead):
Hi {{1}}, thanks for your interest! We got your details and will message you here on WhatsApp shortly.
Use other wording if you like, keeping the same {{1}} placeholders. If you rename a template, change the Template field in its WhatsApp box to match (name|language).
Install
- In n8n, click Create workflow (top right).
- Click the ⋯ menu → Import from file and choose
workflow.json. Or copy the file's contents and paste onto the empty canvas with Ctrl/Cmd + V. - Open each box with a red warning triangle and pick the matching credential from the list above.
- In every WhatsApp box, replace
YOUR_WHATSAPP_PHONE_NUMBER_IDwith your Phone number ID (WhatsApp Manager → API setup). In the box that messages you, replace919876543210with your own number (country code, no+). - Make a Google Sheet with a tab called Leads and this header row:
lead_key | source | name | phone | email | message | form | received_at | kind | sender_id | comment_id | post_id. One row per person: a repeat lead from the same number updates their row. Paste the sheet's link into the Google Sheets box. - Follow the source steps you need: pick your Page and form in Meta + Instagram lead forms; set your key in Check key + clean up and paste the Google Ads webhook; point your website form at Website form; put your Page ID in Read page event and your Instagram ID in Read Instagram DM.
- Delete the starting box and clean-up box of any source you don't use.
Then click Save. In each Code box, DEFAULT_COUNTRY_CODE is 91 (India): change it to 1 for the US and Canada, 44 for the UK, and so on.
Test it
- Click Test workflow.
- Test one source at a time: Meta's Lead Ads Testing Tool, Google Ads Send test data, your own website form, then a Messenger message and an Instagram DM from another account.
- Click each box to see its output. A green tick means the step worked. A red box is almost always a credential, a template name that doesn't match, or a number without its country code.
Go live
Toggle Active (top right). From now on it runs on its own. Check Executions in the left sidebar to see every run.
How it works, step by step
- Five starting boxes: Meta + Instagram lead forms, Google Ads lead form, Website form, Page messages + comments and Instagram DMs.
- Each has its own clean-up box, so every lead comes out in the same shape: source, name, phone, email, message.
- Save to CRM sheet adds the lead, or updates that person's row so repeat leads don't pile up.
- WhatsApp me the lead sends every lead to you with its source.
- Has a WhatsApp number? sends leads with a phone to WhatsApp auto-reply; the rest (DMs and comments) go to Message or comment?, which replies in the DM or privately under the comment.
Good to know
- WhatsApp only lets a business message first with an approved template; replies within 24 hours of the customer's last message can be free text.
- That's why the alert and the welcome use templates. Instagram and Messenger replies are free text, because the person messaged you first.
- A lead without a phone number still reaches you; it just doesn't get the WhatsApp welcome.