Documentation Index
Fetch the complete documentation index at: https://zapo.to/llms.txt
Use this file to discover all available pages before exploring further.
client.bot (WaBotCoordinator) works with WhatsApp bots - any account on the @bot domain. Meta AI is the most common one, but it is not the only bot; listBots() returns every bot available to your account. The coordinator discovers bots, reads their profiles, sends prompts, and decrypts the streamed chunks of a bot’s reply.
Discovering bots & getting a bot JID
You don’t hard-code bot JIDs - you discover them withlistBots() and pick one:
WaBotInfo.jid is the value you pass below as to (direct path) or options.botJid (mention path).
Sending a prompt
sendPrompt(to, content, options?) invokes a bot. There are two paths depending on to:
Direct path — chat with the bot
Whento is a @bot JID, you’re chatting with the bot directly. zapo generates a fresh aiThreadId (a conversation id); reuse it on later prompts to keep context:
Mention path — invoke a bot inside a group
Whento is a group/chat JID, you must name the bot via options.botJid. The bot is invoked indirectly through a mention:
On the mention path,
aiThreadId / aiThreadType are ignored — bots drop the request if persona/thread metadata is attached to a mention.WaBotPromptOptions extends WaSendMessageOptions and adds botJid, personaId, capabilities, extraMentionedJids, aiThreadId, and aiThreadType.
Receiving the streamed reply
A bot’s reply does not arrive as onemessage. It streams as multiple encrypted chunks, surfaced on the message_bot_chunk event. zapo decrypts them automatically on every incoming message, so you just listen:
| Field | Meaning |
|---|---|
senderJid | The bot. |
targetMessageId | The id of the prompt this reply answers — your stream key. |
editType | Chunk position: first → inner → last, or a single full. |
message | The decrypted chunk content (Proto.IMessage). |
plaintext | Raw decrypted bytes. |
Manual chunk decryption
zapo callstryDecryptChunk for you on each incoming message, so you rarely need it. If you manage incoming events yourself, you can invoke it explicitly:
