Quick answer: Connect the WhatsApp Trigger node in n8n to your Meta developer app, route each inbound message to an AI model with a constrained system prompt, and send the reply back with the WhatsApp node. Add an escalation branch so unrecognized questions go to a human. The result answers routine questions in seconds, at any hour, without you touching your phone.
The build takes under an hour once your WhatsApp Business Cloud API access is set up. Here is the whole path.
What You Need Before Starting
| Component | Purpose | Cost |
|---|---|---|
| Meta developer account + app | Grants WhatsApp Business Cloud API access | Free |
| Registered business phone number | The number customers message | Free to register |
| n8n instance | Runs the agent | Free self-hosted, or Cloud from about $20/mo |
| AI model API key (OpenAI or similar) | Generates the answers | Cents per conversation |
| Slack, email, or similar | Receives human escalations | Free |
The Meta setup is the fiddly part: create an app of type Business, add the WhatsApp product, and note the phone number ID and permanent access token. n8n's credential dialog asks for exactly these.
Step 1: Receive Messages With the WhatsApp Trigger
Add the WhatsApp Trigger node and select the messages event. n8n gives you a webhook URL; paste it into your Meta app's WhatsApp webhook configuration together with the verify token n8n shows.
Send a test message to your business number and confirm the execution fires. The customer's text arrives in the node output along with their WhatsApp ID, which you will use for the reply.
Step 2: Generate the Answer With a Constrained AI Step
Add your AI model node and build a system prompt with three parts: who the assistant is, what it knows, and when it must hand off. A working skeleton:
You are the assistant for [business name]. Answer customer questions
using ONLY the information below. Keep replies under 100 words,
friendly and specific.
BUSINESS INFORMATION
Opening hours: ...
Services and prices: ...
Location and parking: ...
Booking link: ...
RULES
If the question is not covered above, or the customer is upset,
or it involves payments or complaints, reply exactly with: HANDOFFPass the inbound message text as the user message. The HANDOFF sentinel is the load-bearing trick: it turns fuzzy AI judgment into a value your workflow can route on. This pattern of keeping the model inside a durable, observable flow is the discipline we describe in AI steps inside n8n, Make, and Zapier.
Step 3: Route the Response
Add an IF node checking whether the model output contains HANDOFF.
Normal branch: a WhatsApp node with the Send Message operation returns the model's answer to the customer's WhatsApp ID. Response time from trigger to reply is a few seconds.
Escalation branch: notify a human with the customer's number and full question, then send the customer a short holding message saying a teammate will reply shortly. A Slack alert works perfectly here, and the wiring is the same as in our Sheets to Slack tutorial.
Step 4: Log Everything
Add a final step that appends every conversation to a Google Sheet or database: timestamp, customer number, question, answer, and whether it escalated. The log is how you audit the bot's answers, spot the questions it cannot handle, and improve the prompt weekly. An unlogged AI agent talking to customers is a liability, not an asset.
The Starter Template
Import and rewire with your own credentials:
{
"name": "WhatsApp AI Auto-Responder",
"nodes": [
{
"parameters": { "updates": ["messages"] },
"id": "wa-trigger-1",
"name": "WhatsApp Trigger",
"type": "n8n-nodes-base.whatsAppTrigger",
"typeVersion": 1,
"position": [240, 300]
},
{
"parameters": {
"modelId": { "__rl": true, "mode": "list", "value": "gpt-4o-mini" },
"messages": {
"values": [
{ "role": "system", "content": "REPLACE_WITH_SYSTEM_PROMPT" },
{ "role": "user", "content": "={{ $json.messages[0].text.body }}" }
]
}
},
"id": "ai-1",
"name": "AI Answer",
"type": "@n8n/n8n-nodes-langchain.openAi",
"typeVersion": 1.8,
"position": [480, 300]
},
{
"parameters": {
"conditions": {
"string": [{ "value1": "={{ $json.message.content }}", "operation": "notContains", "value2": "HANDOFF" }]
}
},
"id": "if-1",
"name": "Needs Human?",
"type": "n8n-nodes-base.if",
"typeVersion": 2,
"position": [720, 300]
},
{
"parameters": {
"operation": "send",
"phoneNumberId": "REPLACE_WITH_PHONE_NUMBER_ID",
"recipientPhoneNumber": "={{ $('WhatsApp Trigger').item.json.messages[0].from }}",
"textBody": "={{ $json.message.content }}"
},
"id": "wa-send-1",
"name": "Reply on WhatsApp",
"type": "n8n-nodes-base.whatsApp",
"typeVersion": 1,
"position": [960, 220]
}
],
"connections": {
"WhatsApp Trigger": { "main": [[{ "node": "AI Answer", "type": "main", "index": 0 }]] },
"AI Answer": { "main": [[{ "node": "Needs Human?", "type": "main", "index": 0 }]] },
"Needs Human?": { "main": [[{ "node": "Reply on WhatsApp", "type": "main", "index": 0 }]] }
},
"active": false,
"settings": { "executionOrder": "v1" }
}Wire your escalation branch from the second output of the IF node to your Slack or email node, and add your logging step at the end of both branches.
Two Cautions Before You Go Live
Privacy. Customer messages are personal data. Host thoughtfully, minimize what your execution logs retain, and know your obligations; our n8n GDPR guide covers exactly this decision.
Scope. Launch with a narrow, honest bot that answers ten questions well and hands off everything else. Widen its knowledge weekly based on the log. Bots fail publicly when they are allowed to improvise on day one.
FAQ
Do I need a special WhatsApp account for this?
Yes. Automated messaging requires the WhatsApp Business Cloud API through a Meta developer account, with a registered business phone number. A normal WhatsApp or WhatsApp Business app account cannot be automated this way. Setup is free, and Meta bills per conversation once you pass the free tier.
What is the 24-hour window rule?
WhatsApp lets a business send free-form messages only within 24 hours of the customer's last message. Outside that window you may only send pre-approved template messages. An auto-responder replying immediately to inbound messages always operates inside the window, so this rule mostly matters for follow-ups.
How do I stop the AI from making things up?
Constrain it in the system prompt: give it your real business information, instruct it to answer only from that information, and tell it to hand off to a human when unsure. Route uncertain or sensitive intents to escalation instead of letting the model improvise. Log every conversation so you can audit what it said.
What does running this cost per month?
Three small line items: your n8n instance (a few dollars self-hosted), model API calls (a few cents per conversation with a small model), and WhatsApp conversation fees after Meta's free tier. A support bot handling a few hundred conversations per month typically costs less than a single support hour.