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/ …