#DataBased WhatsApp Chatbot
This repository contains a scaffold for a premium BSNL WhatsApp chatbot: FastAPI backend, SQLite DB models, WhatsApp webhook, OTP auth, and stubs for AI, voice, payments, and Fiber flows.
Quick start
- Create a virtual env and install:
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt- Copy environment file and fill keys:
cp .env.example .env
# edit .env to add TWILIO / OPENAI / UPI values- Run the app:
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000WhatsApp webhook
Configure your WhatsApp provider (Twilio / Meta Cloud API) to forward incoming messages to /webhook.
Mermaid workflow (paste into GitHub or Mermaid live editor):
flowchart TD
User-->WhatsAppChatbot
WhatsAppChatbot-->Menu[Main Menu]
Menu-->OTP[OTP Verification]
OTP-->FastAPI
FastAPI-->DB[Database / Services]
DB-->FastAPI
FastAPI-->WhatsAppChatbot
WhatsAppChatbot-->User
subgraph Escalation
UserIssue-->Chatbot
Chatbot-->TicketCreated
TicketCreated-->HumanAgent
end
Files added
app/main.py— FastAPI app + webhook and sample endpointsapp/db.py— SQLModel/SQLite engineapp/models.py— core models (User, Ticket, Transaction)app/services.py— business logic stubsapp/utils.py— OTP + helpersrequirements.txt— Python deps.env.example— env vars template
Next steps
- Wire actual WhatsApp provider credentials
- Implement payment gateway webhook (UPI)
- Integrate OpenAI (or other LLM) for AI chat
- Add voice transcription (Whisper) and multilingual support
If you want, I can now implement the WhatsApp webhook routing for menu flows and OTP end-to-end.