Real-time Call Events
The/events
endpoint provides real-time Server-Sent Events (SSE) streaming for active calls, allowing you to monitor conversation flow, transcription updates, workflow transitions, and performance metrics as they happen.
Endpoint Overview
URL:GET /events
Protocol: Server-Sent Events (SSE)
Authentication: Bearer Token
Content-Type:
text/event-stream
title: “Real-time Events Stream” description: “Complete guide to consuming Server-Sent Events from the /events API endpoint” icon: “bolt” # Add this line with your preferred icon
Real-time Call Events
The/events
endpoint provides real-time Server-Sent Events (SSE) streaming for active calls, allowing you to monitor conversation flow, transcription updates, workflow transitions, and performance metrics as they happen.
Endpoint Overview
URL:GET /events
Protocol: Server-Sent Events (SSE)
Authentication: Bearer Token
Content-Type:
text/event-stream
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
callId | string | Yes | The unique identifier for the call to monitor |
Authentication
Include your API token in the Authorization header:Connection Examples
cURL
JavaScript (Node.js)
Event Types Reference
Connection Events
SSE Initialization
Sent when the SSE connection is established.SSE Connection Close
Sent when the connection is terminated, with reason.Call Lifecycle Events
Call Start
Indicates the beginning of a call session.Transcription Events
User Transcription (Final)
Final transcription of user speech.User Interim Transcription
Partial transcription as user speaks (real-time).Agent Workflow Events
Agent Node State
Indicates agent workflow state changes with complete context.Node Transitions (Hopping)
When the agent moves from one workflow node to another.LLM Response Events
LLM Full Response End
Complete response generated by the language model.Text-to-Speech Events
TTS Completion
When text-to-speech generation finishes.Performance Metrics
Turn Latency
Measures response time between user input and agent response.Service Metrics
Performance metrics for various processing components.LLM Token Usage
Tracks token consumption and processing time for language model calls.Common Event Fields
All events include these base fields:Field | Type | Description |
---|---|---|
event_type | string | Type of event (see Event Types above) |
event_id | string | Unique identifier for this specific event |
timestamp | number | Unix timestamp with microsecond precision |
call_id | string | The call this event belongs to |
Connection Management
Connection Lifecycle
- Establish Connection: Send GET request with valid call ID and auth token
- Receive sse_init: Confirms connection establishment
- Stream Events: Receive real-time events as they occur
- Handle Disconnection: Connection closes when call ends or on error
Error Handling
Monitor forsse_close
events which indicate connection termination:
- Call log not found: Invalid or non-existent call ID
- Agent not found: Call ID valid but associated agent not accessible
- Unauthorized: Invalid or expired authentication token
- Error consuming events: Internal server error
Reconnection Strategy
Implement exponential backoff for reconnections:Real-world Usage Patterns
Live Call Dashboard
Monitor multiple calls simultaneously by establishing separate SSE connections for each active call.Call Analytics
Processmetrics
events to build real-time performance dashboards showing:
- Average response times
- TTS processing latency
- Token usage patterns
- Conversation flow efficiency
Quality Monitoring
Track transcription accuracy and agent response appropriateness by monitoring:user_transcription
events for input qualityagent_node_state
events for workflow adherencellm_full_response_end
events for response quality
Integration Webhooks
Combine SSE events with your existing webhook infrastructure to trigger actions based on real-time call events.Troubleshooting
No Events Received:- Verify the call is currently active or recently completed
- Check that the call ID format is correct:
CALL-XXXXXXXXX-XXXXXX
- Ensure your authentication token has access to the specified call
- Implement automatic reconnection with exponential backoff
- Monitor network connectivity
- Check for authentication token expiration
- Some events only occur during specific call phases
- Workflow events depend on agent configuration
- Metrics events vary by enabled services
- Implement client-side filtering for relevant event types
- Use batching to process multiple events together
- Consider sampling for high-frequency metrics events
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
callId | string | Yes | The unique identifier for the call to monitor |
Authentication
Include your API token in the Authorization header:Connection Examples
cURL
JavaScript (Node.js)
Event Types Reference
Connection Events
SSE Initialization
Sent when the SSE connection is established.SSE Connection Close
Sent when the connection is terminated, with reason.Call Lifecycle Events
Call Start
Indicates the beginning of a call session.Transcription Events
User Transcription (Final)
Final transcription of user speech.User Interim Transcription
Partial transcription as user speaks (real-time).Agent Workflow Events
Agent Node State
Indicates agent workflow state changes with complete context.Node Transitions (Hopping)
When the agent moves from one workflow node to another.LLM Response Events
LLM Full Response End
Complete response generated by the language model.Text-to-Speech Events
TTS Completion
When text-to-speech generation finishes.Performance Metrics
Turn Latency
Measures response time between user input and agent response.Service Metrics
Performance metrics for various processing components.LLM Token Usage
Tracks token consumption and processing time for language model calls.Common Event Fields
All events include these base fields:Field | Type | Description |
---|---|---|
event_type | string | Type of event (see Event Types above) |
event_id | string | Unique identifier for this specific event |
timestamp | number | Unix timestamp with microsecond precision |
call_id | string | The call this event belongs to |
Connection Management
Connection Lifecycle
- Establish Connection: Send GET request with valid call ID and auth token
- Receive sse_init: Confirms connection establishment
- Stream Events: Receive real-time events as they occur
- Handle Disconnection: Connection closes when call ends or on error
Error Handling
Monitor forsse_close
events which indicate connection termination:
- Call log not found: Invalid or non-existent call ID
- Agent not found: Call ID valid but associated agent not accessible
- Unauthorized: Invalid or expired authentication token
- Error consuming events: Internal server error
Reconnection Strategy
Implement exponential backoff for reconnections:Real-world Usage Patterns
Live Call Dashboard
Monitor multiple calls simultaneously by establishing separate SSE connections for each active call.Call Analytics
Processmetrics
events to build real-time performance dashboards showing:
- Average response times
- TTS processing latency
- Token usage patterns
- Conversation flow efficiency
Quality Monitoring
Track transcription accuracy and agent response appropriateness by monitoring:user_transcription
events for input qualityagent_node_state
events for workflow adherencellm_full_response_end
events for response quality
Integration Webhooks
Combine SSE events with your existing webhook infrastructure to trigger actions based on real-time call events.Troubleshooting
No Events Received:- Verify the call is currently active or recently completed
- Check that the call ID format is correct:
CALL-XXXXXXXXX-XXXXXX
- Ensure your authentication token has access to the specified call
- Implement automatic reconnection with exponential backoff
- Monitor network connectivity
- Check for authentication token expiration
- Some events only occur during specific call phases
- Workflow events depend on agent configuration
- Metrics events vary by enabled services
- Implement client-side filtering for relevant event types
- Use batching to process multiple events together
- Consider sampling for high-frequency metrics events