Overview
WAHA Dashboard implements a robust multi-channel notification system using WhatsApp (primary) and email (fallback) to ensure administrators are always informed of critical events. The system is powered by Mailgun for email delivery and the WAHA API for WhatsApp messaging.Notification Channels
Primary notification channel for real-time alerts
- Instant delivery
- Rich formatting with emojis
- Direct links to admin dashboard
Fallback channel when WhatsApp fails
- HTML-styled templates
- Professional branding
- Reliable delivery via Mailgun
Email Configuration
Email notifications use Mailgun as the delivery provider:src/server/mailgun.ts:8
Required Environment Variables
Your Mailgun API key for authentication
Your verified Mailgun sending domain
Sender email address (must be on verified domain)
Administrator email address for notifications
Administrator phone number for WhatsApp notifications (format: 1234567890)
Base URL for your application (used in notification links)
Notification Types
1. User Registration Notifications
When a new user signs up, admins receive dual-channel notifications.WhatsApp Notification
src/server/mailgun.ts:430
WhatsApp notifications require:
- An active admin WhatsApp session
- Configured WAHA API endpoint
- Valid API key
- Admin phone number in E.164 format
Email Notification
src/server/mailgun.ts:286
2. Password Reset Emails
Sent when users request to reset their password:src/server/mailgun.ts:14
3. Password Changed Confirmation
Sent after successful password change:src/server/mailgun.ts:162
Dual-Channel Delivery System
The notification system attempts WhatsApp first, then falls back to email:src/server/mailgun.ts:496
Notification API
The notification router exposes the dual-channel system:src/server/api/routers/notification.ts:5
Response Format
Overall success status (true if at least one channel succeeded)
Whether WhatsApp notification was delivered
Whether email notification was delivered
Array of error messages if any channel failed
Email Template Features
All email notifications include:Responsive Design
Responsive Design
- Mobile-friendly layouts
- Maximum width of 600px
- Proper viewport meta tags
- Consistent font sizes
Professional Styling
Professional Styling
- Branded colors (WhatsApp green: #25D366)
- Clean typography using system fonts
- Consistent spacing and padding
- Subtle shadows and borders
Security Features
Security Features
- Clear expiration warnings
- “Do not reply” disclaimers
- Security tips and best practices
- Suspicious activity warnings
Accessibility
Accessibility
- Plain text alternatives
- Semantic HTML structure
- High contrast text
- Clear call-to-action buttons
WhatsApp Message Format
WhatsApp notifications use Markdown-style formatting:WhatsApp supports basic Markdown:
*bold*for bold text_italic_for italic text- Emojis for visual enhancement
Error Handling
WhatsApp Errors
Common WhatsApp notification failures:- No admin user found in database
- No active WhatsApp session for admin
- WAHA API unreachable
- Invalid API key
- Admin phone number misconfigured
Email Errors
Common email notification failures:- Invalid Mailgun API key
- Unverified sending domain
- Recipient email blocked
- Rate limits exceeded
- Invalid email format
Monitoring Notifications
Track notification delivery:Best Practices for Monitoring
Best Practices for Monitoring
- Log all notification attempts
- Track success/failure rates
- Monitor Mailgun dashboard for email metrics
- Set up alerts for consistent failures
- Review error messages regularly
Configuration Checklist
Mailgun Setup
- Create Mailgun account
- Verify sending domain
- Get API key
- Set FROM_EMAIL on verified domain
WhatsApp Session
- Admin must have active WhatsApp session
- Session must be CONNECTED status
- Verify session in admin dashboard
Security Considerations
Email Security
Email Security
- Use environment variables for sensitive data
- Never expose API keys in client code
- Verify Mailgun domain with SPF/DKIM
- Use TLS for email transmission
WhatsApp Security
WhatsApp Security
- Secure WAHA API with strong API key
- Use HTTPS for API endpoints
- Validate admin session before sending
- Rate limit notification sends
Data Privacy
Data Privacy
- Only send necessary user information
- Don’t include passwords in notifications
- Use secure links with proper authentication
- Follow GDPR/privacy regulations
Customization
Customize notification templates:- Email Branding
- WhatsApp Messages
Edit HTML templates in
src/server/mailgun.ts:- Update logo and colors
- Modify email copy
- Add company branding
- Customize button styles
Next Steps
Admin Dashboard
Learn about receiving and acting on notifications
Authentication
Understand user registration flow