Session events
VoisX records each voice session on its own servers: its length, its transcript and every tool call. Sessions you open with the session WebSocket show in the console without any extra calls.
Use this endpoint to add events that only your client knows about, such as an error your client hit or a message from your own UI.
Do not send transcript, session_end or tool call events for a session you opened with the WebSocket. VoisX already records them, and VoisX analyses every transcript it receives, so a second transcript repeats that work.
Send session events
/widget/v1/analyticsRecords one or more events for a session. You can send several events in one request.
Requires the widget:read permission.
Headers
X-API-KeystringrequiredBody
session_idstringrequiredsession_id from the WebSocket's connected message.agent_idintegerrequiredeventsarrayrequiredevents[].typestringrequiredevents[].timestampstringrequiredevents[].dataobjectoptionalEvent types
type | data fields | What it records |
|---|---|---|
session_start | visitor_id (optional) | The session started. |
session_end | duration_seconds (number) | The session ended and how long it lasted. |
transcript | transcript_data (array of turns) | The conversation. Each turn has role (user or assistant), text and timestamp. |
message | message (string) | One message in the conversation, for the session log. |
error | error_type, message | An error your client hit. |
tool_call_made | none | The agent asked for a tool. |
tool_call_success | none | A tool call succeeded. |
Unknown types are accepted and ignored. Tool calls are counted on the server (see Tools), so you do not need to send tool_call_made or tool_call_success.
Response fields
successbooleanoptionaltrue when the request was accepted.receivedintegeroptionalpersistedintegeroptionalResponses
widget:read, or is not allowed from this domain.