All posts
Build a WhatsApp bot with TokenBaazar in 20 lines
Guides 10 min read· 12 Jul 2026· By Guides

Build a WhatsApp bot with TokenBaazar in 20 lines

Wire a business WhatsApp number to GPT-5 in under 15 minutes with Twilio + TokenBaazar.

You need three things: a Twilio WhatsApp sandbox, a TokenBaazar key, and a tiny webhook. The whole app fits on your laptop screen.

The webhook#

python
from fastapi import FastAPI, Form
from openai import OpenAI

app = FastAPI()
ai = OpenAI(api_key="sk-tb-...", base_url="https://tokenbaazar.in/api/public/v1")

@app.post("/wa")
def wa(Body: str = Form(...)):
    r = ai.chat.completions.create(
        model="gpt-5.4-mini",
        messages=[{"role": "user", "content": Body}],
    )
    return {"reply": r.choices[0].message.content}

Point Twilio's inbound webhook at /wa. Every message from your customers now round-trips through GPT-5.4 Mini.

Adding memory#

Store the last N turns per WhatsApp number in a small Redis or SQLite. See multi-turn memory patterns.

WhatsApp chatbot screenshot
Cost: about ₹0.50 per 100 messages on Gemini 3 Flash, or ₹2.00 on GPT-5.4 Mini.

Ready to build?

Grab a key, keep your OpenAI SDK, and pay in INR.

Start free