Skip to main content
Use the AgentCallback API to run a CSV-backed outbound campaign from start to finish.

Before you begin

You need an API key, an outbound agent, and an active outbound phone number in your organization. The agent must already contain any variables that you map from the CSV. This guide uses these placeholders:
Only upload contacts you are allowed to call. You are responsible for consent, local calling restrictions, and any applicable do-not-call requirements.
1

Prepare and upload the CSV

Your CSV needs a header row. The phone column and any mapped variable columns must use the same names you send when creating the campaign.
Upload the file with multipart/form-data. The file field must be named file; CSV files can be up to 10 MB.
The response contains the ID you will use as file_upload_id.
You can list the CSV files available to your organization at any time:
2

Create a draft campaign with a workflow

Create the campaign with the returned file_upload_id. AgentCallback imports the CSV rows into the campaign when it is created.The phone_number_column value must match the CSV phone header. Each key in script_variables must be the name of an agent variable, and its value must match the corresponding CSV header.This example also adds a workflow. Each contact receives the initial call when the campaign starts. If that call reaches voicemail or is not answered, AgentCallback tries again at 4:00 PM on day 1 and 10:00 AM on day 3.
The response includes campaign.id. Save it as YOUR_CAMPAIGN_ID for the remaining requests.
Omit scheduled_date and scheduled_time to create a draft. To create a scheduled campaign, provide both fields and optionally set scheduled_timezone_input. Do not send start_immediately; that field is not part of the API.
The working_hours object always uses the shape { weekly: { day: [{ start, end }] } }. Times use 24-hour HH:mm format. working_hours_timezone is optional; when omitted, working hours inherit campaign_timezone.The first workflow entry { "day": 0, "startTime": "00:00", "doubleDial": false } represents only the first attempt, whose timing follows the campaign start. With doubleDial: false, AgentCallback dials once for that attempt. To schedule a second attempt, you must add a second item to attempts, such as the day-1 entry in this example. Later entries are follow-ups relative to when the contact enters the campaign. Keep them in chronological order and within the campaign’s working hours. You can omit the workflow timezone to inherit campaign_timezone.
3

Configure the post-call webhook

Post-call webhooks belong to the agent, so configure the webhook before you start the campaign. It will receive call data for calls that use that agent.In the dashboard, open the agent used by the campaign, open Post-call Webhook, enable it, and set YOUR_WEBHOOK_URL as the destination. Choose POST unless your endpoint specifically requires GET.If you manage agents through the API, include this object in the complete PUT /api/scripts/YOUR_SCRIPT_ID agent configuration:
Keep the agent’s other current fields in that PUT request. See Post-call webhooks for delivery details, trigger conditions, and the default payload.
4

Start the campaign

Starting a draft campaign queues eligible contacts. Calls run only during the configured working hours.
5

Retrieve outcomes and export calls

Calls are asynchronous. Query the campaign’s calls after they begin completing by passing campaign_id to the call log endpoint. The response contains call status, phone number, summary, and transcript fields where available.
Each call carries its transcript twice: call_transcript is the flat Speaker: text string, and call_transcript_messages is the same conversation as individual utterances.
speaker is either Agent or Customer, message_index is the utterance’s zero-based position in chronological order, and voice_start_at is a UTC timestamp — null for calls recorded before per-message timing was captured.To download the campaign’s calls as CSV:
You can also review the campaign and webhook delivery details in Call logs.

Next steps