The Reality of AI Chatbots in Indian Commerce
Every Indian business wants an AI agent on WhatsApp, but 90% of DIY implementations fail within a week because of two fatal flaws:
- Hallucination Risk: The AI promises unauthorized discounts, misquotes GST rates, or gives conflicting shipping timelines.
- The Endless AI Loop: A frustrated customer cannot reach a human representative when an edge case occurs.
According to Indian retail customer service studies, over 74% of shoppers prefer messaging a business on WhatsApp over phone calls—provided they receive accurate, instant answers.
This guide outlines a deterministic, production-tested architecture that answers 80% of routine inquiries automatically while smoothly routing edge cases to your team.
System Architecture Overview
[Customer on WhatsApp]
│ (Meta Cloud API)
▼
[n8n Webhook Listener] ────▶ [Intent Classifier (Gemini 2.5 Flash)]
│ │
├─ General FAQ ──▶ [Vector KB] ─┼─▶ [Draft Verified Answer]
│ │
└─ Complex / Urgent ────────────┴─▶ [Telegram Human Alert]
Step 1: Webhook Ingestion & Payload Normalization
When a customer sends a WhatsApp message, Meta dispatches an event containing message metadata:
{
"entry": [{
"changes": [{
"value": {
"messages": [{
"from": "919876543210",
"id": "wamid.HBg...",
"text": { "body": "What is your return policy for damaged items?" },
"type": "text"
}]
}
}]
}]
}
In n8n, create a Code Node that extracts clean variables:
const msg = $input.first().json.entry[0].changes[0].value.messages[0];
return [{
json: {
customer_phone: msg.from,
customer_message: msg.text.body,
message_id: msg.id,
timestamp: new Date().toISOString()
}
}];
Step 2: Grounding with Knowledge Base Embeddings
Never prompt an LLM to answer from open memory. Instead, supply relevant SOP chunks via semantic retrieval:
- Store your verified company policies (returns, pricing, delivery zones, GST rules) in markdown documents.
- In n8n, connect an In-Memory Vector Store or Supabase pgvector instance.
- Query the store using text embeddings (
text-embedding-004) to retrieve the 3 most relevant policy paragraphs.
Is this starting to feel like a lot?
Let us handle the busy work. LoomVector builds and ships this exact kind of system for Indian SMBs, end to end.
Step 3: The Deterministic System Prompt
Pass the customer message and retrieved context into Gemini 2.5 Flash with this hardened system prompt:
You are the official customer service assistant for [Company Name] in India.
Your goal is to answer customer questions accurately, politely, and concisely (under 60 words).
RULES:
1. Use ONLY the facts in the CONTEXT below. Never invent shipping dates, prices, or policies.
2. If the user asks about an order issue, refund, or custom quote not covered in CONTEXT, output:
"[ESCALATE_TO_HUMAN]: I want to make sure this is handled correctly. Let me connect you with a specialist right away."
3. Quote all prices in Indian Rupees (₹).
4. No robotic filler. Do not start with "Hello, thank you for contacting us."
CONTEXT:
{{$json.retrieved_context}}
Step 4: Fallback & Human Agent Handoff
In n8n, follow the LLM node with an IF Node:
- Condition: Does response text contain
[ESCALATE_TO_HUMAN]? - Branch True (Escalation):
- Dispatch a message to the customer: “Connecting you with a team member now. Please hold on.”
- Send an instant Telegram or Slack notification to your support staff:
🚨 Urgent WhatsApp Escalation from +91...: [Customer Message]
- Branch False (Automated Reply):
- POST the answer back to Meta’s
/messagesendpoint.
- POST the answer back to Meta’s
By implementing this circuit breaker, you guarantee 100% brand safety and zero customer frustration while running around-the-clock support for pennies.
<!–[googlesitekit-end-of-content]–>