Skip to main content
Webhooks enable you to receive real-time HTTP POST notifications when events occur in your WhatsApp instances. Evolution API sends event data to your specified URL endpoint.

Configuration

You can configure webhooks globally (for all instances) or per-instance. Configure webhooks through environment variables or the API.

Global Webhook Settings

Set these environment variables to enable global webhooks:
.env
When WEBHOOK_GLOBAL_WEBHOOK_BY_EVENTS=true, events are sent to:
  • https://your-domain.com/webhook/qrcode-updated
  • https://your-domain.com/webhook/messages-upsert
  • etc.

Request Configuration

Configure webhook request behavior:
.env

Retry Configuration

Evolution API implements intelligent retry logic with exponential backoff:
.env
The retry mechanism uses exponential backoff: each retry waits longer than the previous one. Jitter adds randomness to prevent thundering herd problems.

Available Events

Configure which events trigger webhook notifications:
.env

Per-Instance Configuration

Configure webhooks for a specific instance via API:

Configuration Options

Set to true to enable webhooks for this instance.
Your webhook endpoint URL. Must start with http:// or https://.
When true, appends the event name to the URL:
  • false: All events go to https://your-domain.com/webhook
  • true: Events go to https://your-domain.com/webhook/event-name
When true, media files are sent as base64-encoded strings in the payload.
Custom HTTP headers to include in webhook requests. Useful for authentication.
Array of event names to receive. Leave empty or omit to receive all events.

Authentication

JWT Authentication

You can use JWT tokens for webhook authentication. Add a jwt_key header:
Evolution API will:
  1. Generate a JWT token signed with your secret key
  2. Add it as Authorization: Bearer <token> header
  3. Token expires after 10 minutes

Validating JWT Tokens

Webhook Payload Structure

All webhook requests include the following structure:

Example Payloads

Best Practices

1

Respond Quickly

Your webhook endpoint should respond with HTTP 200-299 within the timeout period. Process data asynchronously if needed.
2

Handle Retries Gracefully

Implement idempotency in your webhook handler. Use the message ID or event timestamp to avoid processing duplicates.
3

Secure Your Endpoint

  • Use HTTPS for your webhook URL
  • Validate JWT tokens or custom headers
  • Whitelist Evolution API’s IP addresses if possible
4

Monitor Failures

Enable error event webhooks to receive notifications about webhook delivery failures:
Webhook URLs must be accessible from the internet. Local URLs (localhost, 192.168.x.x) won’t work unless you’re using a tunneling service like ngrok.

Troubleshooting

  1. Check that WEBHOOK_GLOBAL_ENABLED=true or instance webhook is enabled
  2. Verify your URL is accessible from the internet
  3. Check the specific event is enabled in configuration
  4. Review Evolution API logs for delivery errors
  5. Ensure your endpoint responds with HTTP 200-299
This is normal behavior when retries occur. Implement idempotency using message IDs or timestamps to handle duplicates.
Network delays can cause events to arrive out of order. Use the date_time and messageTimestamp fields to order events correctly.
If you’re receiving media files, consider:
  • Setting base64: false to receive media URLs instead of base64 data
  • Increasing WEBHOOK_REQUEST_TIMEOUT_MS for large payloads
  • Downloading media asynchronously from URLs