How We Built a WhatsApp AI Bot for a an E-Commerce Store Using Claude API
Step-by-step walkthrough with real code, from Claude API setup to live WhatsApp deployment via Twilio and n8n automation.
The Problem
A fashion e-commerce store was receiving 200+ WhatsApp messages daily. 70% were the same 10 questions: order tracking, sizes, returns, delivery times. The team spent 6 hours daily just answering messages. Something had to change.
The Solution: Claude API + Twilio + n8n
We built a fully automated WhatsApp bot using three tools:
- Twilio WhatsApp API, receives and sends WhatsApp messages
- n8n (self-hosted), orchestrates the workflow
- Claude API, the AI brain that understands context and generates responses
Architecture Overview
WhatsApp Message
Twilio Webhook
n8n Workflow
Claude AI
WhatsApp Reply
Step 1: Set Up Twilio WhatsApp Sandbox
Create a Twilio account, enable the WhatsApp sandbox, and note your Account SID and Auth Token. Set your webhook URL to your n8n instance: https://your-n8n.domain.com/webhook/whatsapp.
Step 2: Create the n8n Webhook Workflow
In n8n, create a new workflow with these nodes:
- Webhook node, listens for incoming Twilio POST requests
- HTTP Request node, calls the Claude API
- HTTP Request node, sends reply via Twilio
Step 3: The Claude API Call
{
"model": "claude-opus-4-5",
"max_tokens": 300,
"system": "You are a helpful customer service agent for StyleHub the client, a fashion e-commerce store. You answer questions about orders, sizes, returns, and delivery. Keep responses under 150 words and be friendly. If asked about a specific order number, say you need to verify it and ask them to provide their order number.",
"messages": [
{
"role": "user",
"content": "{{ $json.Body }}"
}
]
}
Results After 30 Days
Want This Built for Your Business?
We build custom WhatsApp AI bots for businesses, reach out for custom pricing. Learn more about our AI chatbot service or book a free demo call.
