Skip to main content
The Bots feature fetches the server’s directory of first-party AI bots offered to your account: a default bot plus display sections of (jid, persona_id) pairs.
Don’t confuse this with Bot, the client-side framework for building a program that answers messages. Bots reads the server’s bot directory; Bot is a different domain that happens to share the word.

Access

Methods

list

Fetch the bot directory.
WhatsApp Web issues this once per session at startup. It refreshes the directory on a bonsai_update_interval (24h) timer. There’s no server push for updates — call this again when you want fresh data. list() returns every section, not just ones typed all. WhatsApp Web itself reads bots out of every section and only uses type/display_type for presentation, so a bot whose sole carrier is a category or featured section stays reachable. The persona ids in the response are the input to WhatsApp’s WAWebFetchBotProfilesGQLQuery MEX operation (not wrapped by this crate), which hydrates them into displayable profiles — name, description, creator, icebreakers. Example:
Flattened list:

Types

BotList

The whole bot directory as the server returned it.
  • version — which response shape the server sent
  • bhash — cache handle for the directory (v="3" only)
  • default_bot — the bot the client should offer by default; mandatory in v="2" responses, optional in v="3", and not necessarily repeated inside a section
  • sections — display groups, kept exactly as the server sent them (not filtered by type)
Methods:
  • flatten() -> Vec<BotListEntry> — every bot across all sections, in order, with the default bot prepended if no section already carries it
  • default_jid() -> Option<&Jid> — the default bot’s JID, if the server named one

BotListSection

A display group of bots.
section_type parses the type attribute on <section>. display_type is present only in v="3" responses.

BotListEntry

One bot in the directory.
  • persona_id — identifier to hand to the bot-profile MEX operation
  • card_titlev="3" only
  • count — a numeric counter on the bot card; either response version may include it, but WhatsApp Web’s own client doesn’t document what it counts
  • themesv="2" only; empty in v="3" responses

BotDefault

The bot the client offers by default.
A distinct type from BotListEntry: <default> carries exactly these two attributes on the wire in both response versions, so it has no card_title, count, or themes to lose.

BotTheme

Per-mode colours for a bot’s card.

Enums

Each carries an Other(String) fallback variant, so a value the server introduces later round-trips instead of being dropped.
Bots, BotList, BotListEntry, BotListSection, BotDefault, BotTheme, and their enums are re-exported from the crate root (whatsapp_rust::Bots, whatsapp_rust::BotList, …).

Wire format

Request

The request always pins v="2", even though the parser accepts either response shape. WhatsApp Web’s only call site never sends bhash or per-JID filter children, so this crate doesn’t either.

Response (v="2")

Response (v="3")

Each version has one field the other does not require, enforced only for its own version: <default> in v="2", bhash in v="3".

Error handling

list() returns Result<BotList, IqError> — see Errors for IqError’s variants.

See also

  • Bot - Client-side framework for building a bot that answers messages
  • MEX (GraphQL) - Generic GraphQL query/mutate access, which can also carry the bot-profile hydration operation (not separately wrapped by this crate)