A Bangla-language customer support chatbot built for a fictional online clothing shop, ট্রেন্ডি বাজার (Trendy Bazaar). Built with Flask and Google's Gemini API, it supports text chat, voice chat (speech-to-text and text-to-speech), product image replies, and can be connected to WhatsApp and Messenger as well.
This project was built for a YouTube tutorial. If you're following along from the video, this README explains what the project does and how to run it yourself.
- Text chat — customers can chat in Bangla and get context-aware replies (the bot remembers the last few messages in the conversation).
- Voice chat — customers can send a voice message; it gets transcribed to text, replied to, and the reply is converted back to speech (audio) using Gemini's text-to-speech.
- Product images — if a customer asks about a product category (saree, formal suit, panjabi, formal shoes, women's dress), the bot automatically sends relevant images.
- Fixed shop info (no hallucination) — prices, delivery charges, delivery time, return policy, and the shop's website are hardcoded in the system prompt so the bot never makes up wrong information.
- WhatsApp & Messenger integration — webhook endpoints are included so the same bot can reply to customers directly on WhatsApp and Facebook Messenger.
- Rate limiting — built-in request limits to prevent API abuse/cost overruns.
- Session-based memory — each browser/user session keeps its own separate conversation history (in-memory; resets when the server restarts).
- Backend: Python, Flask
- AI Model: Google Gemini (
gemini-2.5-flashfor chat/transcription,gemini-2.5-flash-preview-ttsfor text-to-speech) - Other libraries:
flask-cors,flask-limiter,python-dotenv,requests
bangla-chatbot/
├── app_gemini.py # Main Flask application
├── requirements_gemini.txt # Python dependencies
├── templates/
│ └── chat.html # Web chat interface
├── static/
│ └── images/
│ ├── sharee/
│ ├── formal/
│ ├── panjabi/
│ ├── shoes_formal/
│ └── w_dress/
├── .env # Your API keys (NOT committed to git)
└── .gitignore
git clone https://github.com/billawithaiml/bangla-chatbot.git
cd bangla-chatbotpython3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activatepip install -r requirements_gemini.txtCreate a .env file in the project root and add:
GEMINI_API_KEY=your_gemini_api_key_here
FLASK_SECRET_KEY=some_random_secret_string
FLASK_DEBUG=FalseYou can get a free Gemini API key from Google AI Studio.
If you also want to connect WhatsApp/Messenger, add these too:
WHATSAPP_TOKEN=your_whatsapp_access_token
WHATSAPP_PHONE_NUMBER_ID=your_whatsapp_phone_number_id
WHATSAPP_VERIFY_TOKEN=your_own_verify_token
MESSENGER_PAGE_TOKEN=your_messenger_page_access_token
MESSENGER_VERIFY_TOKEN=your_own_messenger_verify_tokenpython3 app_gemini.py| Endpoint | Method | Description |
|---|---|---|
/ |
GET | Loads the web chat interface |
/chat |
POST | Send a text message, get a reply (JSON) |
/voice-chat |
POST | Send an audio file, get transcript + reply + audio reply |
/reset |
POST | Clear the current session's conversation history |
/webhook |
GET/POST | WhatsApp webhook (verification + incoming messages) |
/messenger-webhook |
GET/POST | Messenger webhook (verification + incoming messages) |
- Conversation history is stored in memory — it resets whenever the server restarts. For a production deployment, use Redis or a database instead.
- Never commit your
.envfile — it contains your private API keys. This repo's.gitignorealready excludes it. - To connect WhatsApp/Messenger locally, you'll need a tool like ngrok to expose your local server to the internet, since Meta needs a public URL to send webhook requests to.
This is a demo project built for educational purposes. "Trendy Bazaar" is a fictional shop, and all product/pricing info is sample data for demonstration only.
Built by billawithaiml for a YouTube tutorial on building an AI-powered customer support chatbot with Flask and Gemini, on the channel @llmlabofficial.