A feature-rich WhatsApp chatbot for grocery shopping, order management, and customer support, built with Flask and Python.
This project implements a WhatsApp chatbot that allows users to interact with a grocery store via WhatsApp messages. Users can browse products, manage their cart, place and track orders, view order history, manage their account, and get support—all through a conversational interface.
- Product catalog browsing and search
- Add/remove items to/from cart
- Place, track, and cancel orders
- View order history and credit
- Multi-language support
- Address management
- Admin alerts and seller management
- Rate limiting and user context management
- Integration with MySQL database
- Modular, testable codebase
- The backend is built with Flask, exposing endpoints to receive and process WhatsApp webhook events.
- Incoming messages are parsed and routed to appropriate handlers based on user intent (e.g., catalog, cart, order, help).
- User and order data are stored in a MySQL database.
- The bot supports both text and button-based interactions, providing a rich conversational experience.
- Admin and seller features allow for alerting and management via the same chat interface.
- Environment variables are managed with python-dotenv.
- Designed for end-to-end grocery shopping on WhatsApp, including catalog, cart, and order management.
- Supports both customer and admin/seller workflows in a single bot.
- Modular architecture for easy extension and testing.
- Includes rate limiting, language, and address management for a robust user experience.
- Test suite included for core logic and handlers.
Install all required dependencies using pip:
pip install -r requirements.txtThis will install all necessary packages for running and testing the project.
- Set up your
.envfile with the required environment variables (see.env.exampleif available). - Start your MySQL database and ensure the schema matches
updated_schema_v2.sql. - Run the Flask app:
python app.py
- Configure your WhatsApp webhook to point to your server's endpoint.
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License.