This comprehensive guide covers everything you need to install, configure, and deploy WhatsApp Group Manager. Follow the sections relevant to your use case.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/jevil25/whatsapp-waha-dashboard/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before installing WhatsApp Group Manager, ensure you have the following:Required Software
Node.js 18+
pnpm
MongoDB
WAHA Server
Required Services
MongoDB Database
MongoDB Database
- Create a free account at MongoDB Atlas
- Create a new cluster (free tier available)
- Add your IP to the whitelist (or allow access from anywhere for development)
- Create a database user with read/write permissions
- Get your connection string (looks like
mongodb+srv://user:pass@cluster.mongodb.net/dbname)
WAHA (WhatsApp HTTP API)
WAHA (WhatsApp HTTP API)
http://localhost:3000) and API key for configuration.Mailgun Account
Mailgun Account
- Sign up at Mailgun
- Verify your email domain (or use sandbox domain for testing)
- Get your API key from the dashboard
- Note your domain name (e.g.,
mg.yourdomain.com)
Local Development Setup
Install Dependencies
- Install all packages from
package.json - Run the
postinstallscript to generate Prisma client - Set up the development environment
Configure Environment Variables
.env with your actual configuration:Generate Secure Secrets
BETTER_AUTH_SECRET value.Set Up Database
user- User accounts and authenticationsession- User sessionsaccount- OAuth accounts and passwordsWhatsAppSession- WhatsApp connection sessionsWhatsAppGroup- Synced WhatsApp groupsMessageCampaign- Message campaignsMessage- Individual scheduled messagesVerification- Email verification tokens
Start Development Server
Start Message Scheduler
- Runs independently of the Next.js app
- Checks for pending messages every 30 seconds
- Automatically sends messages at scheduled times
- Logs all activity to the console
Production Deployment
Frontend Deployment (Vercel)
Deploy the Next.js application to Vercel for optimal performance:Import to Vercel
- Visit Vercel
- Click “Add New Project”
- Import your GitHub repository
- Configure project settings:
- Framework Preset: Next.js
- Build Command:
pnpm build(default) - Output Directory:
.next(default)
Backend Scheduler (DigitalOcean VPS)
The message scheduler needs to run on a server 24/7. Here’s how to deploy it to a VPS:Create DigitalOcean Droplet
- Get $200 in credits (referral link)
- Create a new Droplet:
- Distribution: Ubuntu 22.04 LTS
- Plan: Basic ($6/month, 1GB RAM is sufficient)
- Datacenter: Choose closest to your WAHA server
- Authentication: SSH keys recommended (or password for beginners)
Deploy Application
Start with PM2
- Run automatically on server restart
- Restart automatically if it crashes
- Log all activity for monitoring
Updating Production Deployment
To update your production scheduler:Environment Variables Reference
mongodb+srv://username:password@cluster.mongodb.net/database-nameExample: mongodb+srv://admin:pass123@cluster0.mongodb.net/whatsapp-prodhttp://localhost:3000 or https://waha.yourdomain.comabc123xyz789openssl rand -base64 32Example: xK8vN2mP9qR4sT5uV6wX7yZ8aB1cD2eF3gH4iJ5kL6==http://localhost:3001Production: https://your-app.vercel.appkey-xxxxxxxxxxxxxxxxxxxxxxxxFind in: Mailgun Dashboard → Settings → API Keysmg.yourdomain.com or sandboxxxxx.mailgun.orgnoreply@yourdomain.comadmin@yourdomain.com+1234567890trueOptions: true or falseDatabase Schema Overview
The application uses these main collections:User & Authentication
User & Authentication
- user: User accounts with roles (ADMIN, USER, GUEST)
- session: Active user sessions with expiry
- account: Password hashes and OAuth provider data
- verification: Email verification tokens
WhatsApp Connections
WhatsApp Connections
- WhatsAppSession: Connected WhatsApp accounts
sessionName: Unique session identifierphoneNumber: Connected phone numberstatus: CONNECTED or DISCONNECTED
- WhatsAppGroup: Synced WhatsApp groups
groupName: Display namegroupId: WhatsApp group ID
Campaign Management
Campaign Management
- MessageCampaign: Scheduled campaigns
title: Campaign nametemplate: Message template with placeholderssendTimeUtc: Scheduled send timestatus: DRAFT, SCHEDULED, IN_PROGRESS, COMPLETED, CANCELLED, FAILED
- Message: Individual messages to send
content: Processed message contentscheduledAt: When to sendsentAt: When actually sentisSent: Delivery status
Available Scripts
Troubleshooting
Prisma Client Generation Failed
Prisma Client Generation Failed
@prisma/client did not initialize yetSolution:MongoDB Connection Issues
MongoDB Connection Issues
Error connecting to database or ECONNREFUSEDSolutions:- Verify
DATABASE_URLis correctly formatted - For MongoDB Atlas:
- Whitelist your IP address in Network Access
- Check username/password are URL-encoded
- Ensure database user has read/write permissions
- For local MongoDB:
- Ensure MongoDB service is running
- Try
mongodb://localhost:27017/whatsapp-manager
WAHA Connection Failed
WAHA Connection Failed
Cannot connect to WAHA serverSolutions:- Verify WAHA is running:
curl http://localhost:3000/health - Check
WAHA_API_URLpoints to correct address - Verify
WAHA_API_KEYmatches WAHA configuration - Ensure no firewall blocking the connection
Email Sending Fails
Email Sending Fails
Failed to send email or Mailgun errorsSolutions:- Verify Mailgun API credentials are correct
- Check domain is verified in Mailgun dashboard
- Ensure
FROM_EMAILuses your Mailgun domain - For sandbox domain, add recipient email to authorized recipients
Messages Not Sending Automatically
Messages Not Sending Automatically
- Ensure scheduler is running:
pnpm scheduler:start - Check scheduler logs for errors
- Verify scheduled time is in the past (UTC)
- Check WhatsApp session is CONNECTED
- Ensure WAHA server is accessible from scheduler
Port 3001 Already in Use
Port 3001 Already in Use
Port 3001 is already in useSolution:Security Best Practices
- Never commit
.envfile to version control - Use strong, unique secrets for
BETTER_AUTH_SECRETin production - Rotate API keys regularly (Mailgun, WAHA)
- Enable MongoDB authentication and use strong passwords
- Restrict MongoDB network access to your server IPs only
- Use HTTPS for production deployments (Vercel provides this automatically)
- Set up IP whitelisting for WAHA if possible
- Regularly update dependencies with
pnpm update - Monitor logs for suspicious activity
- Backup database regularly (MongoDB Atlas has automated backups)