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.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:
Types
BotList
The whole bot directory as the server returned it.version— which response shape the server sentbhash— cache handle for the directory (v="3"only)default_bot— the bot the client should offer by default; mandatory inv="2"responses, optional inv="3", and not necessarily repeated inside a sectionsections— display groups, kept exactly as the server sent them (not filtered by type)
flatten() -> Vec<BotListEntry>— every bot across all sections, in order, with the default bot prepended if no section already carries itdefault_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 operationcard_title—v="3"onlycount— a numeric counter on the bot card; either response version may include it, but WhatsApp Web’s own client doesn’t document what it countsthemes—v="2"only; empty inv="3"responses
BotDefault
The bot the client offers by default.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
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
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")
<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)