How to Build a WhatsApp AI Agent for Lead Qualification (Complete n8n Guide 2025)
Learn how to build an n8n workflow that captures Facebook leads, sends a personalised WhatsApp message instantly, and qualifies them with a Claude AI agent.
Introduction
Most businesses that run Facebook lead ads face the same problem: a lead submits a form, and then nothing happens fast enough. By the time someone manually follows up, the lead has moved on.
This guide shows you how to build a fully automated WhatsApp AI agent that captures leads from Facebook ads, sends a personalised first message instantly, and then handles the entire qualification conversation automatically — asking the right questions, understanding the answers, and even presenting matching properties or products from a live database.
The example throughout is a real estate agency, but the system works for any business that qualifies leads through conversation: agencies, service businesses, coaching practices, e-commerce. The architecture is identical — only the questions and data source change.
By the end, you'll have a working two-part n8n workflow that runs without any manual input from the moment a lead fills in your Facebook form to the moment they're qualified and ready for a human conversation.
What You'll Build
- Automatic first message sent to every new Facebook lead the moment they submit the form
- Scheduled follow-up that fires only if the lead hasn't responded within 24 hours
- AI agent powered by Claude that reads incoming WhatsApp messages and replies with contextually relevant, on-brand responses
- Google Sheets integration that lets the agent query your property or product database in real time
- Image sending with captions when the agent is ready to make a recommendation
- Human takeover toggle in WhatsAble that lets you pause the bot and take over any conversation manually
Why AI-Powered Lead Qualification on WhatsApp Works
Email follow-up sequences are table stakes. WhatsApp is where people actually respond.
Speed matters more than most businesses realise. The probability of qualifying a lead drops sharply the longer you wait after form submission. An automated WhatsApp message that arrives within seconds of a form submission beats a follow-up email the next morning by a wide margin.
WhatsApp is conversational by nature. A chatbot on a website feels like a widget. A message arriving in someone's WhatsApp inbox feels like a real person reaching out. People are far more likely to respond, and to respond honestly.
AI handles volume without quality loss. Whether you have 5 leads a week or 500, the agent asks the same qualifying questions with the same consistency. No leads fall through the cracks because the sales team was busy.
WhatsAble gives you control the other tools don't. The ability to see all conversations in a shared inbox, toggle AI on and off per conversation, and have full conversation history sent to the AI as context means you're not flying blind — you can jump into any conversation at any point.
🎥 Watch the Full Video Walkthrough
The video shows the entire build in real time. Follow along or use this guide to set it up at your own pace — both cover the complete two-part workflow.
What You'll Need
Before building, confirm you have access to all of these:
n8n account: This workflow is built entirely in n8n. You can use n8n Cloud or a self-hosted instance. The nodes used are all available on both.
Facebook Ads account with a Lead form: You need an active campaign with a lead form that collects at minimum the lead's name and phone number. The phone number field is essential — without it, you cannot send WhatsApp messages.
WhatsAble Notifyer System account: This is the tool that handles all WhatsApp messaging — sending templates, receiving incoming messages, scheduling follow-ups, and providing the human inbox. Sign up at https://console.notifyer-systems.com/sign-up if you don't have an account.
Anthropic API key: The AI agent uses Claude (Sonnet 4.5 in this example). Create an account at console.anthropic.com, generate an API key, and add a small amount of credit — a few euros or dollars is enough for testing.
Google Sheets (optional but recommended): Used as the property or product database the agent queries. Any spreadsheet with a title, location, price/budget column, and image URL column will work.
System Overview: Two Workflows, One Agent
Before jumping into steps, it helps to understand the full architecture:
Workflow 1 — Lead capture and first outreach: Triggered every time a Facebook lead form is submitted. Takes the name and phone number, sends a personalised WhatsApp template message, and schedules a follow-up if there's no response within 24 hours.
Workflow 2 — Incoming message handler and AI agent: Triggered every time a lead sends a WhatsApp message back. Passes the message and the full conversation history to the Claude AI agent, which generates a reply based on its system prompt and any tools it has access to (like the Google Sheets property database). The reply is then sent back via WhatsAble.
The two workflows run independently but share the same WhatsAble account and conversation data.
Part 1: Capture Facebook Leads and Send the First WhatsApp Message
Step 1: Set Up the Facebook Lead Ads Trigger in n8n
In n8n, create a new workflow. Add the Facebook Lead Ads trigger node. This is a built-in n8n integration — connect it to your Facebook account and select the ad account, page, and form you want to monitor.
The fields you need to map from the form are:
- Full name (or first name if your form separates them)
- Phone number — must include country code for WhatsApp to work. If your form collects local numbers without a country code, you'll need to add a transformation step to prepend the correct code.
Test the trigger by submitting a test entry through your Facebook form and confirming n8n receives both fields correctly before continuing.
Step 2: Connect WhatsAble to n8n
Add a WhatsAble node to your workflow. If it's your first time using it, you'll need to create a new credential.
To get your API key: log into your Notifyer System account, go to the API key section, copy the key, and paste it into the credential setup in n8n. Give the credential a clear name (e.g., "WhatsAble Demo") so you can identify it later if you have multiple accounts.
Step 3: Create Your Opening Message Template
Because you are initiating the conversation — the lead hasn't messaged you first — WhatsApp requires you to use a pre-approved message template. You cannot send a free-form message to open a conversation.
In your Notifyer System account, navigate to the Templates section. Create a new template for your opening message. Keep it personalised and action-oriented. A good structure:
- Greet the person by first name (use a placeholder variable)
- Acknowledge what they showed interest in
- Ask one clear opening question or invite them to respond
Example for real estate: "Hi {{name}}, thanks for your interest in our properties. I'd love to help you find the right fit — could you tell me a bit about what you're looking for?"
Save the template and wait for Meta's approval, which typically takes a few minutes to a few hours for new templates.
Step 4: Send the Template to Your New Lead
Back in n8n, configure your WhatsAble node:
- Action: Send a WhatsApp message
- Product: Send a template via Notifyer System
- Recipient: Map the phone number field from your Facebook trigger
- Template: Select the template you just created
- Variable (name): Map the first name field from your Facebook trigger
This is the entire first part of the workflow for the initial send. When you execute this, the lead receives a personalised WhatsApp message within seconds of submitting the Facebook form.
Step 5: Schedule an Automated Follow-Up
Not every lead will respond to the first message. To increase the chances, add a second WhatsAble node that schedules a follow-up message 24 hours later — but only if the person hasn't replied yet.
Add a new WhatsAble node with the following configuration:
- Action: Schedule a WhatsApp message
- Product: Send a template via Notifyer System (use a different follow-up template, or the same one for testing)
- Recipient: Phone number from Facebook trigger
- Scheduled send time: Set this as a dynamic expression. In n8n's expression editor, use
{{$now.plus(1, 'day')}}to add exactly 24 hours to the current time. You can also use hours —{{$now.plus(28, 'hours')}}— to fine-tune the timing.
Now add the condition that prevents the follow-up from sending if the lead already responded. Enable the Conditions toggle on the node. In the field options provided by WhatsAble, select the condition for whether the person sent a message in the last 24 hours. Set the operator to exists — this means the condition is met (and the follow-up is skipped) if there is any incoming message from that contact in the window.
This way, engaged leads don't receive an unnecessary follow-up, and silent leads get a second touch automatically.
Part 2: Receive Incoming Messages and Run the AI Agent
Step 6: Set Up the WhatsAble Incoming Message Trigger
Create a second workflow in n8n. Add a WhatsAble trigger node — specifically the incoming message trigger from the Notifyer System.
Create a new credential using the same API key from your Notifyer System account (or reuse the existing credential if n8n saved it).
For this trigger to work, you need to register your n8n webhook URL in WhatsAble. In your Notifyer System account, go to the Developer Console and add a new endpoint. Paste in your n8n webhook URL — during development use your test URL; when the workflow is ready for production, replace it with the production URL.
This tells WhatsAble: whenever a message arrives on your WhatsApp number, forward the event data (phone number, message content, conversation history) to this n8n workflow.
Step 7: Configure the AI Agent in n8n
Add an AI Agent node to the workflow. This is n8n's built-in agent node that orchestrates a large language model with tools and memory.
In the agent's configuration:
- Prompt: Set to "Define below in free text field" and write: Reply to the user's last message. Then map the last message value from the WhatsAble trigger into the prompt. You'll also add the conversation history here after connecting the trigger (covered in Step 8).
- Chat model: Click to add a model and select Anthropic. Create a new credential with your Anthropic API key. Select Claude Sonnet 4.5 (or the latest available Sonnet model) as the model.
Step 8: Write Your System Prompt
The system prompt is what defines who the agent is, what it knows, how it behaves, and what it's trying to accomplish. A vague system prompt produces a generic, unhelpful agent. A well-structured one produces a specialist.
For a real estate lead qualification agent, a solid system prompt covers:
Role: Who the agent is. Example: "You are a helpful WhatsApp assistant for [Agency Name], a real estate agency. Your job is to qualify leads and help them find the right property."
Conversation goal: What the agent is trying to find out. In this example, the two qualifying questions are minimum number of bathrooms and budget. Keep it focused — don't try to collect ten data points in one conversation. Start with two or three key qualifiers.
Tone and style: WhatsApp is informal. The agent should write in short paragraphs, avoid corporate language, and feel like a knowledgeable person rather than a system. No bullet point lists in WhatsApp messages.
Task sequence: When to greet, when to ask qualifying questions, when to query the property database, and when to make a recommendation. Giving the agent a clear sequence of tasks prevents it from jumping ahead or going in circles.
Tool usage instructions: Explicitly tell the agent when to use the Google Sheets tool (covered in the next section). Example: "Once you have both the minimum bathrooms and budget from the user, use the 'get properties' tool to find matching listings. Always present just one property at a time."
In the AI Agent node's System Prompt field, paste your full prompt. n8n provides a full-screen editor for this — use it, as system prompts for agents tend to be long.
Also update the user prompt to include the full conversation history alongside the last message. Map the conversation history field from the WhatsAble trigger into the prompt with a label like: "Here is the conversation history between you and the user: {{conversationHistory}}". This gives the agent full context on every turn and prevents it from asking questions the lead already answered.
Step 9: Send the AI Response Back via WhatsApp
Add a final WhatsAble node to close the loop:
- Action: Send a WhatsApp message
- Product: Send a non-template message via Notifyer System — you can send free-form messages here because the lead has already replied to you, which opens a 24-hour conversation window
- Recipient: Phone number from the WhatsAble trigger
- Message type: Text
- Message content: Map the output of the AI Agent node
Execute a test run: activate the workflow, send a message to your WhatsApp number, and confirm the agent responds correctly. Check that the conversation history context is working by sending a multi-turn exchange and verifying the agent doesn't repeat questions already answered.
Going Further: Connect Google Sheets as a Property Database
The setup above handles conversation. This section adds a real-time data layer — the agent can now query your property database and present a matching listing with an image.
Step 10: Add a Google Sheets Tool to the Agent
In the AI Agent node, click Add Tool and select Google Sheets. Connect your Google account and configure:
- Operation: Get all rows
- Document: Select your properties spreadsheet
- Sheet: Select the relevant sheet
Your spreadsheet should have at minimum: a property title, location, price, number of bedrooms/bathrooms, and an image URL column (a publicly accessible direct link to the property photo).
Rename this tool to get properties — this is the name you referenced in the system prompt when instructing the agent on when to use it. The name must match exactly.
Once connected, the agent can decide on its own when to call this tool. Based on the system prompt instructions, it will only do so after collecting the minimum qualifying information (bathrooms and budget in this example).
Step 11: Use Structured Output to Send Property Images
By default, the AI agent returns plain text. To send a property image alongside the recommendation text, you need the agent to return structured data — specifically, a message field and an image URL field as separate values.
In the AI Agent node, enable the Require Specific Output Format toggle. Click the Output Parser option — n8n will automatically add a Structured Output Parser node in the right position.
In the Structured Output Parser, define the JSON schema for your expected output:
{ "message": "The text message to send to the user", "imageUrl": "The image URL from the Google Sheet, if proposing a property", "budget": "The budget figure the user mentioned"}
After saving, run the agent once so n8n builds the output structure. Now when you connect downstream nodes, you'll see three separate fields available: message, imageUrl, and budget — rather than a single raw text output.
Update the text message node from Step 9 to use the message field specifically instead of the raw agent output.
Add a second WhatsAble node for sending images:
- Action: Send a WhatsApp message
- Message type: Image
- Recipient: Phone number from WhatsAble trigger
- Image URL: Map the
imageUrlfield from the structured output - Caption: Map the
messagefield — this text appears below the image
Step 12: Add a Conditional to Separate Text and Image Replies
You now have two outgoing nodes — one for text replies and one for image replies. They shouldn't both fire on every message. Add an If node between the agent output and the two send nodes.
Condition: Check whether imageUrl is empty (no value exists).
- If true (imageUrl is empty): Route to the standard text message node — the agent is still in conversation, not yet recommending a property
- If false (imageUrl has a value): Route to the image message node — the agent has completed qualification and is presenting a property
This keeps the conversation natural. The lead receives plain text responses during the qualification exchange, and then an image with a caption when the agent is ready to make a recommendation.
Human Takeover: When to Step In Manually
One of the most practical features in WhatsAble is the ability to pause the AI agent for a specific conversation and take over manually.
In the WhatsAble Notifyer System interface, you can see all active conversations in a shared inbox. Each conversation shows the latest message, the contact name, and the labels you've assigned. When you want to take over from the AI:
- Click into the conversation
- Toggle the AI assistant off for that specific contact
- The n8n workflow will continue to receive incoming messages, but the agent node won't reply — instead the message sits as unread in your inbox
- You reply directly from the WhatsAble interface
When you're done and want to hand back to the agent, toggle it back on.
This is useful when a lead is hot and ready to book a call, when a conversation is going in an unexpected direction, or when you want to review what the agent said before continuing. You don't lose any conversation history — the full thread is visible in the inbox.
Tips for Adapting This to Other Industries
The real estate example is illustrative. The same workflow structure works for any business that qualifies leads through conversation.
Service businesses (agencies, consultants, lawyers): Replace the bathroom/budget questions with your qualifying criteria — timeline, scope, budget range, type of service needed. Replace the Google Sheets property database with a service catalogue or case study library.
Coaching and courses: Qualify by goal, experience level, and budget. Use Google Sheets to match people to the right programme tier or intake date.
E-commerce with a configurator: If you sell custom products, the agent can ask specification questions and return matching SKUs from your product sheet, complete with product images.
Event registrations: Use the first message template to confirm registration, then have the agent answer FAQs and collect any additional information you need before the event.
The key variables to change per industry are: the Facebook lead form fields, the system prompt, the qualifying questions, and the data source connected as a tool. Everything else in the n8n workflow remains identical.
Frequently Asked Questions
Q: Do I need coding experience to build this?A: No. n8n is a visual workflow builder. The most technical part is writing the system prompt and the n8n expression for the scheduled follow-up time, both of which are covered in this guide. The AI agent setup and Google Sheets connection are all done through UI configuration.
Q: Why is Claude used instead of GPT or another model?A: Claude Sonnet 4.5 is the model demonstrated in the video, but the n8n AI Agent node supports multiple LLMs. You can swap it for GPT-4o, Gemini, or any other supported model by changing the chat model node. The system prompt and tool configuration remain the same.
Q: What happens if the AI agent gives a wrong or unhelpful response?A: This is why the human takeover toggle exists. If you notice a conversation going poorly, you can jump in manually at any point. The agent's behaviour improves significantly with a well-written system prompt — investing time in the prompt pays off more than any other single change.
Q: Can I use this with Zapier or Make instead of n8n?A: WhatsAble Notifyer System integrates with Zapier and Make as well. The WhatsApp sending and receiving steps work the same way. The AI agent step would need to be handled by an OpenAI or Anthropic action in Zapier/Make rather than n8n's native agent node. The logic is the same, but the structured output and tool-calling features are more limited outside of n8n. Contact team@whatsable.app if you need help adapting this for Make or Zapier.
Q: Do I need to keep my n8n workflow active 24/7?A: Yes — the incoming message trigger only processes messages while the workflow is active. If you're on n8n Cloud, workflows stay active as long as you have an active subscription. On self-hosted n8n, you need to ensure your server stays running.
Q: What's the difference between Notifier Bot and Notifyer System for this use case?A: You need Notifyer System for this workflow. The AI agent relies on incoming message webhooks, conversation history, scheduled messages with conditions, and free-form reply capability — all features exclusive to Notifyer System. The Notifier Bot does not support these.
Q: How do I prevent the agent from sending a follow-up to a lead who already replied?A: This is handled by the condition in Step 5. WhatsAble's scheduled message node has a built-in condition field — set it to check whether the contact sent any message in the last 24 hours. If they did, the follow-up is automatically suppressed.
Conclusion
What you've built here is not a simple chatbot. It's a lead qualification system that runs 24 hours a day, handles multiple conversations simultaneously, personalises every reply based on conversation history, and escalates intelligently to a human when needed.
The combination of n8n's workflow engine, Claude's conversational reasoning, Google Sheets as a live data source, and WhatsAble as the WhatsApp layer gives you capabilities that would have required a custom software build two years ago — now assembled in an afternoon.
The real estate example shows the full system, but the principle applies everywhere: capture the lead, open the conversation automatically, let the AI qualify, use your own data to make recommendations, and step in when it matters.
Key Takeaways
- Facebook lead forms must collect a phone number — without it, the workflow cannot start
- The first message must be a WhatsApp template because you are initiating the conversation
- Add conversation history to every AI agent prompt — without it the agent loses context on each turn
- Use structured output to separate message text from image URL so you can conditionally send images
- The human takeover toggle in WhatsAble is essential for production use — always have a way to step in
- System prompt quality determines agent quality — spend more time there than anywhere else in the setup
Get Started
- Sign up for WhatsAble Notifyer System — needed for all WhatsApp sending, receiving, and scheduling
- Set up your n8n workflow starting with the Facebook Lead Ads trigger
- Create your message templates in the Notifyer System console before building the send nodes
- Get your Anthropic API key at console.anthropic.com and add a small amount of credit for testing
- Write a detailed system prompt — define the agent's role, qualifying questions, and tool usage instructions before testing
- Questions? Reach out at team@whatsable.app — support is included with your subscription