Campaigns
Personalised bulk sends with an audience, merge fields, a schedule, throttling, approvals and reports.
A campaign is a bulk send with more control than send-bulk: personalised text, one-off or recurring schedules, throttling, quiet hours, approvals and a report per recipient.
The steps
POST /v1/campaigns: create a draft with the text and audience.POST /v1/campaigns/{id}/prepare: build the audience and get the exact cost.GET /v1/campaigns/{id}/review: see what blocks the launch, and warnings.POST /v1/campaigns/{id}/test: send a test to up to 3 of your own numbers.POST /v1/campaigns/{id}/launch: send now, schedule, or submit for approval.GET /v1/campaigns/{id}/report: read the result.
Or do it in one call with "launch": true on create.
Create
curl -X POST "https://api.sms.jtnoble.com/v1/campaigns" \
-H "Authorization: Bearer $JTSMS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"Term 2 notice","text":"Hello {name|friend}, term 2 fees are due.","recipients":[{"to":"+2348030001161","vars":{"name":"Ada"}},{"to":"+2348030001162"}],"tags":["docs"]}'const resp = await fetch('https://api.sms.jtnoble.com/v1/campaigns', {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.JTSMS_API_KEY}`, 'Content-Type': 'application/json' },
body: JSON.stringify({"name":"Term 2 notice","text":"Hello {name|friend}, term 2 fees are due.","recipients":[{"to":"+2348030001161","vars":{"name":"Ada"}},{"to":"+2348030001162"}],"tags":["docs"]}),
});
console.log(resp.status, await resp.text());import os
import requests
resp = requests.post(
"https://api.sms.jtnoble.com/v1/campaigns",
headers={"Authorization": f"Bearer {os.environ['JTSMS_API_KEY']}"},
json={"name":"Term 2 notice","text":"Hello {name|friend}, term 2 fees are due.","recipients":[{"to":"+2348030001161","vars":{"name":"Ada"}},{"to":"+2348030001162"}],"tags":["docs"]},
timeout=30,
)
print(resp.status_code, resp.text)<?php
$ch = curl_init('https://api.sms.jtnoble.com/v1/campaigns');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('JTSMS_API_KEY'), 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => '{"name":"Term 2 notice","text":"Hello {name|friend}, term 2 fees are due.","recipients":[{"to":"+2348030001161","vars":{"name":"Ada"}},{"to":"+2348030001162"}],"tags":["docs"]}',
]);
$body = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), ' ', $body, PHP_EOL;| Field | Meaning |
|---|---|
name | A name for your reports. |
text | The message, with merge fields such as {name}. See Merge fields. |
template_id | A saved template instead of text. |
recipients | Numbers in the request: to, and optionally name, vars. Up to 10,000. |
contact_list_ids, segment_id, audience | Saved audiences. audience is a list of sources: import, group, segment or numbers. |
sender_id | Your sender. sender_fallback uses the default sender where yours is not approved. |
message_type | transactional or promotional. |
schedule | mode (now, scheduled, recurring), at, timezone, recurrence. |
throttle_per_minute | Pace, 1 to 20,000 messages per minute. |
quiet_hours | {"enabled": true, "start": "21:00", "end": "08:00"}. Nothing goes out in these hours. |
callback_url | Public URL for this campaign's events. |
launch | true creates and launches in one call. |
Add an Idempotency-Key header to make a retry safe.
HTTP 201 returns the campaign with "status": "draft".
Prepare and review
curl -X POST "https://api.sms.jtnoble.com/v1/campaigns/CAMPAIGN_ID/prepare" \
-H "Authorization: Bearer $JTSMS_API_KEY"const resp = await fetch('https://api.sms.jtnoble.com/v1/campaigns/CAMPAIGN_ID/prepare', {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.JTSMS_API_KEY}` },
});
console.log(resp.status, await resp.text());import os
import requests
resp = requests.post(
"https://api.sms.jtnoble.com/v1/campaigns/CAMPAIGN_ID/prepare",
headers={"Authorization": f"Bearer {os.environ['JTSMS_API_KEY']}"},
timeout=30,
)
print(resp.status_code, resp.text)<?php
$ch = curl_init('https://api.sms.jtnoble.com/v1/campaigns/CAMPAIGN_ID/prepare');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('JTSMS_API_KEY')],
]);
$body = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), ' ', $body, PHP_EOL;{
"status": "ready",
"estimate": {
"recipients": 2,
"duplicates": 0,
"total_segments": 2,
"total_cost": 70.0,
"currency": "USD",
"balance": 5000.0,
"sufficient_balance": true
},
"review": { "blocking": [], "warnings": [], "can_launch": true }
}Anything in blocking stops the launch (HTTP 422, code launch_blocked).
Launch
curl -X POST "https://api.sms.jtnoble.com/v1/campaigns/CAMPAIGN_ID/launch" \
-H "Authorization: Bearer $JTSMS_API_KEY"const resp = await fetch('https://api.sms.jtnoble.com/v1/campaigns/CAMPAIGN_ID/launch', {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.JTSMS_API_KEY}` },
});
console.log(resp.status, await resp.text());import os
import requests
resp = requests.post(
"https://api.sms.jtnoble.com/v1/campaigns/CAMPAIGN_ID/launch",
headers={"Authorization": f"Bearer {os.environ['JTSMS_API_KEY']}"},
timeout=30,
)
print(resp.status_code, resp.text)<?php
$ch = curl_init('https://api.sms.jtnoble.com/v1/campaigns/CAMPAIGN_ID/launch');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('JTSMS_API_KEY')],
]);
$body = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), ' ', $body, PHP_EOL;{ "status": "sending", "campaign_id": 3, "batch_id": "ed5032ec-fa72-46e6-9afa-2ab59196ca16", "total_recipients": 2, "estimated_cost": 70.0 }status | Meaning |
|---|---|
sending | Started. |
scheduled | Waiting for its time. |
pending_approval | Waiting for an approver (the workspace asks for approval above a size or cost). |
Follow it
curl -X GET "https://api.sms.jtnoble.com/v1/campaigns/CAMPAIGN_ID/report" \
-H "Authorization: Bearer $JTSMS_API_KEY"const resp = await fetch('https://api.sms.jtnoble.com/v1/campaigns/CAMPAIGN_ID/report', {
method: 'GET',
headers: { Authorization: `Bearer ${process.env.JTSMS_API_KEY}` },
});
console.log(resp.status, await resp.text());import os
import requests
resp = requests.get(
"https://api.sms.jtnoble.com/v1/campaigns/CAMPAIGN_ID/report",
headers={"Authorization": f"Bearer {os.environ['JTSMS_API_KEY']}"},
timeout=30,
)
print(resp.status_code, resp.text)<?php
$ch = curl_init('https://api.sms.jtnoble.com/v1/campaigns/CAMPAIGN_ID/report');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('JTSMS_API_KEY')],
]);
$body = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), ' ', $body, PHP_EOL;| Route | What it shows |
|---|---|
GET /v1/campaigns/{id}/stats | Live counts. |
GET /v1/campaigns/{id}/report | Totals, rate, cost and timing. |
GET /v1/campaigns/{id}/recipients | Each person's status. Also /recipients/export. |
GET /v1/campaigns/{id}/runs | Each run of a recurring campaign. |
Controls: /pause, /resume, /cancel (messages already on their way finish) and /retry-failed. /duplicate makes a new draft.
Recurring
{
"name": "Monday reminder",
"text": "Fees are due this week.",
"contact_list_ids": [12],
"schedule": {
"mode": "recurring",
"timezone": "Africa/Lagos",
"recurrence": { "freq": "weekly", "weekdays": [0], "time": "09:00", "until": "2026-12-31" }
}
}freq is daily, weekly, monthly or cron. With monthly use monthday, with cron use cron, and count stops after that many runs.
One-call batch
POST /v1/messages/batch sends personalised messages to a list in one call, and runs as a campaign.
curl -X POST "https://api.sms.jtnoble.com/v1/messages/batch" \
-H "Authorization: Bearer $JTSMS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"template":"Hello {name}, code {code|none}","recipients":[{"to":"+2348030001131","vars":{"name":"Ada","code":"A1"}}],"name":"Doc batch"}'const resp = await fetch('https://api.sms.jtnoble.com/v1/messages/batch', {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.JTSMS_API_KEY}`, 'Content-Type': 'application/json' },
body: JSON.stringify({"template":"Hello {name}, code {code|none}","recipients":[{"to":"+2348030001131","vars":{"name":"Ada","code":"A1"}}],"name":"Doc batch"}),
});
console.log(resp.status, await resp.text());import os
import requests
resp = requests.post(
"https://api.sms.jtnoble.com/v1/messages/batch",
headers={"Authorization": f"Bearer {os.environ['JTSMS_API_KEY']}"},
json={"template":"Hello {name}, code {code|none}","recipients":[{"to":"+2348030001131","vars":{"name":"Ada","code":"A1"}}],"name":"Doc batch"},
timeout=30,
)
print(resp.status_code, resp.text)<?php
$ch = curl_init('https://api.sms.jtnoble.com/v1/messages/batch');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('JTSMS_API_KEY'), 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => '{"template":"Hello {name}, code {code|none}","recipients":[{"to":"+2348030001131","vars":{"name":"Ada","code":"A1"}}],"name":"Doc batch"}',
]);
$body = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), ' ', $body, PHP_EOL;HTTP 202:
{
"batch_id": "c68dccfc-5966-4fc6-9877-1308ef45e1b2",
"campaign_id": 2,
"status": "sending",
"accepted": 1,
"rejected": [],
"rejected_count": 0,
"estimated_cost": 35.0,
"currency": "USD",
"idempotent_replay": false,
"environment": "live",
"livemode": true
}Numbers that cannot be used are listed in rejected, and the others are sent. To give each person a full text, use messages with to and text.
Events
Set campaign_url on your webhooks, or callback_url on the campaign, to get campaign.started, campaign.paused, campaign.cancelled and campaign.completed:
{
"event": "campaign.completed",
"campaign_id": 3,
"batch_id": "ed5032ec-fa72-46e6-9afa-2ab59196ca16",
"name": "Term 2 notice",
"status": "completed",
"environment": "live",
"livemode": true,
"recipients": 2,
"sent": 2,
"failed": 0,
"skipped": 0,
"spent": 70.0,
"currency": "USD",
"tags": [],
"started_at": "2026-11-07T10:00:00+00:00",
"completed_at": "2026-11-07T10:01:00+00:00",
"report_url": "https://app.sms.jtnoble.com/campaigns/3"
}See all campaign routes.