What Are Campaigns?
Campaigns enable bulk message delivery to multiple recipients with centralized tracking and management.Creating a Campaign
curl -X POST https://api-message.nativehub.live/api/v1/campaigns \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Spring Promotion",
"template_id": "tmpl_abc123",
"sender_id": "sender_xyz789",
"schedule_at": "2026-03-01T09:00:00Z"
}'
const response = await fetch('https://api-message.nativehub.live/api/v1/campaigns', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Spring Promotion',
template_id: 'tmpl_abc123',
sender_id: 'sender_xyz789',
schedule_at: '2026-03-01T09:00:00Z'
})
});
const campaign = await response.json();
import requests
response = requests.post(
'https://api-message.nativehub.live/api/v1/campaigns',
headers={
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
json={
'name': 'Spring Promotion',
'template_id': 'tmpl_abc123',
'sender_id': 'sender_xyz789',
'schedule_at': '2026-03-01T09:00:00Z'
}
)
campaign = response.json()
Importing Recipients
CSV Format
CSV must include aphone column. Additional columns map to template variables:
phone,name,code
+1234567890,John,SAVE20
+9876543210,Jane,SAVE20
Upload Recipients
curl -X POST https://api-message.nativehub.live/api/v1/campaigns/cmp_abc123/recipients \
-H "Authorization: Bearer YOUR_TOKEN" \
-F "file=@recipients.csv"
const formData = new FormData();
formData.append('file', fs.createReadStream('recipients.csv'));
const response = await fetch(
'https://api-message.nativehub.live/api/v1/campaigns/cmp_abc123/recipients',
{
method: 'POST',
headers: { 'Authorization': 'Bearer YOUR_TOKEN' },
body: formData
}
);
const result = await response.json();
files = {'file': open('recipients.csv', 'rb')}
response = requests.post(
'https://api-message.nativehub.live/api/v1/campaigns/cmp_abc123/recipients',
headers={'Authorization': 'Bearer YOUR_TOKEN'},
files=files
)
result = response.json()
Duplicates and DNC numbers are automatically filtered during import.
Campaign Lifecycle
| Status | Description |
|---|---|
draft | Created, not started |
running | Actively sending |
paused | Temporarily stopped |
completed | All messages sent |
cancelled | Manually stopped |
Managing Campaigns
Start Campaign
curl -X POST https://api-message.nativehub.live/api/v1/campaigns/cmp_abc123/start \
-H "Authorization: Bearer YOUR_TOKEN"
await fetch('https://api-message.nativehub.live/api/v1/campaigns/cmp_abc123/start', {
method: 'POST',
headers: { 'Authorization': 'Bearer YOUR_TOKEN' }
});
requests.post(
'https://api-message.nativehub.live/api/v1/campaigns/cmp_abc123/start',
headers={'Authorization': 'Bearer YOUR_TOKEN'}
)
Pause Campaign
curl -X POST https://api-message.nativehub.live/api/v1/campaigns/cmp_abc123/pause \
-H "Authorization: Bearer YOUR_TOKEN"
await fetch('https://api-message.nativehub.live/api/v1/campaigns/cmp_abc123/pause', {
method: 'POST',
headers: { 'Authorization': 'Bearer YOUR_TOKEN' }
});
requests.post(
'https://api-message.nativehub.live/api/v1/campaigns/cmp_abc123/pause',
headers={'Authorization': 'Bearer YOUR_TOKEN'}
)
Cancel Campaign
curl -X POST https://api-message.nativehub.live/api/v1/campaigns/cmp_abc123/cancel \
-H "Authorization: Bearer YOUR_TOKEN"
await fetch('https://api-message.nativehub.live/api/v1/campaigns/cmp_abc123/cancel', {
method: 'POST',
headers: { 'Authorization': 'Bearer YOUR_TOKEN' }
});
requests.post(
'https://api-message.nativehub.live/api/v1/campaigns/cmp_abc123/cancel',
headers={'Authorization': 'Bearer YOUR_TOKEN'}
)
Cancelled campaigns cannot be restarted. Messages already queued may still send.
Monitoring Progress
curl https://api-message.nativehub.live/api/v1/campaigns/cmp_abc123 \
-H "Authorization: Bearer YOUR_TOKEN"
const response = await fetch(
'https://api-message.nativehub.live/api/v1/campaigns/cmp_abc123',
{
headers: { 'Authorization': 'Bearer YOUR_TOKEN' }
}
);
const campaign = await response.json();
response = requests.get(
'https://api-message.nativehub.live/api/v1/campaigns/cmp_abc123',
headers={'Authorization': 'Bearer YOUR_TOKEN'}
)
campaign = response.json()
{
"id": "cmp_abc123",
"name": "Spring Promotion",
"status": "running",
"stats": {
"total": 10000,
"sent": 7500,
"delivered": 7200,
"failed": 150,
"pending": 2500
}
}
Viewing Recipients
curl "https://api-message.nativehub.live/api/v1/campaigns/cmp_abc123/recipients?page=1&per_page=20" \
-H "Authorization: Bearer YOUR_TOKEN"
const response = await fetch(
'https://api-message.nativehub.live/api/v1/campaigns/cmp_abc123/recipients?page=1&per_page=20',
{
headers: { 'Authorization': 'Bearer YOUR_TOKEN' }
}
);
const recipients = await response.json();
response = requests.get(
'https://api-message.nativehub.live/api/v1/campaigns/cmp_abc123/recipients',
params={'page': 1, 'per_page': 20},
headers={'Authorization': 'Bearer YOUR_TOKEN'}
)
recipients = response.json()
{
"data": [
{
"phone": "+1234567890",
"variables": {"name": "John", "code": "SAVE20"},
"status": "delivered",
"sent_at": "2026-03-01T09:05:00Z"
}
],
"total": 10000,
"page": 1,
"per_page": 20
}