Configuration
Configure Pusher through environment variables.Basic Setup
.env
Global Pusher Configuration
Configure a global Pusher app to receive events from all instances:.env
Find your Pusher credentials in your Pusher Dashboard.
Setting Up Pusher
1
Create Pusher Account
Sign up at pusher.com and create a new Channels app.
2
Get Credentials
Copy your app credentials from the Pusher dashboard:
- App ID
- Key
- Secret
- Cluster
3
Configure Evolution API
Add credentials to your
.env file:4
Restart Evolution API
Restart the API to apply changes.
Available Events
Configure which events are sent to Pusher:- Instance Events
- Message Events
- Contact Events
- Chat & Group Events
- Other Events
.env
Per-Instance Configuration
Configure Pusher with separate credentials for each instance:Channel Structure
Events are published to channels named after your instances:- Channel: Instance name (e.g.,
my_instance) - Event: Event name in lowercase with dots (e.g.,
messages.upsert)
Each WhatsApp instance publishes to its own dedicated Pusher channel.
Subscribing to Events
Connect to Pusher channels and listen for events:Event Payload Structure
All events have a consistent structure:For
qrcode.updated events, the base64 field is removed to reduce payload size. Only the QR code string is sent.Payload Size Limit
Pusher has a 10 KB message size limit. Evolution API:- Checks payload size before sending
- Removes base64 from QR codes automatically
- Logs errors if payload exceeds 10 KB
- Drops oversized messages with error log
Best Practices
1
Use Presence Channels for Authentication
For production apps, use Pusher’s presence channels with server-side authentication:
2
Enable Only Required Events
Reduce bandwidth and costs by enabling only necessary events:
3
Monitor Pusher Metrics
Use Pusher Dashboard to monitor:
- Connection count
- Message volume
- API usage
4
Handle Connection States
Always handle connection state changes:
5
Use TLS in Production
Always enable TLS for production:
Pusher Clusters
Choose a cluster close to your users for lower latency:mt1- US East (N. Virginia)us2- US East (Ohio)us3- US West (Oregon)eu- EU (Ireland)ap1- Asia Pacific (Singapore)ap2- Asia Pacific (Mumbai)ap3- Asia Pacific (Tokyo)ap4- Asia Pacific (Sydney)
Troubleshooting
Connection failed
Connection failed
- Verify Pusher app key is correct
- Check cluster matches your Pusher app
- Ensure Pusher app is not suspended
- Check browser console for specific errors
- Verify
PUSHER_ENABLED=true
No events received
No events received
- Verify instance is connected to WhatsApp
- Check that specific events are enabled in configuration
- Verify you’re subscribed to correct channel (instance name)
- Check Evolution API logs for Pusher errors
- Use Pusher Debug Console to see live events
Payload too large errors
Payload too large errors
- Check Evolution API logs for specific events
- Disable events with large payloads (e.g., MESSAGES_SET)
- Contact Pusher support for higher limits (paid plans)
- Consider switching to Webhook or WebSocket for large payloads
High costs
High costs
- Reduce number of enabled events
- Use per-instance Pusher apps instead of global
- Implement client-side filtering
- Consider switching to WebSocket for high-volume scenarios
Authentication errors (per-instance)
Authentication errors (per-instance)
- Verify all Pusher credentials are correct
- Check appId, key, and secret match your Pusher app
- Ensure cluster is correctly set
- Test credentials in Pusher Debug Console