client.events() to receive instance events in real time without exposing a public URL.
For HTTP callbacks, see Webhooks.
Common events
| Event | Description |
|---|---|
Message | Incoming message or message event. |
ReadReceipt | Read/delivery update. |
Presence | User presence. |
ChatPresence | Chat presence. |
HistorySync | History sync. |
Connected | Instance connected to WhatsApp. |
Disconnected | Instance disconnected. |
GroupParticipantsAdd | Group participants added. |
GroupParticipantsRemove | Group participants removed. |
All | All subscribed events. |
Subscribe to realtime
EventSubscription — object with on(), close(), and automatic reconnect when configured.
Main EventSubscribeRequest options: instanceId, instanceToken, event(...), reconnect, maxRetries, retryDelayMs, lastEventId.
Register handlers
Close subscription
Promise<void> after the WebSocket closes.
Event envelope
Each received event uses this JSON shape:Delivery and ack
Delivery is at-least-once. Deduplicate byevent.id() when handlers have side effects.
Use lastEventId(...) when reconnecting to reduce gaps.
