Skip to main content

Maintaining Conversation History Across Sessions

NavTalk supports maintaining conversation history across multiple sessions, allowing the digital human to remember previous conversations and maintain context continuity.

Workflow Overview

The conversation history workflow follows this sequence:
  1. Store messages: Save user and assistant messages as they occur during the conversation
  2. Send configuration: When WebSocket connection opens, send realtime.input_config message with voice, prompt, and optionally tools (for OpenAI models only)
  3. Load on connection: Wait for realtime.session.created event
  4. Send history: Send stored user messages using conversation.item.create messages
  5. Wait for ready: After sending history, wait for realtime.session.updated event before starting audio input
Session configuration (voice, prompt, tools) is sent via realtime.input_config message immediately after the WebSocket connection opens. The conversation.item.create messages are only used to send conversation history after receiving realtime.session.created.The tools parameter is optional and only applicable when using OpenAI models (gpt-realtime, gpt-realtime-mini). Function calling is not supported by other AI models.
Follow these steps to implement persistent conversation history:
1

Store Conversation History

Save each conversation message to persistent storage as it occurs:
2

Load History on Session Start

When establishing a new WebSocket connection, load the stored history and send it to the server:
3

Restore Conversation Display

When the page loads, restore the conversation history display for the user:

Important Notes

When sending historical messages via conversation.item.create, only user messages can be sent. AI-generated historical messages cannot be embedded this way.