Chat Sessions¶
Overview¶
Chat sessions in Open Chat Studio define the scope of conversations between a user and a chatbot within a specific channel. Sessions are isolated, ensuring data privacy and contextual continuity for the duration of an interaction.
Session Scope¶
A session is uniquely defined by:
- User: The individual engaging with the chatbot.
- Channel: The platform through which the chat occurs (e.g., WhatsApp, Telegram, Web, Slack). See channels.
- Chatbot: The specific chatbot handling the conversation.
Each session is independent, meaning:
- The session's data is bound to that session only and is not shared with other sessions.
- When a user interacts with a chatbot, the bot receives the session's history to maintain context.
- Multi-Session Channels: Channels such as Web, API, and Slack allow multiple active sessions per user, enabling parallel conversations.
- Single-Session Channels: Platforms like WhatsApp, Telegram, and SureAdhere support only one active session per user at a time.
History Management¶
- As conversations progress, all previous messages within a session are stored as
history. - If the session history exceeds a predefined maximum length, it is summarized, and the bot will only receive:
- A summary of older interactions.
- The most recent exchanges to maintain context.
Participant Data¶
Aside from session-specific data, Open Chat Studio maintains participant data, which:
- Persists across sessions.
- Is tied to the same
User, Channel, Chatbotscope. - Helps retain long-term user preferences and contextual information beyond a single session.
Anonymous Sessions¶
On the Web channel, users can have anonymous sessions, where:
- Participant data is only available for the duration of the session.
- Since user identity cannot be verified, data cannot persist beyond the session.
Resetting Sessions¶
For Single-Session Channels like WhatsApp and Telegram, the current session continues indefinitely. However, sessions can be reset either manually by the user or automatically using Events or the API. When a session is reset:
- The current session is marked as completed.
- A new session is started with a fresh history.
This means that, aside from participant data, the bot loses all information about the previous conversation — including the fact that it even took place.
Manual resets¶
Users can manually reset a session (start a new session) in two ways:
Using the /reset command¶
The /reset command allows chat users to start a new session by sending this text command in the chat. This command is available on all channels except Web and Slack.
Using the session reset button¶
In the web interface, users have access to a button that allows them to end the current session and immediately start a new one. When using this button, users can:
- Choose whether to trigger end conversation events: Users can opt to run any configured end conversation events before starting the new session, or skip them.
- Provide an initial bot message: Users must specify a prompt that will be used as the bot's first message in the new session. If the chatbot has a seed message configured, this field will be pre-filled with that seed message, but users can modify it as needed.
This button provides more control over the session reset process compared to the /reset command, allowing users to customize how the transition between sessions occurs.
Automatic resets¶
There are two ways to automatically reset a session:
- Events: You can configure an event to end the current session when the event is triggered. This will not automatically create a new session; however, if the user sends a message after the session is ended, a new session will be created. See Events.
- API: When using the Trigger Bot Message API, you can set
"start_new_session": true, which will end the current session and start a new one before messaging the user.
By structuring sessions in this way, Open Chat Studio ensures privacy-conscious, context-aware, and seamless interactions across different communication channels.