Gate Africa's bot
# π¬π° WhatsApp Thrift Bot
A fully automated WhatsApp bot that manages thrift (ajo/esusu) contributions and payouts using Node.js, MongoDB, and WhatsApp Business API. Built for savings groups to automate deposits, withdrawals, contribution tracking, group management, and rotation logic β all via WhatsApp chat.
## β¨ Key Features
- β
**User Registration & Authentication** via WhatsApp
- π₯ **Complete Group Management** - Create, join, and manage thrift circles
- π΅ **Automated Deposit Handling** with real bank details integration
- π§Ύ **Contribution Tracking** per cycle and user with MongoDB
- π **Automatic Weekly Rotation Logic** with fair turn-taking
- πΈ **Smart Payout System** with bank transfer integration
- π‘οΈ **Security** - JWT tokens, rate limiting, webhook verification
- π± **Real WhatsApp Integration** - Works with actual WhatsApp Business API
- π **Transaction History & Reporting** with detailed analytics
- π **Smart Notifications** and automatic reminders
## π Quick Start
### Prerequisites
- Node.js 16+
- MongoDB (local or cloud)
- WhatsApp Business API access
- Paystack account (for Nigerian payments)
- SSL certificate for webhooks
### 1. Clone & Install
```bash
git clone
cd whatsapp-thrift-bot
npm install
```
### 2. Environment Setup
Copy `.env.example` to `.env` and configure:
```bash
cp .env.example .env
```
**Critical configurations needed:**
```env
# Get from WhatsApp Business API
WHATSAPP_TOKEN=your_permanent_access_token
WHATSAPP_PHONE_NUMBER_ID=your_phone_number_id
WHATSAPP_VERIFY_TOKEN=your_custom_verify_token
# Database
MONGODB_URI=mongodb://localhost:27017/whatsapp-thrift-bot
# Payments (Paystack for Nigeria)
PAYSTACK_SECRET_KEY=sk_live_your_key_here
PAYMENT_WEBHOOK_SECRET=your_webhook_secret
# Security
JWT_SECRET=your_super_secret_key_minimum_32_characters
```
### 3. WhatsApp Business API Setup
**Step-by-step WhatsApp setup:**
1. **Facebook Business Account**: Create at business.facebook.com
2. **WhatsApp Business API**: Go to deve β¦