A WhatsApp bot for splitting expenses, built with Python + Flask + WhatsApp Business Cloud API.
Send commands to the bot in WhatsApp to track shared expenses:
| Command | Description |
|---|---|
/split <amount> |
Splits amount equally among all registered members |
/balances |
Shows what you owe and what others owe you |
/settle |
Marks all your debts as cleared |
Any member who messages the bot is automatically registered in the shared pool.
- Python + Flask (webhook server)
- WhatsApp Business Cloud API (Meta)
- ngrok (local tunnel for development)
- In-memory data store (no database, MVP)
git clone https://github.com/YOUR_USERNAME/splitwala.git
cd splitwala
python -m venv venv
venv\Scripts\activate # Windows
pip install -r requirements.txtCreate a .env file (never commit this):
PHONE_NUMBER_ID=your_phone_number_id
WABA_ID=your_waba_id
ACCESS_TOKEN=your_whatsapp_access_token
WEBHOOK_VERIFY_TOKEN=your_chosen_verify_token
Get your credentials from Meta for Developers.
python app.pyngrok http 5000- Go to your Meta app → WhatsApp → Configuration
- Set Callback URL to:
https://your-ngrok-url.ngrok-free.app/webhook - Set Verify Token to match your
WEBHOOK_VERIFY_TOKEN - Subscribe to the
messagesfield
- Each person messages the bot directly (this registers them)
- Anyone can run
/split 500— splits equally among all registered members - Run
/balancesto see the current state - After paying in real life, run
/settleto clear your debts
- Data is in-memory: balances reset if the server restarts
- Works in development mode with up to 5 test numbers (no business verification needed)
- ngrok URL changes on every restart (free plan)