Session Lifecycle
Starting a New Conversation
- Set
sessionId to null in the connection URL
- Save the
session_id from the first received message for future reconnections
Resuming a Previous Conversation
- Use the stored
session_id in the connection URL
- The AI maintains full context from previous messages
JavaScript (Browser)
Python
Critical Requirements
Heartbeat is required. Send every 15 seconds or the connection will drop and the user will appear offline in the dashboard.
- Heartbeat — every 15 seconds, no exceptions
- Session storage — persist
session_id client-side for conversation continuity
- Session init is optional — only needed when passing lead data; use
session=null for anonymous chat
- Message order — messages are delivered in order and each user message gets a
recv confirmation