Messaging API
Campaigns
Send an approved WhatsApp template to a list of contacts.
A campaign sends one approved template to an audience of contacts. You need a connected channel first.
1. Create the campaign
POST
https://api.tryvox.io/v1/messaging/campaignsA new campaign starts as a draft and sends nothing until you start it.
| Field | Type | Required | Description |
|---|---|---|---|
channel_id | string | Yes | A channel on your account |
name | string | Yes | Campaign name |
template_name | string | Yes | An approved template on the channel |
audience_type | string | Yes | all, tags, manual, or segment |
audience_tags | string | Conditional | The tags for tags, or the segment ID for segment |
contact_ids | array | Conditional | The contacts for manual |
template_params | string | No | Template parameters |
batch_size | integer | No | Messages per batch |
batch_delay_ms | integer | No | Delay between batches, in milliseconds |
scheduled_at | string | No | Send time, as an RFC 3339 timestamp |
curl -X POST https://api.tryvox.io/v1/messaging/campaigns \
-u $TRYVOX_AUTH_ID:$TRYVOX_AUTH_TOKEN \
-H "Content-Type: application/json" \
-d '{
"channel_id": "<channel-id>",
"name": "November offer",
"template_name": "november_offer",
"audience_type": "tags",
"audience_tags": "vip"
}'To preview the recipient count and estimated cost first, send the same audience fields to POST /v1/messaging/campaigns/estimate.
2. Start it
curl -X POST https://api.tryvox.io/v1/messaging/campaigns/$CAMPAIGN_ID/start \
-u $TRYVOX_AUTH_ID:$TRYVOX_AUTH_TOKENA successful request returns 204 No Content.
3. Track and control it
| Method | Path | Purpose |
|---|---|---|
GET | /v1/messaging/campaigns | List campaigns |
GET | /v1/messaging/campaigns/{id} | Get status and counts |
GET | /v1/messaging/campaigns/{id}/recipients | Per-recipient status |
POST | /v1/messaging/campaigns/{id}/pause | Pause |
POST | /v1/messaging/campaigns/{id}/resume | Resume |
POST | /v1/messaging/campaigns/{id}/cancel | Cancel |
DELETE | /v1/messaging/campaigns/{id} | Delete |
A campaign includes status, total_recipients, sent_count, delivered_count, read_count, failed_count, and skipped_count.
status is one of draft, scheduled, sending, running, paused, completed, or cancelled.