How to Build a Multilingual WhatsApp AI Support Bot for Indian E-Commerce
In the Indian e-commerce landscape, customer communication lives on WhatsApp. However, providing 24/7 support in regional languages—like Hindi, Hinglish, Tamil, or Marathi—often requires expensive human agent teams or rigid, rule-based chatbots that frustrate buyers.
In this tutorial, we will build an intelligent, multi-turn WhatsApp customer support agent that handles order inquiries, returns, and FAQs in multiple Indian languages using Python, Twilio, and Velona's unified AI gateway.
Prerequisites & Architecture
To build this assistant, you will need:
- A Velona Account with a funded wallet (starts at just ₹10 via UPI).
- A Twilio Sandbox account for WhatsApp messaging.
- Python 3.10+ installed locally or on a cloud server (FastAPI + Uvicorn).
Access a few source code on GitHub: velona-in/whatsapp-ai-support-bot
Step 1: Set Up Your Velona Gateway & Wallet
Before making API calls, complete your initial setup:
- Sign in to your Velona Wallet Dashboard and top up ₹10 or more using GPay, PhonePe, or RuPay.
- Navigate to API Key Management and create a new production key.
- Set a monthly spending budget on the key to prevent unexpected API consumption.
Step 2: Build the FastAPI Webhook Backend
When a customer messages your WhatsApp business number, Twilio sends an HTTP POST webhook to your server. We will catch this request, process the text with a fast LLM model via Velona, and return a response back to WhatsApp.
from fastapi import FastAPI, Form, Response
from twilio.twiml.messaging_response import MessagingResponse
import requests
app = FastAPI()
VELONA_API_KEY = "YOUR_VELONA_API_KEY"
VELONA_ENDPOINT = "https://velona.in/gateway/v1/inference/run"
SYSTEM_PROMPT = """You are an empathetic, polite AI support assistant for 'IndiKart E-Commerce'.
Respond in the exact language used by the customer (e.g., English, Hindi, Hinglish, or Tamil).
Keep your answers under 3 sentences suitable for WhatsApp messaging."""
@app.post("/whatsapp")
async def whatsapp_webhook(Body: str = Form(...), From: str = Form(...)):
# Prepare payload for Velona Gateway
headers = {
"Authorization": f"Bearer {VELONA_API_KEY}",
"Content-Type": "application/json"
}
payload = {
"model": "meta/llama-3.1-70b-instruct",
"turns": [
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": Body}
]
}
# Call Velona AI Gateway
res = requests.post(VELONA_ENDPOINT, json=payload, headers=headers)
ai_response = res.json()["choices"][0]["message"]["content"]
# Formulate Twilio WhatsApp Response
twiml = MessagingResponse()
twiml.message(ai_response)
return Response(content=str(twiml), media_type="application/xml")
Step 3: Select the Right Model for Cost & Latency
For customer support bots, response speed and cost per message matter significantly. Instead of overpaying for heavyweight reasoning models, you can choose ultra-fast models like meta/llama-3.1-70b-instruct or google/gemini-flash-1.5 on Velona.
You can compare latency, speed (tokens/sec), and INR pricing across 300+ models on the Velona Model Pricing Index or benchmark performance on the AI Benchmark Leaderboard.
Step 4: Add Persistent Chat History with Velona Memory Sessions
Stateless bots forget what the user said in the previous message. Instead of manually passing long context arrays (which inflates your prompt token costs), attach a Velona Memory Session to the gateway call:
payload = {
"model": "meta/llama-3.1-70b-instruct",
"velona": {
"memory_session": f"mem_user_{From.replace('+', '')}"
},
"turns": [
{"role": "user", "content": Body}
]
}
Velona automatically compresses and injects prior context server-side with zero sub-millisecond latency overhead, cutting your token consumption by up to 60%.
Step 5: Testing & Utility Utilities
When developing webhooks, you often need to format JSON payloads, inspect authorization tokens, or validate regex patterns. You can use Velona's 49 Life Time Free Developer Tools to handle payload debugging completely free without consuming your wallet balance.
Want to test different system prompts live in your browser before deploying? Try the Free Public Chat Playground or compare outputs side-by-side in the Model Evaluator.
Conclusion
By connecting Twilio with Velona's INR-native AI gateway, you can deploy a scalable, multilingual WhatsApp customer support bot in under an hour without worrying about international credit card declines or unpredictable forex fees.
Ready to deploy your AI bot? Sign up for a free Velona account and claim your auto-issued developer key today!