This is a whatsapp bot for a salon that helps users to ask questions about the services offered, prices, book for appointments, Get Mpesa STK Push to pay for booking and get a receipt in return.
# Glow Haven Beauty Lounge – WhatsApp AI Assistant + FastAPI Backend
A FastAPI backend with a WhatsApp chatbot that helps users:
- Create and check bookings
- Optionally initiate M-Pesa STK push and auto-send PDF receipts
- Persist short-term chat memory per WhatsApp user
- Expose MCP tools the LLM can call to interact with your API
- Optional Google Calendar sync for bookings
## Features
- **Booking API:** create/list/get bookings
- **WhatsApp webhook (Twilio):** async bot with MCP tool calls
- **Payments (optional):** STK push, status polling, receipt generation, WhatsApp notification
- **Google Calendar (optional):** auto-create and backfill events
- **Developer-friendly:** auto table creation on startup
## Tech Stack
FastAPI, SQLAlchemy, SQLite (dev), Twilio WhatsApp, OpenAI (chat + tools), MCP tools (HTTP client), ReportLab (PDF), Optional Google Calendar API
## Project Structure
```
app/
├── main.py
├── database.py
├── models.py
├── schemas.py
├── api/
│ ├── bookings.py
│ ├── services.py
│ ├── payments.py
│ ├── receipts.py
│ └── feedback.py
├── whatsapp/
│ ├── webhook.py
│ ├── bot.py
│ ├── client.py
│ └── memory.py
├── mcp_server/
│ └── tools.py
└── utils/
├── mpesa.py
└── pdf_generator.py
```
## Getting Started
### 1) Requirements
- Python 3.11+
- Twilio account (for WhatsApp)
- OpenAI API key
- Optional: M-Pesa Daraja credentials, Google Calendar credentials
### 2) Installation
```bash
pip install -r requirements.txt
```
If missing, create a `requirements.txt` with:
```
fastapi
uvicorn[standard]
sqlalchemy
python-dotenv
pydantic
httpx
openai
mcp
reportlab
google-api-python-client
google-auth
google-auth-httplib2
google-auth-oauthlib
```
### 3) Environment Variables
Create a `.env` file in your project root:
```
OPENAI_API_KEY=sk-...
DATABASE_URL=sqlite:///./glow_haven.db
TWILIO_ACCOUNT_SID=...
TWILIO_AUTH_TOKEN=...
TWILIO_WHATSAPP_NUMBER=whatsapp:+14155238886
API_BASE_URL=
localhost
# Optional M-Pesa
MPESA_CONSUM …