Build a WhatsApp AI Bot for Your Business (India Edition)

Build a WhatsApp AI Bot for Your Business (India Edition)

A practical guide to connecting an LLM to the WhatsApp Business API for customer support or lead qualification in India, with the real AI cost per conversation in rupees.

Author

AICredits Team

Published

17 Jul 2026

Reading time

7 min read

Why WhatsApp is the default channel in India

For most Indian businesses, WhatsApp is not one channel among many — it is where customers already are. Building an AI assistant that replies inside WhatsApp, instead of a separate web widget, meets users where they already message you.

The architecture is simple: Meta's WhatsApp Business Platform receives the customer's message via webhook, your backend generates a reply with an LLM, and you send it back through the same API. AICredits handles the LLM half — one API key, INR billing, and access to every major model for the reply-generation step.

Architecture overview

Customer sends WhatsApp message
  → Meta Cloud API webhook → your backend
  → Backend calls AICredits (LLM generates reply)
  → Backend sends reply via Meta Cloud API
  → Customer receives response in WhatsApp

You need a Meta WhatsApp Business Platform account (via Meta Business Suite or a BSP like Interakt, Gupshup, or AiSensy) for the messaging leg, and an AICredits key for the AI leg. This post covers the AI leg — check Meta's or your BSP's current rate card for the messaging leg, since conversation pricing varies by category and changes periodically.

Step 1: Receive the webhook

Meta sends an HTTP POST to your webhook URL for every incoming message. A minimal FastAPI handler:

from fastapi import FastAPI, Request
import httpx
from openai import OpenAI
 
app = FastAPI()
client = OpenAI(base_url="https://api.aicredits.in/v1", api_key="sk-your-aicredits-key")
 
@app.post("/webhook")
async def whatsapp_webhook(request: Request):
    body = await request.json()
    entry = body["entry"][0]["changes"][0]["value"]
    if "messages" not in entry:
        return {"status": "ignored"}
 
    message = entry["messages"][0]
    from_number = message["from"]
    text = message["text"]["body"]
 
    reply = client.chat.completions.create(
        model="openai/gpt-4o-mini",
        messages=[
            {"role": "system", "content": "You are a support assistant for [Business Name]. Be concise and helpful."},
            {"role": "user", "content": text},
        ],
    ).choices[0].message.content
 
    await send_whatsapp_message(from_number, reply)
    return {"status": "ok"}

Step 2: Send the reply

WHATSAPP_TOKEN = "your-meta-access-token"
PHONE_NUMBER_ID = "your-phone-number-id"
 
async def send_whatsapp_message(to: str, text: str):
    url = f"https://graph.facebook.com/v20.0/{PHONE_NUMBER_ID}/messages"
    payload = {
        "messaging_product": "whatsapp",
        "to": to,
        "text": {"body": text},
    }
    headers = {"Authorization": f"Bearer {WHATSAPP_TOKEN}"}
    async with httpx.AsyncClient() as http_client:
        await http_client.post(url, json=payload, headers=headers)

What the AI side costs per conversation

Assume a typical support exchange: a 100-token system prompt, 40-token customer message, and a 60-token reply, repeated 3 times in a conversation thread (so context grows each turn).

| Model | Approx. cost per 3-turn conversation | |-------|----------------------------------------| | Gemini 2.0 Flash | under ₹0.05 | | GPT-4o-mini | ~₹0.06 | | DeepSeek V3 | ~₹0.05 | | Claude 3.5 Haiku | ~₹0.35 |

At 1,000 conversations a month, the AI cost alone stays under ₹100 on a cheap model — the WhatsApp messaging fee from Meta or your BSP will typically be the larger line item, not the AI. Budget accordingly and check your BSP's current per-conversation rate before estimating total cost.

Keeping cost under control

Set a per-key budget cap in the AICredits dashboard so a bug that loops on incoming webhooks (Meta retries on timeout) cannot run away. Use a cheap model like Gemini 2.0 Flash or GPT-4o-mini for the first response, and escalate to a stronger model only for messages your prompt classifies as complex.

Frequently Asked Questions

Do I need Meta approval to send WhatsApp messages with an AI bot?

Yes — any business messaging on WhatsApp goes through Meta's WhatsApp Business Platform, which requires business verification. Choose a BSP (Interakt, Gupshup, AiSensy, or similar) if you want a managed onboarding path instead of going direct to Meta.

Which model should I use for a WhatsApp support bot?

Start with a cheap, fast model — Gemini 2.0 Flash or GPT-4o-mini — for the majority of replies. Both handle typical FAQ and order-status queries well at a fraction of the cost of larger models.

Can I pay for the LLM usage in INR while my WhatsApp billing stays with Meta?

Yes. These are separate billing relationships — Meta or your BSP bills for message delivery, and AICredits bills the LLM calls in rupees via your prepaid wallet. There's no dependency between the two.

How do I handle voice notes sent over WhatsApp?

Download the audio via Meta's media API, then transcribe it with openai/whisper-1 or, for Indian languages, sarvam/saarika-v2 through the same AICredits key. See the audio API docs for the full flow.

Get started

AICredits

Build with any AI model. Pay in INR.

One OpenAI-compatible API for every major model, with a prepaid rupee wallet. Top up via UPI — no international credit card, no forex surprises.

Top up via UPI · Prepaid INR wallet · No international card needed

Related Articles

Continue in Docs

Need implementation commands and endpoint details? Go to quickstart or API reference.