Running Campaigns
This guide walks through the complete campaign lifecycle—from setup to cleanup.
Prerequisites
Before creating a campaign, you need:
- Agent ID — Create one with
new_agent()or use an existing agent - Audience ID — Create one with
create_audience()(see Audiences) - Phone Number ID — Retrieve available numbers with
get_phone_numbers()
Getting Your Phone Number
get_phone_numbers() returns all outbound phone numbers available for campaigns:
Each phone includes provider details:
Creating a Campaign
create() creates a campaign linking your agent, audience, and phone number:
The response includes all campaign details:
Campaign Parameters
Starting a Campaign
start() begins dialing contacts in the audience:
The response confirms the campaign is processing:
Monitoring Progress
get() returns the campaign status, execution history, and metrics:
Full status response:
Cleaning Up
delete() removes the campaign and its execution history:
Running campaigns should be paused before deletion. Use pause(id) first if needed.
SDK Reference
Tips
Why are contacts_called and contacts_connected different?
contacts_called counts dial attempts. contacts_connected counts answered calls. The difference represents voicemail, busy signals, and no-answers.
What happens when a call fails?
Failed calls enter the retry queue based on your max_retries and retry_delay settings. After all retries are exhausted, the contact is marked as failed.
Can I run multiple campaigns simultaneously?
Yes. Each campaign operates independently. Just ensure you have sufficient phone capacity for parallel dialing.
How do I change an agent mid-campaign?
Campaigns cannot change agents after creation. Create a new campaign with the desired agent and audience.

