Skip to main content

Websocket client events

This page lists all supported events emitted by the client over a Websocket connection and the expected server responses.

Event session:create

Create a new session. This event initializes a new conversation session with the server, including optional context and authentication information.

FieldTypeDescription
contextContextObjectOptional context information
identity_tokenstringOptional authentication token
timestampintegerRequired timestamp of the request
is_testbooleanOptional flag indicating if this is a test session
opt_outbooleanOptional flag for opting out of data collection

Example payload:

{
"context": {
"user_id": "550e8400-e29b-41d4-a716-446655440000",
"language": "en",
"browser": "Chrome",
"os": "Windows"
},
"identity_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"timestamp": 1678901234,
"is_test": false,
"opt_out": false
}

Server responses

  • On success session:created
  • On failure
    • session:create:error
    • session:create:error:invalid_identity_token
    • session:create:error:invalid_private_key
    • session:create:error:invalid_aes_claims
    • session:create:error:failed_aes_descryption

Event session:context:update

Used after initial form submission or reconnection. This event updates the session context with new information.

FieldTypeDescription
session_idstringRequired session identifier
contextContextObjectRequired context information
timestampintegerRequired timestamp of the update

Example payload:

{
"session_id": "550e8400-e29b-41d4-a716-446655440000",
"context": {
"user_id": "550e8400-e29b-41d4-a716-446655440000",
"language": "en",
"department": "support",
"priority": "high"
},
"timestamp": 1678901234
}

Server responses

  • On success session:context:updated
  • On failure session:context:update:error

Event session:reconnect

Reconnect using a previously stored session ID. This event attempts to restore a previous session.

FieldTypeDescription
session_idstringRequired session identifier
timestampintegerRequired timestamp of reconnect

Example payload:

{
"session_id": "550e8400-e29b-41d4-a716-446655440000",
"timestamp": 1678901234
}

Server responses

  • On success session:reconnected
  • On failure session:reconnect:error

Event session:overview

Check for available live agents and estimated wait times. This event retrieves information about current service availability.

FieldTypeDescription
session_idstringRequired session identifier

Example payload:

{
"session_id": "550e8400-e29b-41d4-a716-446655440000"
}

Server responses

  • On success session:overview
  • On failure session:overview:error

Event session:close

Sent when the user ends the session. This event gracefully terminates the current session.

FieldTypeDescription
session_idstringRequired session identifier

Example payload:

{
"session_id": "550e8400-e29b-41d4-a716-446655440000"
}

Server responses

  • On success: no response expected.
  • On failure session:status:error

Event session:rating

Submit a session rating. This event allows users to provide feedback about their session experience.

FieldTypeDescription
session_idstringRequired session identifier
timestampintegerRequired timestamp of the rating
ratingintegerRequired rating value (0–10)
feedbackstringOptional feedback text (max 280 characters)

Example payload:

{
"session_id": "550e8400-e29b-41d4-a716-446655440000",
"timestamp": 1678901234,
"rating": 9,
"feedback": "The agent was very helpful and resolved my issue quickly."
}

Server responses

  • On success session:rated
  • On failure session:rating:error

Event session:activity

Indicates active user interaction. This event keeps the session alive by showing user activity.

FieldTypeDescription
session_idstringRequired session identifier
timestampintegerRequired timestamp of activity

Example payload:

{
"session_id": "550e8400-e29b-41d4-a716-446655440000",
"timestamp": 1678901234
}

Server responses

  • On success: no response.
  • On failure session:activity:error

Event session:history:sync

Used after reconnecting to retrieve past messages. This event synchronizes the conversation history.

FieldTypeDescription
session_idstringRequired session identifier
timestampintegerRequired timestamp of sync

Example payload:

{
"session_id": "550e8400-e29b-41d4-a716-446655440000",
"timestamp": 1678901234
}

Server responses

  • On success session:history:synced
  • On failure session:history:sync:error

Event conversation:reopen

Reopen a resolved live agent conversation. This event reactivates a previously closed conversation.

FieldTypeDescription
session_idstringRequired session identifier

Example payload:

{
"session_id": "550e8400-e29b-41d4-a716-446655440000"
}

Server responses

  • On success: no response.
  • On failure session:status:error

Event message:send

Send a message (text or media). This event allows users to send messages and attachments to the conversation.

FieldTypeDescription
inputobjectMessage content and attachments
session_idstringRequired session identifier
contextContextObjectOptional context information
timestampintegerRequired timestamp of the message

Example payload:

{
"input": {
"text": "Hello, I need help with my account",
"type": "text",
"attachments": [
{
"type": "image",
"mime_type": "image/jpeg",
"id": "550e8400-e29b-41d4-a716-446655440000",
"url": "https://example.com/image.jpg",
"title": "Account Screenshot",
"filename": "screenshot.jpg"
}
]
},
"session_id": "550e8400-e29b-41d4-a716-446655440000",
"context": {
"user_id": "550e8400-e29b-41d4-a716-446655440000",
"language": "en"
},
"timestamp": 1678901234
}

Server responses

  • On success: the server will not respond to the connection that sent the event. It will respond to other open connections for this session with: Type message:send:sync and payload the same as the one received in the message:send event.
  • On failure message:send:error

Event message:read

Mark a message as read. This event indicates that a message has been viewed by the user.

FieldTypeDescription
session_idstringRequired session identifier
timestampintegerRequired timestamp of read

Example payload:

{
"session_id": "550e8400-e29b-41d4-a716-446655440000",
"timestamp": 1678901234
}

Server responses

  • On success: no response.
  • On failure message:read:error

Event message:delivered

Confirm message delivery. This event acknowledges that a message has been received by the client.

FieldTypeDescription
session_idstringRequired session identifier
timestampintegerRequired timestamp of delivery

Example payload:

{
"session_id": "550e8400-e29b-41d4-a716-446655440000",
"timestamp": 1678901234
}

Server responses

  • On success: no response.
  • On failure message:delivered:error

Event message:compose

Indicate whether the user is typing. This event shows typing indicators to other participants.

FieldTypeDescription
session_idstringRequired session identifier
actionstringRequired: "start" or "stop"
timestampintegerRequired timestamp of the typing event

Example payload:

{
"session_id": "550e8400-e29b-41d4-a716-446655440000",
"action": "start",
"timestamp": 1678901234
}

Server responses

  • On success: no response.
  • On failure message:compose:error

Event message:rating

Rate a specific AI message. This event allows users to provide feedback on individual AI responses.

FieldTypeDescription
session_idstringRequired session identifier
timestampintegerRequired timestamp of the rating
request_idstringRequired ID of the rated message
valueintegerRequired rating value (-1, 0, or 1)

Example payload:

{
"session_id": "550e8400-e29b-41d4-a716-446655440000",
"timestamp": 1678901234,
"request_id": "550e8400-e29b-41d4-a716-446655440000",
"value": 1
}

Server responses

  • On success message:rated
  • On failure message:rating:error

Event file:upload_url:create

Request a signed upload URL for a file. This event initiates the file upload process.

FieldTypeDescription
session_idstringRequired session identifier
file_typestringRequired type of file
file_idstringRequired unique file identifier
original_namestringRequired original filename

Example payload:

{
"session_id": "550e8400-e29b-41d4-a716-446655440000",
"file_type": "image",
"file_id": "550e8400-e29b-41d4-a716-446655440000",
"original_name": "example.jpg"
}

Server responses

  • On success file:upload_url:created
  • On failure file:upload_url:create:error

Event file:download_url:create

Request a signed download URL for a file. This event initiates the file download process.

FieldTypeDescription
session_idstringRequired session identifier
file_idstringRequired unique file identifier
file_namestringRequired name of the file
original_namestringRequired original filename

Example payload:

{
"session_id": "550e8400-e29b-41d4-a716-446655440000",
"file_id": "550e8400-e29b-41d4-a716-446655440000",
"file_name": "example.jpg",
"original_name": "example.jpg"
}

Server responses

  • On success file:download_url:created
  • On failure file:download_url:create:error