What are Webhooks?
Webhooks allow Evolution API to send real-time notifications to your application when events occur in WhatsApp. Instead of polling for updates, your application receives HTTP POST requests with event data as it happens. Evolution API provides:- 40+ event types covering messages, contacts, groups, and connection status
- Automatic retry logic with exponential backoff
- Custom headers for authentication
- Event filtering to receive only the events you need
- Global and per-instance webhook configurations
Webhooks are the recommended way to build responsive WhatsApp applications. They ensure zero message loss and real-time user experiences.
Webhook Configuration
Global Webhooks
Configure webhooks for all instances via environment variables:When
WEBHOOK_BY_EVENTS=true, each event is sent to a unique URL:- Messages:
https://your-app.com/webhook/messages-upsert - Contacts:
https://your-app.com/webhook/contacts-upsert - Connection:
https://your-app.com/webhook/connection-update
Per-Instance Webhooks
Configure webhooks when creating an instance:Update Existing Instance Webhook
Available Events
Evolution API supports over 40 webhook events. Here are the most important ones:Instance Events
| Event | Description | Trigger |
|---|---|---|
APPLICATION_STARTUP | API server started | On server boot |
INSTANCE_CREATE | New instance created | POST /instance/create |
INSTANCE_DELETE | Instance deleted | DELETE /instance/delete |
QRCODE_UPDATED | New QR code generated | During connection |
CONNECTION_UPDATE | Connection state changed | Connect/disconnect |
REMOVE_INSTANCE | Instance auto-removed | Timeout or error |
LOGOUT_INSTANCE | Instance logged out | Manual logout |
Message Events
| Event | Description | Trigger |
|---|---|---|
MESSAGES_SET | Historical messages loaded | Initial sync |
MESSAGES_UPSERT | New message received/sent | Real-time messages |
MESSAGES_UPDATE | Message status changed | Read, delivered, played |
MESSAGES_EDITED | Message content edited | Edit message |
MESSAGES_DELETE | Message deleted | Delete for everyone |
SEND_MESSAGE | Message sent successfully | After sending |
SEND_MESSAGE_UPDATE | Sent message status updated | Delivery confirmation |
Contact Events
| Event | Description | Trigger |
|---|---|---|
CONTACTS_SET | Contacts loaded | Initial sync |
CONTACTS_UPSERT | New/updated contact | Contact change |
CONTACTS_UPDATE | Contact info changed | Profile update |
PRESENCE_UPDATE | User presence changed | Online/offline/typing |
Chat Events
| Event | Description | Trigger |
|---|---|---|
CHATS_SET | Chats loaded | Initial sync |
CHATS_UPSERT | New/updated chat | New conversation |
CHATS_UPDATE | Chat metadata changed | Mute, archive, pin |
CHATS_DELETE | Chat deleted | Delete conversation |
Group Events
| Event | Description | Trigger |
|---|---|---|
GROUPS_UPSERT | New/updated group | Join/create group |
GROUPS_UPDATE | Group info changed | Name, description, icon |
GROUP_PARTICIPANTS_UPDATE | Participants changed | Add/remove members |
Other Events
| Event | Description | Trigger |
|---|---|---|
LABELS_EDIT | Label modified | Edit label |
LABELS_ASSOCIATION | Label assigned | Tag conversation |
CALL | Incoming call | Voice/video call |
TYPEBOT_START | Typebot session started | Bot triggered |
TYPEBOT_CHANGE_STATUS | Typebot status changed | Bot state change |
ERRORS | Error occurred | Any error |
Configure Events in .env
Webhook Payload Structure
All webhook requests follow this structure:Message Received Example
Connection Update Example
QR Code Updated Example
Webhook Authentication
Secure your webhook endpoint using custom headers:Bearer Token Authentication
JWT Authentication
Evolution API can automatically generate JWT tokens for each request:src/api/integrations/event/webhook/webhook.controller.ts:80):
Retry Logic and Error Handling
Evolution API includes sophisticated retry logic to ensure reliable webhook delivery.Retry Configuration
How Retry Works
Fromsrc/api/integrations/event/webhook/webhook.controller.ts:203:
With default settings, Evolution API will retry for up to 30+ minutes before giving up:
- Attempt 1: Wait 5s
- Attempt 2: Wait 10s
- Attempt 3: Wait 20s
- …
- Attempt 10: Wait 300s (5 min)
Error Webhooks
Receive notifications when errors occur:Implementing a Webhook Handler
Best Practices
Always Return 200 OK
Always Return 200 OK
Your webhook endpoint should return If you return an error status, Evolution API will retry the webhook, potentially causing duplicates.
200 OK as quickly as possible:Implement Idempotency
Implement Idempotency
Handle duplicate webhooks gracefully using message IDs:
Filter Events You Need
Filter Events You Need
Only enable events you actually use to reduce webhook traffic:Avoid enabling
MESSAGES_SET, CONTACTS_SET, and CHATS_SET unless you need historical sync.Use Queue for Processing
Use Queue for Processing
For high-volume webhooks, use a queue to prevent blocking:
Verify Webhook Source
Verify Webhook Source
Validate webhooks are from your Evolution API:
Monitor Webhook Health
Monitor Webhook Health
Track webhook delivery and errors:
Testing Webhooks
Using ngrok for Local Development
Webhook Testing Tools
- Webhook.site - Inspect webhook payloads without code
- RequestBin - Collect and debug webhooks
- Postman - Mock webhook servers for testing
Next Steps
Instances
Learn how to create and manage instances
Authentication
Secure your API with authentication
Multi-Tenant
Build multi-tenant applications
Message Events
Explore message API endpoints