Skip to main content
WSAPI emits real-time events whenever something happens on your WhatsApp instance — new messages, status changes, group updates, calls, and more.

Delivery modes

There are two ways to receive events:
WSAPI sends an HTTP POST request to a public endpoint you configure. Best for server-based applications that already expose HTTP endpoints.
  1. Configure your instance with Webhook delivery mode and specify a Webhook URL
  2. When an event occurs, WSAPI sends a POST request with the event payload
  3. Your server processes the event and responds with a 200 status code
See Configuring Event Delivery for setup instructions.

Event payload

All events follow this structure regardless of delivery mode:

Event types

Four events are system events: logged_in, logged_out, login_error, and initial_sync_finished. System events are always delivered regardless of event filter configuration and cannot be opted out of.

Webhook delivery headers

Every webhook POST request includes the following HTTP headers:

Verifying event signatures

When a Signing Secret is configured for your instance, WSAPI signs every event payload using HMAC-SHA256. The signature is included in the X-Webhook-Signature header with the format:
Always configure a signing secret to verify the authenticity of incoming events and prevent unauthorized parties from sending fake events to your endpoint.
To verify an event:
  1. Compute the HMAC-SHA256 of the raw request body using your signing secret as the key
  2. Hex-encode the result and prepend sha256=
  3. Compare the computed value with the X-Webhook-Signature header using a constant-time comparison to prevent timing attacks

Delivery and retries

  • WSAPI expects a 2xx response for webhook deliveries
  • If no valid response is received, WSAPI retries delivery up to 2 times
  • After that, the event is discarded
  • Implement idempotent processing to handle potential duplicate deliveries

Best practices

  • Respond quickly — return 200 immediately and process events asynchronously
  • Verify signatures — always validate the X-Webhook-Signature on incoming events
  • Handle duplicates — design your handler to be idempotent in case of retries
  • Filter events — use event filtering to only receive events you need
  • Use HTTPS — always use an HTTPS endpoint for your webhook URL
  • Log events — log incoming events for debugging and audit purposes