This article contains affiliate links. If you buy through them, we may earn a commission at no extra cost to you.
Build a WhatsApp Chatbot in 30 Minutes with n8n
WhatsApp has over 2 billion active users. If your business isn't engaging them automatically, you're leaving response time, leads, and revenue on the table. The good news? You can build a fully functional WhatsApp chatbot using n8n — without writing a single line of code — in under 30 minutes.
This guide walks you through the exact steps to connect WhatsApp to n8n, add AI responses, and deploy a chatbot that works around the clock. Whether you want to qualify leads, answer FAQs, or send automated follow-ups, n8n makes it surprisingly simple.
Why Use n8n for WhatsApp Automation?
n8n is an open-source workflow automation tool that connects hundreds of apps and APIs through a visual node-based editor. Unlike many SaaS tools, n8n can be self-hosted, giving you full control over your data. It's perfect for building messaging bots because:
- No coding required — drag-and-drop workflow builder
- AI-ready — native integrations with OpenAI, Anthropic, and more
- Highly flexible — connect WhatsApp to CRMs, spreadsheets, email, and databases
- Cost-effective — self-host for free or use n8n Cloud
Alternatively, if you prefer a dedicated messaging platform, manychat is another excellent option — especially for marketers who want visual flow builders built specifically for WhatsApp and Instagram. But for developers and power users who want full flexibility, n8n is the winner.
What You'll Need Before Starting
- A Meta Business Account with WhatsApp Business API access (via Meta Developers)
- A phone number approved for WhatsApp Business API
- An n8n account (Cloud or self-hosted)
- An OpenAI API key (optional, for AI-powered replies)
Setting up the WhatsApp Business API via Meta is the most time-consuming part — expect 10–15 minutes for that alone. Once done, connecting it to n8n takes just a few clicks.
Step 1: Set Up Your WhatsApp Webhook in n8n
In your n8n workspace, create a new workflow and add a Webhook node as the trigger. This webhook URL is what Meta will call every time someone messages your WhatsApp number.
- Set the HTTP method to POST
- Copy the generated webhook URL
- Go to your Meta Developer Dashboard → WhatsApp → Configuration
- Paste the n8n webhook URL into the Callback URL field
- Set a Verify Token (any string you choose) and match it in n8n
Once Meta verifies the webhook, your n8n workflow will receive every incoming WhatsApp message in real time.
Step 2: Parse the Incoming Message
WhatsApp messages arrive as JSON payloads. Add a Function node (or Code node) in n8n to extract the key data:
- Sender's phone number
- Message text
- Message ID (for threading)
- Timestamp
This step ensures your n8n workflow knows who sent the message and what they wrote — essential before you generate a reply.
Step 3: Add AI-Powered Responses with OpenAI
This is where the magic happens. Add an OpenAI node in n8n and connect your API key. Use the Chat Completion endpoint and write a system prompt that defines your bot's personality and purpose. For example:
"You are a friendly customer support assistant for [Your Business]. Answer questions about our products, opening hours, and pricing. If you don't know, ask the user to contact support@yourbusiness.com."
Pass the incoming WhatsApp message as the user input. n8n sends it to OpenAI and returns a generated response — all in under 2 seconds.
Step 4: Send the Reply Back via WhatsApp
Add an HTTP Request node in n8n to call the WhatsApp Business API and send the AI-generated reply back to the user. Configure it as follows:
- Method: POST
- URL:
https://graph.facebook.com/v18.0/{phone-number-id}/messages - Headers: Authorization: Bearer {your_access_token}
- Body: JSON with recipient number, message type, and the AI reply text
The n8n workflow now forms a complete loop: receive message → parse → generate AI reply → send back. Test it by messaging your WhatsApp number.
Step 5: Add Logic, Routing, and CRM Integration
A basic chatbot is just the beginning. With n8n you can add powerful logic flows:
- Keyword routing — if message contains "price", trigger a pricing node
- Lead capture — save sender data to Google Sheets, Airtable, or HubSpot
- Escalation — if the AI is unsure, notify a human agent via Slack or email
- Follow-up sequences — use n8n's scheduling nodes to send follow-ups automatically
If you're looking for pre-built conversation flows and marketing-focused features, manychat offers a great visual interface for WhatsApp campaigns. However, for custom logic and deep integrations, n8n gives you unmatched flexibility.
Pro Tips for a Better WhatsApp Chatbot
- Keep responses short — WhatsApp users expect concise, conversational replies
- Use emojis sparingly — they humanise the bot without feeling spammy
- Always offer an exit — let users type "human" to reach a real person
- Log conversations — use n8n to store chats in a database for review
- Test edge cases — send unexpected inputs and refine your AI system prompt
Go Live and Monitor
Once your n8n workflow is tested and activated, set it to production mode. Monitor execution logs inside n8n to catch errors early. Set up error notifications via email or Slack so you're always informed if something breaks.
Your WhatsApp chatbot is now live — handling enquiries, capturing leads, and delivering instant replies 24/7. What took enterprise teams months to build, you just shipped in 30 minutes with n8n.
Final Thoughts
Building a WhatsApp chatbot no longer requires a development team or a hefty budget. With n8n, you get a powerful, flexible automation engine that connects WhatsApp to AI and your entire tool stack. Start simple, iterate fast, and let your bot do the heavy lifting.
Ready to go further? Explore the n8n template library for pre-built WhatsApp automation workflows and launch even faster.
This post was created with tools we use and recommend: n8n for workflow automation, Turbotic as an AI-native automation alternative, ElevenLabs for AI voiceover, Placid for visual content creation, and Hostinger for reliable VPS hosting. Some links are affiliate links.