vzaps.events to receive instance events in real time without exposing a public URL.
For HTTP callbacks, see Webhooks.
Common events
| Event | Description |
|---|---|
Message | New incoming message or message event. |
ReadReceipt | Read/delivery update. |
Presence | User presence. |
ChatPresence | Chat presence. |
HistorySync | History synchronization. |
Connected | Instance connected to WhatsApp. |
Disconnected | Instance disconnected. |
GroupParticipantsAdd | Participants added to group. |
GroupParticipantsRemove | Participants removed from group. |
All | All subscribed events. |
Subscribe to realtime
EventSubscription — object with on(), close(), and automatic reconnect when configured.
Options:
| Field | Type | Required | Description |
|---|---|---|---|
instanceId | string | Yes | Instance to watch. |
instanceToken | string | Yes | Instance token. |
events | VZapsEventType[] | No | Event list. If omitted, uses events subscribed on the instance. |
reconnect | boolean | No | Reconnect automatically. Default: true. |
maxRetries | number | No | Maximum retry attempts. |
retryDelayMs | number | No | Delay between retries. |
lastEventId | string | No | Resume cursor. |
signal | AbortSignal | No | Close subscription when aborted. |
Register handlers
Close subscription
Promise<void> after the WebSocket closes.
In Node.js processes:
Event envelope
Every event received by the SDK has this shape:| Field | Description |
|---|---|
id | Event identifier. Use for deduplication. |
type | Event type. |
instance_id | Source instance. |
created_at | Event creation date. |
data | Event payload. |
data.media_url | Media URL when the incoming event contains media and the platform provides the file. |
Delivery and ack
Delivery is at-least-once. Your app should process events idempotently. After the handler finishes, the SDK automatically sends an ack. Recommendations:- store
event.idif your automation performs external effects; - ignore events that were already processed;
- use
lastEventIdwhen reconnecting if you want to reduce gaps; - keep handlers fast and move long-running work to your own queue.
Realtime or webhook?
| Scenario | Recommendation |
|---|---|
| Bot, dashboard, or app with immediate consumption | Realtime |
| Backend with public URL and HTTP pipeline | Webhook |
| Do not want to expose a public URL | Realtime |
| Need to reprocess deliveries via logs | Webhook |

