How to save AI message history
AI message history stores each sendAI turn on the server so your product can reload conversations with fetchAIHistory and remove entries with deleteAIHistoryMessage.
Control it with saveHistory: true (default) or false on each sendAI call.
Why save AI history?
Rebuild a support chat UI after refresh
Continue audits / compliance with stored turns
Pair with
sessionIdfor multi-turn assistantsKeep internal workflow routing calls ephemeral (
saveHistory: false)
How to save AI message history
Store turns (default)
await notifier.sendAI({
senderId: "user-123",
message: { text: "How do I reset my password?" },
saveHistory: true, // default — can omit
});
const history = await notifier.fetchAIHistory({ senderId: "user-123" });await notifier.send_ai(
sender_id="user-123",
message={"text": "How do I reset my password?"},
save_history=True,
)
history = await notifier.fetch_ai_history(sender_id="user-123")await notifier.sendAI(
senderId: 'user-123',
message: {'text': 'How do I reset my password?'},
saveHistory: true,
);
final history = await notifier.fetchAIHistory(senderId: 'user-123');Skip storage (ephemeral / internal)
Use saveHistory: false for classification, routing, or workflow steps you do not want in the user-facing history:
Load and delete history
fetchAIHistory({ senderId })
List stored AI turns for a user
deleteAIHistoryMessage({ senderId, messageId })
Delete one message
Prefer transport: "http" so history methods return the payload directly.
→ Full API: AI history
saveHistory vs logs vs observability
saveHistory: true
Yes — via fetchAIHistory
No dedicated list
logs: true
No
Logs (sessions / tokens)
observability: true
No
Workflows (step graph)
Production assistants usually enable all three: history for UX, logs for ops, observability for multi-agent pipelines.
AI history vs chat history
AI history (saveHistory on sendAI)
User ↔ AI turns
Chat history (saveHistory on send)
User ↔ user realtime messages
→ Chat history · Chat saveHistory flag
Next steps
Last updated