Skip to main content
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 with listBots() 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

When to 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

When to 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 one message. 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:
The chunk event fields:
Reconstruct the full answer by concatenating chunks for a given targetMessageId in arrival order until you see last (or a single full).

Manual chunk decryption

zapo calls tryDecryptChunk for you on each incoming message, so you rarely need it. If you manage incoming events yourself, you can invoke it explicitly:
It silently no-ops when the chunk isn’t addressed to you or the parent prompt secret isn’t available.
Last modified on May 29, 2026