Connect to Live Call WebSocket Stream
GET/ws/v1/liveCalls
WebSocket Endpoint - This endpoint establishes a WebSocket connection for real-time communication during an active call.
Connection Establishment
This is a WebSocket endpoint, not a standard HTTP GET request. To connect:
- Initiate an HTTP GET request to this endpoint with the required
conversationTokenquery parameter - Include the
Upgrade: websocketandConnection: Upgradeheaders - Include the
Authorization: Bearer <token>header for authentication - The server will respond with HTTP 101 Switching Protocols to complete the WebSocket handshake
Message Format
All messages are JSON objects. Each message must include a type field that acts as a discriminator to identify the message type.
Bidirectional Communication
Once connected, the WebSocket supports bidirectional message flow:
Client-to-Server Messages
The client can send the following message types:
-
client:joinCall- Request to transfer the call to user- Schema:
WebSocketClientJoinCallMessage - Required fields:
type,id
- Schema:
-
client:endCall- Request to end the call to user- Schema:
WebSocketClientEndCallMessage - Required fields:
type,id
- Schema:
See WebSocketClientMessage for the complete union type.
Server-to-Client Messages
The server will send the following message types:
-
ack- Acknowledgment of a client message- Schema:
WebSocketClientAck - Contains:
type,ackId(references the client messageid)
- Schema:
-
event:start- Call start event- Schema:
WebSocketCallStartMessage - Contains:
type,phone(E.164 format),timestamp(ISO 8601)
- Schema:
-
event:end- Screening phase end event- Schema:
WebSocketScreeningEndMessage - Contains:
type,msg(description message)
- Schema:
-
event:callEnd- Call end event- Schema:
WebSocketCallEndMessage - Contains:
type,timestamp(ISO 8601)
- Schema:
-
transcript- Real-time transcript update- Schema:
WebSocketTranscriptMessage - Contains:
type,msg(transcript text),role(assistant|other|user),offset(optional)
- Schema:
-
error- Error message- Schema:
WebSocketErrorMessage - Contains:
type,description(error description)
- Schema:
See WebSocketServerMessage for the complete union type.
Connection Lifecycle
- Client establishes WebSocket connection with
conversationToken - Client may send
client:joinCallto join the conversation - Server sends events as they occur (call start, screening end, transcripts, call end)
- Server acknowledges client messages with
ackmessages - Client may send
client:endCallto request call termination - Connection closes when call ends or on error
Error Handling
If an error occurs, the server will send an error message with a description. The connection may remain open or close depending on the error severity.
Query Parameters
The conversation token obtained from the call log entry's liveConversationToken field.
This token is required to authenticate and connect to the live call WebSocket stream.
Header Parameters
Product version. The standard "major.minor.patch" format is highly encouraged without any leading characters; "2.1.3" or "3.0.0" for example.
The identifier of a logged-in user. Same identifier that is used for /users/{user_id}
Responses
- 101
- 400
- 401
- 404
- 500
Switching Protocols - The server is switching to the WebSocket protocol. After this response, the connection is upgraded to a WebSocket connection and bidirectional message communication begins.
Headers
Upgrade
string
Connection
string
Bad Request - Invalid conversation token or missing required parameters
Response Body
Unauthorized - Invalid or missing authentication token
Response Body
Not Found - Conversation token not found or call no longer active
Response Body
Internal Server Error
Response Body