Documentation Index
Fetch the complete documentation index at: https://zapo.to/llms.txt
Use this file to discover all available pages before exploring further.
zapo connects as a companion device — exactly like linking WhatsApp Web or Desktop. The first connection pairs the device; after that, credentials stored in your store are reused automatically.
The pairing flow
Pairing is driven entirely through events emitted duringconnect():
| Event | Payload | When |
|---|---|---|
auth_qr | { qr: string, ttlMs: number } | A new QR is available to render. Re-emitted as it rotates. |
auth_pairing_code | { code: string } | An 8-digit pairing code was issued (code flow). |
auth_pairing_required | { forceManual: boolean } | The session needs pairing input. |
auth_paired | { credentials: WaAuthCredentials } | Pairing succeeded; credentials are now persisted. |
auth_paired fires, the credentials are written to the store and reused on every subsequent connect() — you will not see auth_qr again unless the session is unlinked or cleared.
Pairing with a QR code
This is the default flow. Render theqr string as a QR image and scan it from WhatsApp → Linked devices → Link a device.
auth_qr fires again with a fresh value each time, so always render the latest one.
Pairing with a code
Prefer entering an 8-digit code on the phone instead of scanning? Request one throughclient.auth after the connection is established. Listen for auth_pairing_required, then request the code for the target phone number (digits only, with country code):
requestPairingCode(phoneNumber, shouldShowPushNotification?, customCode?) requires an active connection and returns the code as a string. On the phone, open Linked devices → Link with phone number instead.Credentials
After pairing, the current credentials are available synchronously:Logging out
logout() unpairs the companion device server-side (it removes this device from the account’s linked devices). It requires an authenticated session:
logoutStoreClear option — see Configuration.
Disconnect vs. logout
disconnect() | logout() | |
|---|---|---|
| Closes the socket | Yes | Yes |
| Keeps credentials | Yes — reconnect later without re-pairing | No — device is unlinked |
| Server-side effect | None | Removes the linked device |
disconnect() for a graceful shutdown you intend to resume; use logout() to permanently unlink.
Next
Stores
Where credentials and Signal state are persisted.
Reconnection
Handle
connection: close and reconnect.