WhatsApp Web API with Professional Dashboard - A complete solution for WhatsApp automation with REST API backend and modern React frontend.
Khulafaur Rasyidin - rasyid.in
This project is developed based on the excellent work by Christophe Hubert:
- Original Project: chrishubert/whatsapp-api
- Library Used: whatsapp-web.js
Special thanks to the original creators for their amazing work on the WhatsApp Web API wrapper.
- π¨ Professional Dashboard - Beautiful React frontend with modern UI
- π± Session Management - Easy QR code scanning and session handling via UI
- π¬ Chat Browser - Browse and manage your WhatsApp chats
- βοΈ Message Sender - Send messages directly from the dashboard
- π Webhook Generator - Create webhooks for external integrations
- π― Real-time Updates - Live session status and notifications
- Multi-session support
- Send text, media, location messages
- Group management
- Contact management
- Webhook callbacks
- Rate limiting
- Swagger documentation
- Session management with QR code display
- Chat list browser
- Message composer (text, media, location)
- Webhook management with full documentation
- Professional light theme UI
- Node.js >= 18.0.0
- npm or yarn
# Clone the repository
git clone https://github.com/idhin/Whatsapp-Services.git
cd Whatsapp-Services
# Install all dependencies (backend + frontend)
npm run install:all
# Or install separately
npm install
cd frontend && npm installCreate a .env file in the root directory:
# ============================================
# PORT CONFIGURATION
# ============================================
# You can use either PORT or BACKEND_PORT (both work)
PORT=3001 # Backend API port (backward compatible)
BACKEND_PORT=3001 # Alternative name (recommended for clarity)
FRONTEND_PORT=5173 # Frontend dashboard port
# ============================================
# API SECURITY
# ============================================
API_KEY=your_api_key_here # Optional: Global API key for authentication
# ============================================
# WEBHOOK CONFIGURATION
# ============================================
# Base URL for webhook callbacks
BASE_WEBHOOK_URL=http://localhost:3001/localCallbackExample
# Per-session webhook (optional)
# Format: {SESSIONID}_WEBHOOK_URL
# Example: MYSESSION_WEBHOOK_URL=https://your-server.com/webhook
# ============================================
# FEATURE FLAGS
# ============================================
ENABLE_LOCAL_CALLBACK_EXAMPLE=TRUE # Enable local callback example endpoint
ENABLE_SWAGGER_ENDPOINT=TRUE # Enable Swagger API docs at /api-docs
SET_MESSAGES_AS_SEEN=FALSE # Auto-mark messages as read
# ============================================
# CALLBACK SETTINGS
# ============================================
# Disable specific callbacks (pipe-separated)
# Options: message, qr, authenticated, ready, disconnected, message_ack, message_reaction
DISABLED_CALLBACKS=message_ack|message_reaction
# ============================================
# FILE & RATE LIMITING
# ============================================
MAX_ATTACHMENT_SIZE=5000000 # Max attachment size in bytes (5MB)
RATE_LIMIT_MAX=1000 # Max requests per window
RATE_LIMIT_WINDOW_MS=1000 # Rate limit window in milliseconds
# ============================================
# WHATSAPP WEB VERSION (Advanced)
# ============================================
# WEB_VERSION=2.2328.5 # Pin specific WhatsApp Web version
# WEB_VERSION_CACHE_TYPE=none # Cache type: none, local, or remote
# RECOVER_SESSIONS=TRUE # Auto-recover sessions on startupImportant Notes:
- Backward Compatible: Old
.envfiles usingPORTstill work! - No Hardcoded Ports: Frontend automatically connects to backend using the port you set
- Per-Session Webhooks: You can set different webhooks for each session
Option 1: Run Both (Recommended)
npm run dev:allOption 2: Run Separately
# Terminal 1 - Backend
npm start
# Terminal 2 - Frontend
cd frontend && npm run dev- Dashboard: http://localhost:5173 (or your
FRONTEND_PORT) - API: http://localhost:3001 (or your
BACKEND_PORT) - Swagger Docs: http://localhost:3001/api-docs
The easiest way to deploy is using Docker Compose, which runs both backend and frontend containers:
# 1. Create .env file (if not exists)
cat > .env << 'EOF'
BACKEND_PORT=3001
FRONTEND_PORT=5173
ENABLE_LOCAL_CALLBACK_EXAMPLE=TRUE
ENABLE_SWAGGER_ENDPOINT=TRUE
EOF
# 2. Build and start both services
docker-compose up -d --build
# 3. View logs
docker-compose logs -f
# Stop services
docker-compose downAccess Points:
- Frontend: http://localhost:5173 (or your
FRONTEND_PORT) - Backend API: http://localhost:3001 (or your
BACKEND_PORT)
Changing Ports:
Simply edit .env file and change BACKEND_PORT and/or FRONTEND_PORT, then run docker-compose up -d --build
For production environments with an existing nginx server, use separate domains:
1. Update DNS Records
dashboard.yourdomain.com β Your Server IP
api.yourdomain.com β Your Server IP
2. Create .env file
Make sure you have a .env file in the project root:
cat > .env << 'EOF'
BACKEND_PORT=3001
FRONTEND_PORT=5173
BASE_WEBHOOK_URL=https://api.yourdomain.com/localCallbackExample
ENABLE_LOCAL_CALLBACK_EXAMPLE=FALSE
ENABLE_SWAGGER_ENDPOINT=TRUE
MAX_ATTACHMENT_SIZE=5000000
DISABLED_CALLBACKS=message_ack|message_reaction
EOF3. Configure External Nginx
Copy the example configuration:
sudo cp nginx-example.conf /etc/nginx/sites-available/whatsapp-services
sudo nano /etc/nginx/sites-available/whatsapp-services
# Update the following:
# - server_name values (dashboard.yourdomain.com and api.yourdomain.com)
# - proxy_pass ports if you changed them in .env
# * Frontend: proxy_pass http://localhost:5173 (or your FRONTEND_PORT)
# * Backend: proxy_pass http://localhost:3001 (or your BACKEND_PORT)Enable the site:
sudo ln -s /etc/nginx/sites-available/whatsapp-services /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx4. Start Docker Containers
docker-compose up -d --build5. Setup SSL (Optional but Recommended)
# Install certbot
sudo apt install certbot python3-certbot-nginx
# Get SSL certificates
sudo certbot --nginx -d dashboard.yourdomain.com
sudo certbot --nginx -d api.yourdomain.com
# Auto-renewal is configured automaticallyAccess Points:
- Frontend: https://dashboard.yourdomain.com
- Backend API: https://api.yourdomain.com
# Build only
docker-compose build
# Start in foreground (see logs)
docker-compose up
# Start in background
docker-compose up -d
# View logs
docker-compose logs -f backend
docker-compose logs -f frontend
# Restart specific service
docker-compose restart backend
docker-compose restart frontend
# Stop all services
docker-compose down
# Remove volumes (WARNING: deletes session data)
docker-compose down -vCreate .env file in project root for production:
# Backend
PORT=3000
API_KEY=your_secure_api_key_here
BASE_WEBHOOK_URL=https://api.yourdomain.com/localCallbackExample
ENABLE_LOCAL_CALLBACK_EXAMPLE=FALSE
ENABLE_SWAGGER_ENDPOINT=TRUE
MAX_ATTACHMENT_SIZE=5000000
# Frontend
NODE_ENV=production# Pull latest changes
git pull origin main
# Rebuild and restart
docker-compose up -d --build
# Check if containers are running
docker-compose psContainer won't start:
docker-compose logs backend
docker-compose logs frontendReset everything:
docker-compose down
docker-compose up --build --force-recreateCheck container status:
docker ps
docker stats- Open the Dashboard at http://localhost:5173
- Enter a Session ID (e.g., "MYSESSION")
- Click "Start Session"
- Scan the QR code with WhatsApp mobile app
- Go to "Send Message" page
- Select your active session
- Enter Chat ID (format:
6281234567890@c.usfor personal,120363...@g.usfor groups) - Type your message and send
Option 1: Using Dashboard (Recommended)
- Go to "Webhooks" page
- Create a new webhook with target chat
- Use the generated URL in your external applications
- Send POST requests with
{ "message": "your text" }
Option 2: Using Per-Session Webhook (via .env)
Add to your .env file:
# Replace MYSESSION with your actual session ID
MYSESSION_WEBHOOK_URL=https://your-server.com/webhookThen all messages from that session will be sent to your webhook URL.
| Method | Endpoint | Description |
|---|---|---|
| GET | /session/start/:sessionId |
Start a new session |
| GET | /session/status/:sessionId |
Get session status |
| GET | /session/qr/:sessionId |
Get QR code |
| GET | /session/terminate/:sessionId |
End a session |
| Method | Endpoint | Description |
|---|---|---|
| POST | /client/sendMessage/:sessionId |
Send a message |
| GET | /client/getChats/:sessionId |
Get all chats |
| GET | /client/getContacts/:sessionId |
Get all contacts |
| Method | Endpoint | Description |
|---|---|---|
| POST | /groupChat/create/:sessionId |
Create a group |
| GET | /groupChat/getAllGroups/:sessionId |
Get all groups |
| POST | /groupChat/inviteUser/:sessionId |
Invite user to group |
See full documentation at /api-docs endpoint.
whatsapp-services/
βββ server.js # Backend entry point
βββ src/
β βββ app.js # Express app setup
β βββ routes.js # API routes
β βββ sessions.js # Session management
β βββ controllers/ # Route controllers
β βββ utils.js # Utility functions
βββ frontend/ # React dashboard
β βββ src/
β β βββ pages/ # Dashboard pages
β β βββ components/ # Reusable components
β β βββ api/ # API clients
β β βββ context/ # React context
β βββ vite.config.js
βββ docker-compose.yml
βββ Dockerfile
βββ package.json
This project is not affiliated, associated, authorized, endorsed by, or in any way officially connected with WhatsApp or any of its subsidiaries or its affiliates. The official WhatsApp website can be found at https://whatsapp.com.
Use at your own risk. WhatsApp does not allow bots or unofficial clients on their platform.
This project is licensed under the MIT License - see the original LICENSE from the parent project.
Contributions are welcome! Please feel free to submit a Pull Request.
Developed with β€οΈ by Khulafaur Rasyidin
Based on whatsapp-api by Christophe Hubert