Tutorial: Build a WhatsApp Chatbot with n8n and Claude in 30 Minutes
Step-by-step guide to building an intelligent WhatsApp chatbot with n8n 2.0 and Claude. Webhook, memory, human escalation.
Tutorial: Build a WhatsApp Chatbot with n8n and Claude in 30 Minutes
WhatsApp has 2.7 billion active users. Here's how to build a functional WhatsApp chatbot with n8n 2.0 and Claude.
What architecture for a WhatsApp chatbot with n8n and Claude?
WhatsApp Business API
↓ webhook
n8n 2.0
├── Receive message
├── AI Agent (Claude)
│ ├── Memory (Redis/Supabase)
│ └── Tools (CRM, FAQ)
└── Send response
↓
WhatsApp (user)
Prerequisites
- n8n v2.0+
- WhatsApp Business API account
- Anthropic API key
- (Optional) Supabase for memory
Step 1: WhatsApp Webhook
- Create an n8n workflow
- Add a "Webhook" node (POST)
- Configure the URL in Meta Business Platform
- Events:
messages,message_status
Step 2: Parse the Message
const body = $input.first().json.body;
const message = body.entry?.[0]?.changes?.[0]?.value?.messages?.[0];
return [{
json: {
from: message?.from,
text: message?.text?.body,
type: message?.type,
messageId: message?.id
}
}];
Step 3: AI Agent
- Add an "AI Agent" node
- Connect "Anthropic Chat Model" (Claude Sonnet or Opus)
- System Prompt: friendly assistant, concise, able to escalate
Step 4: Memory
- "Window Buffer Memory" node
- Session ID: WhatsApp number (
{{ $json.from }}) - Window Size: 10 messages
Step 5: Send Response
{
"method": "POST",
"url": "https://graph.facebook.com/v18.0/PHONE_ID/messages",
"headers": {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
"body": {
"messaging_product": "whatsapp",
"to": "{{ $json.from }}",
"type": "text",
"text": { "body": "{{ $json.output }}" }
}
}
Step 6: Human Escalation
- If response contains "transfer" → Slack notification to support
- If negative sentiment → Automatic escalation
Rate Limiting Anti-Ban
- Delay: min 1 second between messages
- Max: 30 messages/minute
- Window: 24h after last client message
Result
Webhook → Parser → AI Agent → Condition → Send WhatsApp
Your chatbot responds intelligently, remembers context, and escalates when needed. To understand the AI Agent node that powers this chatbot, read our complete guide on n8n AI Agent. And before using a free template, read what can happen.
Want a professional WhatsApp chatbot? At BOVO Digital, we build custom chatbots with conversational AI.
Tags

William Aklamavo
Web development and automation expert, passionate about technological innovation and digital entrepreneurship.
