Skip to main content
This guide builds a minimal “ping → pong” bot. It connects, prints a QR code to pair, and replies pong whenever it receives ping.
1

Install the packages

2

Create the store and client

The store persists auth and Signal state. This example uses SQLite, writing to .auth/state.sqlite.
3

Handle pairing

On a fresh session the client emits auth_qr. Render the value as a QR code (for example with the qrcode-terminal package) and scan it from WhatsApp → Linked devices.
Prefer an 8-character pairing code instead of a QR? See Authentication.
4

Reply to incoming messages

Listen for the message event and send a reply with client.message.send.
5

Connect

connect() resolves once the socket is open. The first connection drives pairing; subsequent connections reuse the stored credentials.

Full example

What’s next

Sending messages

Replies, mentions, link previews, and the full content union.

Receiving messages

Parse incoming events, send receipts, and decrypt addons.

Reconnection

zapo does not auto-reconnect — here’s the pattern to handle it.

Configuration

Sessions, history sync, timeouts, proxy, and more.
Last modified on May 29, 2026