WhatsApp AI Sales Agent for Small Business (No Code)
Build an AI sales agent on your WhatsApp number with n8n and Chatmaid: it answers leads, asks qualifying questions, remembers chats and sends your booking link.

A WhatsApp sales agent is an AI assistant that answers new leads on your business number, asks a few qualifying questions, offers a booking link and alerts your team when a person should step in. You can build one without programming. Chatmaid Developers links your own WhatsApp number and sends a webhook to n8n for every message a customer writes. n8n reads the conversation so far from Google Sheets, asks an AI model for a reply and sends it back through Chatmaid. You add nodes, fill in fields and paste three prepared snippets.
Customers ask questions at 11pm, on weekends and during your meetings. A lead who waits until morning may already have written to someone else. The agent covers that first conversation, so your team starts with qualified people instead of a cold inbox. Every step below uses Chatmaid, n8n and OpenAI as they work in October 2026.
What the agent does
The agent handles the top of the funnel:
- Welcomes new contacts with a greeting in your brand's voice
- Qualifies the lead with a few questions (need, timeline, budget, location: adapt them to your business)
- Answers common questions from the facts you give it
- Collects details such as the customer's name and what they want
- Offers a call with your booking link (Calendly or similar)
- Hands off to a person when the lead is ready or asks something the agent can't answer
By the time someone on your team steps in, the lead has explained what they need and has your booking link.
Example conversations by industry
Real estate
A prospect writes to your agency at 10pm:
"Hi, I saw your listing for the apartment in Miraflores. Is it still available?"
The agent answers right away with the facts you gave it:
"Hi! Yes, the Miraflores apartment is still available. It's 2 bedrooms, 85 m², asking $185,000. Are you buying to live there or as an investment? And what's your timeline?"
It goes on to budget, financing and a time to visit. In the morning your team has a short profile of the buyer and, if they used the link, a booked showing. For a deeper version, see how to build a WhatsApp chatbot for real estate lead qualification.
Legal services
A potential client writes about a contract dispute. The agent explains which practice areas the firm covers, asks for the basic facts, and offers a paid consultation slot.
E-commerce and delivery
A customer asks where their order is. Add one more HTTP Request node that looks the order up in your store's system, and the agent can reply with the tracking status and flag problems to your team. How to build a WhatsApp order tracking bot covers that part.
How the workflow fits together
Customer writes on WhatsApp
-> Chatmaid sends a signed message.received webhook
-> n8n checks the signature
-> n8n reads this customer's history from Google Sheets
-> n8n asks the AI model for a reply
-> n8n sends the reply through Chatmaid
-> n8n saves the exchange to Google Sheets
-> n8n alerts your team if the lead needs a personYou need:
- A Chatmaid Developers account. The sandbox (
sk_test_keys) is free and simulates sends. Real customer messages need a live key (sk_live_), which needs an active subscription. - n8n, on n8n Cloud or self-hosted. Chatmaid only accepts HTTPS webhook URLs, so a self-hosted instance must be reachable over HTTPS.
- An OpenAI API key (or a key for another model provider).
- A Google account for the Sheets history.
If you would rather write the agent in your own code than in n8n, how to connect an AI agent to WhatsApp shows the same flow with the API directly.
Step 1: Set up Chatmaid
- Create an account from the Chatmaid Developers page. Chatmaid links your own number with a QR scan, with no Meta Business verification or template approval (how that works). The dashboard starts in Test Mode.
- On the Phone Numbers page, click Add Number, then Connect. In Test Mode the number connects without a QR code, costs nothing and only simulates sends, which is all you need while you build.
- On the API Keys page, create a test key. New keys get the
messages:sendandmessages:readscopes by default. Copy the key when it's shown; the dashboard won't show it again.
Test Mode numbers never receive messages, so Chatmaid has nothing to send to your webhook yet. You connect the webhook when you go live in Step 5.
Step 2: Create the history sheet
Make a Google Sheet with a tab named Conversations. Type only the header row; n8n adds the rest. A filled sheet looks like this:
| phone | receivedAt | customer | agent |
|---|---|---|---|
| +15557654321 | 2026-10-19T22:04:11.000Z | Hi, is the Miraflores apartment still available? | Hi! Yes, it's still available... |
Each row is one turn: what the customer wrote and what the agent answered.
Step 3: Build the n8n workflow
The names in quotes are node names. The expressions refer to them, so use the same names or update the expressions.
Node 1: "Webhook"
Add a Webhook node with HTTP Method POST, Path chatmaid and Respond Immediately. Responding immediately sends Chatmaid a 2xx right away, and the rest of the workflow runs after that. Note the node's Production URL; you paste it into Chatmaid in Step 5. It only receives events while the workflow is published.
n8n puts the request body under body, so the expressions below start with $json.body.
Node 2: "Verify Signature" (Code node)
Anyone who learns your webhook URL could post fake messages to it, and the workflow would answer them from your number. Add a Code node and paste the Verify Signature code from the n8n customer service guide. It checks the X-Chatmaid-Signature header and stops the run when the signature is wrong. You fill in WEBHOOK_SECRET with your whsec_ secret in Step 5. On self-hosted n8n, allow the crypto module with NODE_FUNCTION_ALLOW_BUILTIN=crypto.
Node 3: "Customer Text Only" (If node)
Every event you subscribe to arrives at this URL, including the dashboard's test event. Group messages also arrive as message.received, and photos or voice notes arrive with a type other than text. Add an If node with one condition, put this expression in the value field, and choose the Boolean operator is true:
{{ $json.body.event === 'message.received' && $json.body.data.isGroup === false && $json.body.data.type === 'text' }}The false output is used later, for voice notes and photos.
Node 4: "Extract" (Edit Fields node)
Add an Edit Fields (Set) node with these fields:
phone:{{ $json.body.data.from }}message:{{ $json.body.data.content }}messageId:{{ $json.body.data.messageId }}receivedAt:{{ $json.body.data.receivedAt }}
from is the customer's number in E.164 format, such as +15557654321. messageId is Chatmaid's ID for the inbound message.
Node 5: "Get History" (Google Sheets node)
Add a Google Sheets node with the Get Row(s) operation on your Conversations tab:
- Filters: column
phone, value{{ $json.phone }} - Leave the option Return only First Matching Row off, so n8n returns every row for this customer. (Older n8n versions name it When Filter Has Multiple Matches; set it to Return All Matches.)
- In the node's Settings, turn on Always Output Data. A first-time customer has no rows, and without this setting the workflow would stop here.
Node 6: "Build Prompt" (Code node)
Add a Code node in Run Once for All Items mode and paste this. Edit the text inside SYSTEM_PROMPT for your business; leave the rest as it is.
const SYSTEM_PROMPT = `You are Sofia, a friendly sales assistant for [Your Company] on WhatsApp.
Your job is to welcome new leads, learn what they need, and help them book a call.
About us: [two or three sentences on what you sell, your prices and where you work]
Ask these questions one at a time, in a natural way:
- What brings you here today?
- What is your timeline?
- What budget range do you have in mind?
When you know their need, timeline and budget, offer a call with this link: [your booking link]
If you are not sure of an answer, or the customer asks for a person or writes HUMAN, AGENT or HELP,
tell them that one of our specialists will follow up with them here.
If someone asks whether you are a person, say you are [Your Company]'s AI assistant and offer
to pass them to a specialist. Never promise discounts, prices or dates that are not written above.
Reply in the language the customer writes in. Keep replies to 2 to 4 sentences: WhatsApp is not email.
Answer in JSON. "reply" is the WhatsApp message to send. Set "handoff" to true when you offer
the booking link or pass the customer to a specialist, and to false otherwise.`;
const incoming = $('Extract').first().json;
// Rows from "Get History", oldest first. A new customer gives one empty row.
const history = $input.all()
.map((item) => item.json)
.filter((row) => row.customer && row.agent)
.slice(-10)
.flatMap((row) => [
{ role: 'user', content: String(row.customer) },
{ role: 'assistant', content: String(row.agent) },
]);
const messages = [
{ role: 'developer', content: SYSTEM_PROMPT },
...history,
{ role: 'user', content: incoming.message },
];
return [{ json: { messages } }];This keeps the last 10 turns, which is enough for the agent to remember what it already asked.
Node 7: "AI Reply" (HTTP Request node)
Add an HTTP Request node:
- Method: POST
- URL:
https://api.openai.com/v1/chat/completions - Authentication: Generic credential type, Header Auth. Name
Authorization, valueBearerfollowed by your OpenAI key. - Send Body: on, Body Content Type JSON, Specify Body Using JSON
Switch the JSON field to Expression (hover over it and choose Expression), then paste this:
{
"model": "gpt-6-luna",
"reasoning_effort": "low",
"messages": {{ JSON.stringify($json.messages) }},
"response_format": {
"type": "json_schema",
"json_schema": {
"name": "sales_reply",
"strict": true,
"schema": {
"type": "object",
"properties": {
"reply": { "type": "string" },
"handoff": { "type": "boolean" }
},
"required": ["reply", "handoff"],
"additionalProperties": false
}
}
}
}As of October 2026, gpt-6-luna is the model OpenAI lists as the replacement for GPT-4o mini, which shuts down on January 14, 2027 (OpenAI deprecations). It supports structured outputs, so the reply always comes back as the two fields above, whatever language the customer writes in. A low reasoning effort keeps replies quick. If you pick a model without reasoning, delete the reasoning_effort line.
Node 8: "Parse Reply" (Edit Fields node)
OpenAI returns the JSON as text in choices[0].message.content. Add an Edit Fields (Set) node that unpacks it:
reply(String):{{ JSON.parse($json.choices[0].message.content).reply }}handoff(Boolean):{{ JSON.parse($json.choices[0].message.content).handoff }}
Node 9: "Send Reply" (HTTP Request node)
Add another HTTP Request node:
- Method: POST
- URL:
https://developers-api.chatmaid.net/v1/messages/send - Authentication: Generic credential type, Header Auth. Name
Authorization, valueBearer sk_test_xxxwhile you build, then yoursk_live_key. - Send Body: on, Body Content Type JSON, Specify Body Using Fields Below
| Name | Value |
|---|---|
| fromPhoneId | +15551234567 |
| to | {{ $('Extract').first().json.phone }} |
| content | {{ $('Parse Reply').first().json.reply }} |
| idempotencyKey | {{ $('Extract').first().json.messageId }} |
fromPhoneId is your connected number in E.164 format, or its ID from GET /v1/phone-numbers. A test key only sends from the number you added in Test Mode, and a live key only from your live number.
Chatmaid retries a webhook delivery that fails, so the same message can reach n8n twice. With idempotencyKey set to the inbound message ID, Chatmaid returns the reply it already sent instead of sending a second one.
Node 10: "Save History" (Google Sheets node)
Add a Google Sheets node with Append Row on the same tab, mapping each column manually:
| Column | Value |
|---|---|
| phone | {{ $('Extract').first().json.phone }} |
| receivedAt | {{ $('Extract').first().json.receivedAt }} |
| customer | {{ $('Extract').first().json.message }} |
| agent | {{ $('Parse Reply').first().json.reply }} |
Under Options > Cell Format, choose Let n8n format. The default, Let Google Sheets format, treats values as if you typed them into the sheet, so +15557654321 can turn into a number without its plus sign, and the lookup in Node 5 would stop matching.
Node 11: "Needs Human?" (If node)
Add it after Save History with one condition: the value {{ $('Parse Reply').first().json.handoff }} and the Boolean operator is true.
Node 12: "Notify Team"
On the true output, alert your team with a Slack or Gmail node, or with one more Chatmaid send to a teammate's WhatsApp number. Include the customer's number and their last message, for example:
New lead to follow up: {{ $('Extract').first().json.phone }}
Last message: {{ $('Extract').first().json.message }}
Agent replied: {{ $('Parse Reply').first().json.reply }}The full conversation is in your Conversations sheet, so the person who follows up starts informed.
Voice notes and photos
Leads often send a voice note or a photo instead of typing, and the agent can't read either. So nobody misses them, connect Node 3's false output to another If node with this condition (Boolean, is true):
{{ $json.body.event === 'message.received' && $json.body.data.isGroup === false && $json.body.data.type !== 'text' }}On its true output, add a second Slack, Gmail or Chatmaid node with a short alert such as Voice note or photo from {{ $json.body.data.from }}: answer it from the phone. The message itself waits in WhatsApp on your phone.
Step 4: Test the flow
Test Mode numbers don't receive messages, so Chatmaid won't call your webhook until you go live. Post a sample message to n8n yourself instead. Deactivate Verify Signature for this run, then click Execute workflow at the bottom of the canvas, so n8n listens on the Webhook node's Test URL and runs every node. (Listen for Test Event inside the Webhook node only captures the request.) Post a sample message to that URL:
curl -X POST https://your-n8n-host/webhook-test/chatmaid \
-H "Content-Type: application/json" \
-d '{
"event": "message.received",
"timestamp": "2026-10-19T22:04:12.000Z",
"data": {
"messageId": "inmsg_test0001",
"from": "+15557654321",
"to": "+15551234567",
"content": "Hi, is the Miraflores apartment still available?",
"type": "text",
"isGroup": false,
"groupId": null,
"receivedAt": "2026-10-19T22:04:11.000Z"
}
}'With a test key in Send Reply, the send is simulated, so nothing reaches WhatsApp. Check the AI reply and the new row in your sheet. Click Execute workflow again and post a follow-up with a new messageId: the agent should pick up where it left off.
Each message runs the workflow on its own, so a customer who sends three quick lines can get three replies. The prompt's one-question-at-a-time rule keeps them short when that happens.
Step 5: Go live
- Subscribe on the Billing page, switch the dashboard to Live, add your real number on Phone Numbers, and scan the QR code with the WhatsApp app on your phone to link it. Then create a live key.
- On the Webhooks page, paste the Webhook node's Production URL, tick Message Received, and save. Copy the secret the dashboard shows into
WEBHOOK_SECRETin Verify Signature, and turn that node back on. - Switch Send Reply to your
sk_live_key and live number, and publish the workflow. - Write to your connected number from a different phone. Each run shows up in the workflow's Executions tab.
The agent answers every one-to-one text that reaches this number, including friends, suppliers and teammates. Link a number you use for sales, or keep a Skip tab of numbers the agent must not answer and check it before Build Prompt. Add any teammate you alert on WhatsApp to that tab.
Conversation memory: why the agent needs it
Without memory, every message looks like the first one, and the agent asks the same qualifying questions again. The Conversations sheet fixes that. Before each reply, Node 5 fetches this customer's rows and Node 6 adds the last 10 turns to the prompt.
Sheets is fine for a small business. For more traffic, move the history to a database such as Supabase (hosted Postgres); the workflow stays the same apart from Nodes 5 and 10. How to add conversation memory to your WhatsApp AI agent compares Google Sheets with Supabase.
Escalation: when to hand off to a person
Your agent should know its limits. The prompt in Node 6 tells it to pass the customer to a specialist when it isn't sure, or when the customer asks for a person or writes HUMAN, AGENT or HELP. It also offers your booking link once a lead is qualified. In both cases the model sets handoff to true, so Nodes 11 and 12 alert your team without guessing from the wording. If you add a response time to the handoff instruction in the prompt, use one your team can keep.
Pause the agent when a person takes over
When a teammate replies from the phone itself, the agent should stop answering that customer. Chatmaid reports those messages as message.outgoing; messages sent through the API, like the agent's replies, raise message.sent instead. Tick Message Sent From Phone on the Webhooks page. Connect Node 3's false output to a new If node with {{ $json.body.event === 'message.outgoing' && $json.body.data.isGroup === false }}. On its true output, append {{ $json.body.data.to }} (the customer; from is your own number) and {{ $json.body.data.sentAt }} to a Paused tab. Before Build Prompt, look the customer up in that tab and stop if a teammate wrote to them in the last two hours. Build a 24/7 WhatsApp customer service agent with n8n walks through those nodes.
What this costs
| Component | What it does | Cost as of October 2026 |
|---|---|---|
| Chatmaid Developers | Links your WhatsApp number, sends webhooks and replies | Free sandbox; $7.99 a month flat for production |
| n8n Cloud Starter | Runs the workflow | €20 a month billed annually, 2,500 executions a month; or self-host n8n |
| OpenAI gpt-6-luna | Writes the replies | $0.10 per million input tokens and $0.50 per million output tokens |
| Google Sheets | Stores the conversation history | Included with a Google account |
Each webhook Chatmaid delivers starts one n8n execution, so 2,500 executions cover roughly 2,500 incoming messages, fewer if you subscribe to other events too. A reply that sends 2,000 tokens of prompt and history and gets 300 tokens back costs about $0.0004 at those rates, plus any reasoning tokens, which OpenAI bills as output. Prices come from the Chatmaid pricing page, n8n's pricing page and OpenAI's gpt-6-luna model page; check them before you budget.
Customizing the agent's persona
The system prompt in Node 6 is where the personality lives:
- Name: give the agent a name ("Sofia", "Marco", "Alex"); it reads more naturally. The prompt already tells it to say it's an AI assistant if asked; keep that line.
- Tone: match your brand: professional, friendly, casual or formal.
- Language: the line "Reply in the language the customer writes in" lets one agent serve customers in English, Spanish and Portuguese.
- Boundaries: say plainly what the agent must not discuss or promise, such as discounts, legal advice or delivery dates you can't guarantee.
Frequently asked questions
Can the agent book the call itself?
No. It sends your booking link, and the customer picks a time in Calendly or a similar tool. The agent never sees your calendar.
Is this really no code?
You don't write a program. You add nodes in n8n, fill in fields, and paste three prepared snippets: the Verify Signature code, the Build Prompt code, where you only edit the prompt text, and the JSON body for OpenAI.
Can I build it for free?
You can build and test the whole flow with a free Chatmaid test key, which simulates sends; OpenAI bills the model calls even while you test. Answering real customers needs a live key, which comes with the $7.99 a month subscription, plus whatever n8n and your AI provider charge.
How many leads can it handle on n8n Starter?
Each incoming message is one n8n execution, so the Starter plan's 2,500 executions a month cover about 2,500 customer messages. A lead who sends ten messages uses ten executions.
Will customers know they're talking to an AI?
Only if it tells them, so make it. Say so in the greeting, or at least when a customer asks; the prompt in Node 6 includes that rule.
Can my number get banned for using an AI agent?
It's very unlikely with normal use. Restrictions happen when an account behaves like spam, such as unsolicited bulk messages to people who don't have you saved. Only message people who wrote to you first or agreed to hear from you. An agent that only answers inbound messages, like this one, is the normal case.


