AI sessions
An AI session groups multiple sendAI turns under one id so the platform can maintain context across follow-up questions. Pass sessionId on subsequent calls to continue the same conversation.
How sessions work
Turn 1 Turn 2
ββββββ ββββββ
sendAI({ message }) sendAI({
(no sessionId) sessionId: "<from turn 1>",
}) message: { text: "follow-up" }
β β
βΌ βΌ
new session id created same session continuedOn the first call, omit sessionId (or pass null). The SDK generates a session id and returns it in the response metadata.
On follow-up calls, pass that id as sessionId.
Extracting sessionId (first turn)
const first = await notifier.sendAI({
senderId: "user-123",
message: { text: "Start a new support session." },
});
const sessionId =
first?.metadata?.packet?.id ??
first?.metadata?.id;Store sessionId in your database keyed by user, ticket, or chat thread.
Continuing a session
Sessions vs messages[] history
sessionId
Server-managed continuity; simpler client code
Full messages[] each call
You control exact context window; stateless servers
fetchAIHistory
Audit or rebuild UI from stored turns β see AI history
Transport
Use transport: "http" for session continuation.
Language guides
JavaScript / TypeScript
Dart / Flutter
Next steps
AI history β List and delete stored turns
Session logging β Dashboard telemetry with
logs: true
Last updated