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.
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 — pass 'whatsapp' or 'sms':

Method reference

MethodDescription
messaging.sendMessage(request)Send a message and return the reply.
messaging.streamMessage(request)Send a message and stream the reply (SSE).
messaging.rerun(threadId, request)Regenerate an interaction on a new thread.
messaging.listMessages(threadId)The thread’s full transcript.
messaging.threadTrace(threadId)Every interaction’s reasoning trace.
messaging.interactionTrace(interactionId)One interaction’s reasoning trace.
messaging.getWelcomeMessage()The agent’s configured greeting.
messaging.generateFollowupSuggestions(request)Suggested next prompts from a context.
channels.initiateThread(channel, request)Start a WhatsApp/SMS conversation.
connect(args?)Open a WebSocket session.
getContext()Resolve the key’s agent and organization.
Every method also accepts a final requestOptions argument (timeoutInSeconds, maxRetries, abortSignal, extra headers) — see Best practices.