Build a WhatsApp AI Assistant with n8n and OpenAI (No Code)
Most small businesses lose customers in WhatsApp. A question comes in at 11pm, nobody replies until morning, and the customer has already gone to a competitor. You don't need a developer to fix this — you can build a WhatsApp AI assistant with n8n and OpenAI in an afternoon, no code required.
This is the exact setup I use for clients: n8n receives the WhatsApp message, OpenAI drafts the reply, and n8n sends it back. You stay in control of the tone, the knowledge, and when a human takes over.
What you need
- A WhatsApp Business account (free, from the Meta WhatsApp Business app or Meta Business Suite)
- An n8n instance — n8n Cloud (free trial) or self-hosted on a $5 VPS
- An OpenAI API key with a few dollars of credit
- About 2 hours
Step 1: Connect WhatsApp to n8n
In Meta Business Suite, create a WhatsApp Business app and get three things: a Phone Number ID, a permanent access token, and a webhook verify token you invent yourself.
In n8n, create a workflow starting with a Webhook node (POST). Set the webhook URL in your Meta app, using your verify token. Send a test message to your WhatsApp number — you should see the payload arrive in n8n. If the message doesn't arrive, the webhook URL or token is wrong; nothing else in this guide will work until this step does.
Step 2: Extract the message
WhatsApp sends a nested JSON payload. Add a Set node (or a Code node with two lines) to pull out two fields: the sender's phone number (from) and the message text (messages[0].text.body). Ignore status updates like "read" receipts — filter the workflow to only continue when a text body exists.
Step 3: Give the AI a brain (and a personality)
Add an OpenAI node (Chat Model) with a system prompt like this:
You are the support assistant for [your business]. Answer in a friendly, concise tone. You know our opening hours (9am–6pm), our price list, and our delivery areas. If a customer asks something you don't know, say you'll check with the team and ask for their name and order number. Never invent prices or promises.
Keep a short knowledge block in the prompt — hours, top products, delivery info. For a bigger catalog, swap this for a simple Google Sheet the AI can look up, but start with the prompt: it covers 90% of real conversations.
Set temperature to 0.3. You want consistent, reliable answers, not creative ones.
Step 4: Send the reply back
Add an HTTP Request node pointing at the WhatsApp Cloud API messages endpoint (https://graph.facebook.com/v21.0/<phone-number-id>/messages), with your access token in the header, sending the AI's reply to the sender's number. Test it end to end: message the number from your personal phone and watch the reply come back in seconds.
Step 5: Add a human handover
Automation should never trap a frustrated customer. Add a simple rule: if the message contains words like "human", "agent", "complaint", or "refund", skip the AI and send a message saying a team member will reply shortly — plus forward the chat to your own phone via a Telegram or email node. The best bots know when to step aside.
What this costs to run
- WhatsApp Cloud API: free for the first 1,000 service conversations per month
- OpenAI: roughly $0.002–$0.01 per reply with GPT-4o-mini
- n8n Cloud: from $20/month, or ~$5/month self-hosted
For most small businesses, the whole setup runs for less than a lunch per month.
Common mistakes
- Letting the AI freestyle. Without a knowledge block in the prompt, it will invent opening hours and prices. Pin the facts down.
- No handover path. Every bot needs an escape hatch to a human.
- Replying to everything. Filter out status webhooks and group messages, or you'll burn API credit on noise.
- Forgetting the 24-hour rule. WhatsApp only lets you freely reply within 24 hours of the customer's last message. After that you need an approved template message.
Want it done for you?
If you'd rather skip the setup, I build exactly this — WhatsApp AI assistants and n8n automations — as a service on Fiverr:
- WhatsApp AI chatbot: http://www.fiverr.com/s/BbbNRGG
- n8n / Make automation workflows: http://www.fiverr.com/s/d0010Yg
Or start with the Telegram version of this setup — I wrote a step-by-step guide for deploying an OpenClaw assistant on a VPS with Telegram: https://dev.to/caelum7/deploy-openclaw-on-a-vps-with-telegram-a-step-by-step-guide-ibf
Questions about the setup? Drop them in the comments — I answer every one.
Top comments (0)