Bot for Gate Africa formally Ajo
# WhatsApp Thrift Bot π¬π°
A fully automated WhatsApp bot that manages thrift (ajo/esusu) contributions and payouts using Node.js and MongoDB. Built for savings groups to automate deposits, withdrawals, contribution tracking, group management, and rotation logic β all via WhatsApp chat.
---
## π¦ Features
- β
**User Registration and Login** via WhatsApp
- π **Session-based Authentication** with JWT tokens
- π₯ **Group Management** - Create, join, and manage thrift circles
- π΅ **Deposit Handling** with Auto Bank Details
- π§Ύ **Thrift Contribution Tracking** (per cycle/user)
- π **Weekly Rotation Logic** (automatic turn-taking)
- πΈ **Withdrawal Requests** with Auto-Payouts
- π **Withdrawal Limit/Approval Thresholds**
- π **Webhook Support** for Payment Confirmations
- π§ **MongoDB models** for persistent storage
- π± **WhatsApp Business API** integration
- π **Real-time Notifications** and reminders
- π **Transaction History** and reporting
---
## π οΈ Tech Stack
- **Platform**: Node.js
- **Database**: MongoDB (via Mongoose)
- **WhatsApp API**: WhatsApp Business API
- **Session/Auth**: JWT tokens with session management
- **API/Webhook**: Express.js
- **Payment Processing**: Paystack integration
- **Security**: Helmet, CORS, Rate limiting
---
## ποΈ Project Structure
```
whatsapp-thrift-bot/
βββ controllers/ # Request handlers for thrift, auth, group etc.
β βββ authController.js
β βββ groupController.js
β βββ thriftController.js
β βββ transactionController.js
β βββ webhookController.js
β
βββ models/ # MongoDB schemas
β βββ User.js
β βββ Group.js
β βββ Thrift.js
β βββ Contribution.js
β βββ Rotation.js
β βββ Transaction.js
β
βββ services/ # Core business logic
β βββ authService.js
β βββ thriftService.js
β βββ payoutService.js
β βββ notificationService.js
β
βββ utils/ # Helper functions
β βββ sessionManager.js
β βββ tokenGenerator.js
β βββ bankUtils.js
β βββ dateUtils.js
β
βββ routes/ β¦