client — see the Quickstart for setup.
Extract text from any message
Incoming text can arrive as a plainconversation or an extendedTextMessage (when it has a reply/preview). Normalize both:
Command router
Parse a leading/command and dispatch. Skip your own outgoing messages with event.key.fromMe:
Reply with a quote and a mention
Auto-download incoming media
Stream straight to disk — never buffer large files in memory:maxBytes.
Welcome new group members
Thegroup event fires on membership changes. Greet everyone added (action: 'add') and @-mention them:
Send a poll
React to a message
Keep the bot alive across drops
zapo doesn’t auto-reconnect — wire the connection event to a backoff loop. The full pattern (including when not to reconnect) is in Reconnection and Errors & disconnects.
Every snippet uses the content union — the same shapes
client.message.send accepts everywhere. See Sending messages and the message types reference for the full set.