WhatsApp Bot with API integration, expense tracking, and utility commands.
- Install dependencies:
npm ci- Copy environment file and configure:
cp .env.example .envEdit .env file and set your configuration:
KEEP_ALIVE=trueto enable keep-alive messagesWEBSERVICE_URL- Your API base URLWEBSERVICE_USER- Your API usernameWEBSERVICE_PASSWORD- Your API password
sudo apt install -y chromium-browsernpm run pm2
pm2 startup- Expense Tracking
- Help Command
- Info Command
- Ping Command
- Source Command
- Uptime Command
- Version Command
- QR Code Generator
- API Integration (CRUD Operations)
- Configurable Keep-Alive Messages
- Comprehensive Logging
- Environment Configuration
/help- Show all available commands/ping- Check if bot is responsive/info- Get chat information/source- Get source code repository/uptime- Show bot uptime/version- Show bot version/qr <text>- Generate QR code from text
/api-read-all- Get all records from the API/api-read <ID>- Get a specific record by ID/api-create <phrase> | <number> | <date>- Create a new record/api-update <ID> | <phrase> | <number> | <date>- Update a record/api-delete <ID>- Delete a record by ID
/expenses- Toggle expense tracking in current chat/group/expenses-total- Show total expenses tracked/expenses-reset- Reset all tracked expenses
/qr Hello World
/qr https://github.com/shyland-dev/WA-Bot
/qr Contact: +1234567890
/api-read-all
/api-read 2
/api-create Hello World | 42 | 2024-01-15 10:30:00
/api-update 2 | Updated Text | 99 | 2024-01-16 14:20:00
/api-delete 2
/expenses # Start tracking
15.50 Coffee # Add expense
25.00 Lunch # Add expense
/expenses-total # View total
/expenses-reset # Reset all
| Variable | Description | Default |
|---|---|---|
KEEP_ALIVE |
Enable/disable keep-alive messages | false |
KEEP_ALIVE_CHAT_ID |
WhatsApp chat ID for keep-alive messages | 120363403106512185@g.us |
KEEP_ALIVE_INTERVAL_MINUTES |
Interval between keep-alive messages | 30 |
WEBSERVICE_URL |
Base URL for API integration | https://api.example.com |
WEBSERVICE_USER |
Username for API authentication | user |
WEBSERVICE_PASSWORD |
Password for API authentication | password |