Guides

Campaign Deep Dive

Advanced campaign configuration including modes, channels, caller ID strategy, AMD detection, and stats interpretation.

Master the campaign system — from mode configuration to caller ID rotation to reading real-time stats. Campaigns support two channels: voice and SMS.

Campaign Channels

Set channel when creating a campaign:

ChannelDescriptionSending windowPacing
voice (default)Outbound calling with AMD, VM deposit, AI handoff8 AM – 9 PM (TCPA)calls_per_second batch rate
smsHuman-like bulk SMS7 AM – 7 PM~4 msgs/DID/hr, 15-min gaps

Campaign Modes

The mode field is a flexible JSON object. Fields vary by channel.

Voice mode fields

FieldTypeDescription
aibooleanEnable AI agent for live calls
voicemailAudioUrlstringURL of audio to play when voicemail is detected
calls_per_secondnumberDialing rate limit
max_retriesnumberMaximum retry attempts per prospect
retry_delaystringDelay between retries (e.g. "4h", "30m")

SMS mode fields

FieldTypeDescription
messagestringRequired. The SMS body text sent to each prospect

Common Mode Configurations

{
  "channel": "voice",
  "mode": {
    "voicemailAudioUrl": "https://api.trunx.io/audio/aud_001/file",
    "max_retries": 2,
    "retry_delay": "4h"
  }
}

Drop a voicemail on every machine. Retry no-answers up to 2 times.

{
  "channel": "voice",
  "mode": {
    "ai": true,
    "voicemailAudioUrl": "https://api.trunx.io/audio/aud_001/file",
    "calls_per_second": 10,
    "max_retries": 2,
    "retry_delay": "4h"
  }
}

AI agent handles live pickups. Voicemail gets a recording. No-answers retry.

{
  "channel": "voice",
  "mode": {
    "ai": true,
    "calls_per_second": 5
  }
}

Only spend AI minutes on humans who actually pick up. Skip voicemail.

{
  "channel": "sms",
  "mode": {
    "message": "Hi, this is Acme Solar. We have a special offer for homeowners in your area. Reply YES to learn more."
  }
}

Human-like SMS drip. ~4 messages per DID per hour, 15-minute gaps between sends.

AMD Detection

Answering Machine Detection listens to the first few seconds of a call to determine who picked up.

ResultMeaning
humanA person answered
machineVoicemail greeting playing (no beep yet)
machine_end_beepGreeting finished, beep detected — safe to play audio
unknownCould not determine — defaults to human behavior

Trunx supports multiple AMD engines optimized for different latency and cost profiles. Self-hosted customers can configure the AMD provider via the ACTIVE_AMD_PROVIDER environment variable.

The machine_end_beep result is critical for voicemail deposits. Your audio starts playing immediately after the beep, so the recipient hears a clean message.

Caller ID Strategy

The callerIdStrategy field controls which DID is used for each dial. It is a flexible JSON object — all fields are optional with sensible defaults.

Example configuration for a 5,000-prospect campaign:

{
  "callerIdStrategy": {
    "selection": "health_score",
    "local_presence": true
  }
}

The callerIdStrategy field uses camelCase (not caller_id_strategy). This applies to the create campaign request body.

Reading Campaign Stats

GET /campaigns/:id/stats

curl https://api.trunx.io/campaigns/camp_abc123/stats \
  -H "Authorization: Bearer $TRUNX_API_KEY"

The response is a flat JSON object with camelCase field names:

{
  "total": 5000,
  "queued": 2100,
  "dialing": 10,
  "completed": 2890,
  "failed": 49,
  "cancelled": 0,
  "noAnswer": 284,
  "busy": 42,
  "voicemail": 2312,
  "humanConnected": 203,
  "sending": 0,
  "sent": 0,
  "delivered": 0,
  "progress": 57
}

Fields explained

FieldTypeMeaning
totalnumberTotal prospects in the campaign
queuednumberWaiting to be dialed/sent
dialingnumberVoice call currently in-progress
completednumberFinished (any terminal outcome including delivered)
failednumberCall/message failed
cancellednumberCancelled before dialing/sending
noAnswernumberNo pickup within ring timeout (voice)
busynumberLine busy (voice)
voicemailnumberAMD detected machine, audio deposited (voice)
humanConnectednumberHuman answered, connected to agent (voice)
sendingnumberSMS being sent (SMS)
sentnumberSMS sent, awaiting delivery confirmation (SMS)
deliverednumberSMS delivered to recipient (SMS)
progressnumberCompletion percentage (0-100)

Campaign Lifecycle

Campaigns follow a strict status flow.

created → dialing → completed

          paused → dialing (resume)

         cancelled

Actions by Status

StatusAllowed Actions
createdStart, cancel
dialingPause, cancel
pausedResume, cancel
completedNone (terminal)
cancelledNone (terminal)
failedNone (terminal)

Lifecycle endpoints

All lifecycle endpoints return { id, name, status, channel }:

EndpointRequired Status
POST /campaigns/:id/startcreated
POST /campaigns/:id/pausedialing
POST /campaigns/:id/resumepaused
POST /campaigns/:id/cancelAny non-terminal

When a campaign is cancelled, all remaining queued prospects are automatically marked as cancelled.

Adding Prospects

Prospects are added separately from campaign creation using POST /campaigns/:id/prospects.

The request body takes a phones array of E.164 numbers (1 to 10,000 per request):

curl -X POST https://api.trunx.io/campaigns/camp_abc123/prospects \
  -H "Authorization: Bearer $TRUNX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "phones": ["+17145551001", "+16195551002", "+18185551003"]
  }'

Response:

{
  "added": 3
}

You can only add prospects when the campaign is in created or paused status.

On this page