> ## Documentation Index
> Fetch the complete documentation index at: https://docs.navtalk.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# realtime.session.created

> Session created event

Triggered when the real-time session is created. This event is received after `conversation.connected.success` and after you send the `realtime.input_config` message. After receiving this event, you should send conversation history (if any) using `conversation.item.create` messages.

## Event Properties

<ResponseField name="type" type="string">
  Event type. Always `"realtime.session.created"` for this event.
</ResponseField>

<ResponseField name="data" type="object">
  Event data object. May be empty or contain session metadata.
</ResponseField>

<ResponseExample>
  ```json Example theme={null}
  {
    "type": "realtime.session.created",
    "data": {}
  }
  ```
</ResponseExample>

## Sending Conversation History

After receiving `realtime.session.created`, send conversation history (if any) using `conversation.item.create` messages. Only send user messages from history:

```javascript theme={null}
async function sendSessionUpdate() {
    const history = localStorage.getItem('realtimeChatHistory');
    const conversationHistory = history ? JSON.parse(history) : [];
    
    // Only send user messages
    conversationHistory.forEach((msg) => {
        if (msg.role === 'user') {
            const messageConfig = {
                type: 'conversation.item.create',
                item: {
                    type: 'message',
                    role: msg.role,
                    content: [{ type: 'input_text', text: msg.content }]
                }
            };
            socket.send(JSON.stringify(messageConfig));
        }
    });
}
```

<Note>
  Session configuration (voice, prompt, tools) is sent via `realtime.input_config` message immediately after the WebSocket connection opens. The `sendSessionUpdate()` function is 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.
</Note>
