cd /news/artificial-intelligence/build-an-ai-whatsapp-customer-servic… · home topics artificial-intelligence article
[ARTICLE · art-74445] src=dev.to ↗ pub= topic=artificial-intelligence verified=true sentiment=↑ positive

Build an AI WhatsApp Customer Service Bot with n8n (No Code, 30 Minutes)

A developer built a no-code AI WhatsApp customer service bot using n8n that classifies messages into intents via GPT-4o-mini, handles replies automatically, and escalates urgent issues via Telegram. The workflow costs about $0.46/month for 100 messages per day and can be set up in 30 minutes.

read3 min views1 publishedJul 26, 2026

Your WhatsApp Business account receives a message at 11pm. It's a potential client asking about your services. By the time you see it tomorrow morning, they've already bought from a competitor.

This tutorial shows you how to build a 24/7 AI-powered WhatsApp customer service bot using n8n that:

No coding required. Setup time: ~30 minutes.

The workflow has 9 nodes and follows a simple decision tree:

WhatsApp webhook → Parse message → Classify intent (GPT-4o-mini)
       ↓
   URGENT? → Yes → Telegram alert + log
       ↓ No
   Generate AI reply → Send via WhatsApp API → Log to Sheets → Respond 200

The OpenAI node classifies each message into one of four intents:

URGENT

— complaints, cancellation threats, problems ("the product arrived broken")INFO

— general questions ("what are your hours?", "do you deliver to Madrid?") BOOKING

— appointment requests ("I'd like to book for Friday at 5pm")OTHER

— anything elseThis is the key logic that decides whether you get woken up or the bot handles it silently.

Go to developers.facebook.com, create an app, add WhatsApp product, and get:

my_verify_token_2026

)Set up the webhook to point to your n8n instance:

Webhook URL: https://your-n8n.com/webhook/whatsapp-bot
Subscribed fields: messages

Configure as POST, path: whatsapp-bot

. The webhook also needs to handle GET requests for Meta's verification challenge — add a second route or use an IF node to detect the hub.challenge

parameter.

All settings live in one Code node at the top:

const CONFIG = {
  // WhatsApp
  wa_phone_id: "YOUR_PHONE_NUMBER_ID",
  wa_token: "YOUR_WHATSAPP_ACCESS_TOKEN",

  // Telegram escalation  
  telegram_token: "YOUR_BOT_TOKEN",
  telegram_chat_id: "YOUR_CHAT_ID",

  // Google Sheets
  sheet_id: "YOUR_SPREADSHEET_ID",
  gcp_service_account: "vcWuMisYV6Kfx8Vv", // your n8n credential ID

  // AI context — this is what makes replies feel personalized
  business_name: "Clínica Dental Sánchez",
  business_description: "Clínica dental en Madrid, servicios: limpiezas, ortodoncia, implantes. Horario L-V 9-20h, S 9-14h.",
  escalation_keywords: ["urgente", "problema", "queja", "cancelar", "devolver"],
  openai_credential_id: "bC16OOi5YkUp5C10",

  // Fallback if OpenAI fails
  fallback_reply: "Gracias por tu mensaje. Te responderemos lo antes posible en horario laboral."
};

return [{ json: CONFIG }];

The OpenAI node that generates replies uses this prompt structure:

You are a customer service assistant for {{business_name}}.

Business context: {{business_description}}

Customer message: {{message_text}}
Message intent: {{classified_intent}}

Reply professionally in the same language as the customer's message. 
Keep it under 3 sentences. Don't make up information not in the business context.

This is what makes the bot sound like it actually knows your business — not a generic chatbot.

The HTTP Request node sends back via the Cloud API:

POST https://graph.facebook.com/v19.0/{{wa_phone_id}}/messages
Authorization: Bearer {{wa_token}}
Content-Type: application/json

{
  "messaging_product": "whatsapp",
  "to": "{{sender_phone}}",
  "type": "text",
  "text": { "body": "{{ai_reply}}" }
}

This is the most important node that most tutorials miss.

WhatsApp requires your webhook to respond with HTTP 200 within 20 seconds. If it doesn't, Meta marks your webhook as unhealthy and stops sending events.

Add a Respond to Webhook node at the very end of every branch (urgent AND non-urgent) that returns {"status": "ok"}

with status 200.

Total for a small business with 100 messages/day: ~$0.46/month in AI costs.

Handles well:

Needs human review:

The Telegram escalation handles the "needs human review" bucket automatically.

Customer sends: "Hola, ¿tenéis cita disponible para limpieza este sábado por la mañana?"

Bot replies (in ~3 seconds): "¡Hola! Sí, tenemos citas disponibles los sábados de 9 a 14h. Para reservar, díganos su nombre y el horario preferido y lo gestionamos enseguida."

Customer sends: "El producto que compré llegó roto, exijo una solución AHORA"

Bot triggers Telegram alert to you: 🚨 URGENTE | +34612345678 | "El producto que compré llegó roto, exijo una solución AHORA"

You reply personally. The customer feels heard.

If you want to skip the manual setup, the complete workflow with all nodes pre-configured is available on n8nmarkets.com — search "WhatsApp Telegram AI Customer Service Agent".

It includes the workflow JSON, README with screenshots, and curl commands to test every node before going live.

Built something similar? Share your setup in the comments — especially if you've handled the webhook verification challenge in a clever way.

── more in #artificial-intelligence 4 stories · sorted by recency
── more on @n8n 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/build-an-ai-whatsapp…] indexed:0 read:3min 2026-07-26 ·