Skip to main content

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.
  1. Heartbeat — every 15 seconds, no exceptions
  2. Session storage — persist session_id client-side for conversation continuity
  3. Session init is optional — only needed when passing lead data; use session=null for anonymous chat
  4. Message order — messages are delivered in order and each user message gets a recv confirmation