Skip to main content
ApolloMessagingClient is the browser-safe client for end-user messaging. It authenticates with your publishable key, exchanging it for a short-lived access token internally — the agent comes from the key, never from request bodies.
All methods are async, fully typed, and throw typed errors on failure. Request and response models are exported under the Apollo namespace.

Send a message

Omit thread_id to start a new conversation, or pass it to continue one.
When the agent surfaces entities — products, bookings, search results — the reply carries them as cards. Each card holds the same entity in two self-contained representations, so you pick what fits your stack: a ready-to-render JSX string for React, or structured JSON for any other framework — see Cards for the full shape.
Pass per-message values for the agent’s configured context variables with agent_variables:

Stream a message

streamMessage returns the reply as an async-iterable stream of Server-Sent Events — token deltas while the agent works, then the complete message:
To resume a dropped stream without re-running the turn, reconnect with the last seq you saw:

Rerun an interaction

Regenerate a previous interaction — with the original or edited text — on a new thread branched from the original:

Read a conversation

Welcome message and follow-up suggestions

Channels (WhatsApp and SMS)

Start an outbound conversation on a channel with channels.initiateThread. Pass 'sms' or 'whatsapp' as the channel. phone_number is the recipient (who receives the opener). sender_id is not that phone number. It is the MongoDB ObjectId of a sender record you already connected in the AUI playground. If you connected a specific phone number through the AUI playground (SMS or WhatsApp), copy that sender’s ObjectId and pass it as sender_id. The SDK then starts the conversation from that connected number. Without sender_id, the platform default sender is used instead. The response includes from when a specific sender was used, so you can confirm which connected number the opener was sent from.
WhatsApp is the same call. Template fields apply to WhatsApp only; text is used for SMS and ignored by WhatsApp.

Method reference

Every method also accepts a final requestOptions argument (timeoutInSeconds, maxRetries, abortSignal, extra headers) — see Best practices.