Call
The Call module allows you to dispatch calls to phone numbers using your agents, and retrieve call logs for monitoring and analysis purposes.
Overview
The Call API enables you to programmatically initiate calls and manage call logs:
- Dispatch calls to phone numbers using your configured agents
- Retrieve call logs with pagination and filtering options
- Get detailed information about specific call sessions
Dispatch Call
Initiate a call to a phone number using a specified agent.
Parameters
The ID of the agent that will handle the call
The phone number to call (must include country code, e.g., +15551234567)
Optional context information as key-value pairs to be passed to the agent during the call. Can contain any custom fields relevant to your use case.
Example
1
2
3
4
5
6
7
8
9
10
11
# Dispatch a call to a specific number using an agent
agent_id = 123 # Replace with your agent ID
to_number = "+15551234567" # Must include country code
call_context = {
"customer_name": "John Doe",
"account_id": "ACC-12345",
"priority": "high"
}
response = client.call.dispatch_call(agent_id, to_number, call_context)
print(response)
Note
Get Call Logs
Retrieve a list of call logs with pagination and optional filtering.
Parameters
Page number for pagination (default: 1)
Number of items per page (default: 30)
Filter call logs by agent ID
Example
1
2
3
4
5
6
7
8
# Get all call logs with pagination
response = client.call.get_call_logs(page=1, page_size=10)
print(response)
# Filter call logs by agent ID
agent_id = 123 # Replace with your agent ID
response = client.call.get_call_logs(page=1, page_size=10, agent_id=agent_id)
print(response)
Get Call Log
Get detailed information about a specific call log.
Parameters
The ID of the call log to retrieve
Example
1
2
3
4
# Get details of a specific call log
call_log_id = "your_call_log_id_here"
response = client.call.get_call_log(call_log_id)
print(response)