BOVO Digital
BOVO Digital
Tutorials12 min read

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

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

  1. Create an n8n workflow
  2. Add a "Webhook" node (POST)
  3. Configure the URL in Meta Business Platform
  4. 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

  1. Add an "AI Agent" node
  2. Connect "Anthropic Chat Model" (Claude Sonnet or Opus)
  3. System Prompt: friendly assistant, concise, able to escalate

Step 4: Memory

  1. "Window Buffer Memory" node
  2. Session ID: WhatsApp number ({{ $json.from }})
  3. 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

#WhatsApp#Chatbot#n8n#Claude#Tutorial#Automation#API#AI

Take action with BOVO Digital

This article sparked ideas? Our experts guide you from strategy to production.

Related articles