Campaigns
Create SMS drafts, send immediately, or schedule a send. Campaign endpoints require Authorization: Bearer YOUR_ACCESS_TOKEN. An API key alone is not accepted.
Endpoints
| Method | Path | Purpose |
|---|---|---|
POST | /api/sms/campaigns | Create a draft or queue a campaign |
GET | /api/sms/campaigns | List your campaigns |
GET | /api/sms/campaigns/stats | Get account campaign totals |
GET | /api/sms/campaigns/:id | Read a campaign and its sending results |
PATCH | /api/sms/campaigns/:id | Edit a draft or a future scheduled campaign |
DELETE | /api/sms/campaigns/:id | Delete an eligible campaign |
POST | /api/sms/campaigns/:id/send | Queue a draft or scheduled campaign to send now |
POST | /api/sms/campaigns/:id/cancel | Cancel a draft or scheduled campaign |
Create a draft
curl -X POST https://api.galatext.com/api/sms/campaigns \
-H "Authorization: Bearer $GALATEXT_ACCESS_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"name": "Office notice",
"message": "Our office will be closed on Monday.",
"senderId": "YOURBRAND",
"manualNumbers": ["254712345678", "0798765432"],
"saveAsDraft": true,
"requestId": "ad2637e6-823a-4f56-9c3c-312b6f087be1"
}'| Field | Requirements |
|---|---|
name | Required; 1–191 characters after trimming |
message | Required; 1–10,000 characters after trimming |
senderId | Required; 3–11 alphanumeric characters; default or approved for your account |
manualNumbers | Optional; up to 100,000 Kenyan mobile-number strings |
contactGroupIds | Optional; up to 100 group IDs belonging to your account |
saveAsDraft | Optional boolean; true saves without sending |
scheduledAt | Optional future ISO date; include the timezone |
requestId | Optional UUID; reuse it with the identical payload when retrying creation |
At least one valid recipient must be available from entered numbers or selected groups. Galatext normalizes and deduplicates the combined audience. Group members are resolved when creating the campaign or replacing its audience.
Omit saveAsDraft and scheduledAt to queue a send immediately. Set a future scheduledAt to schedule it. A draft cannot also have a scheduled time. Sending and scheduling check SMS credit availability; a draft does not reserve credits.
Reusing requestId with the same payload returns the existing campaign. Changing the content for that request returns 409. Direct SMS does not share this retry guarantee.
JavaScript SDK
const draft = await client.campaigns.create({
name: 'Office notice',
message: 'Our office will be closed on Monday.',
senderId: 'YOURBRAND',
manualNumbers: ['254712345678'],
saveAsDraft: true,
requestId: crypto.randomUUID(),
});
await client.campaigns.update(draft.id, { message: 'Our office reopens on Tuesday.' });
await client.campaigns.send(draft.id);
const report = await client.campaigns.get(draft.id);To schedule an existing draft:
await client.campaigns.update(draft.id, {
scheduledAt: new Date(Date.now() + 3600000).toISOString(),
});List and filter
GET /api/sms/campaigns?page=1&limit=10&search=notice&status=DRAFT returns { data, total, page, limit, totalPages }. Page size is 1–100. Search matches campaign name, message, or sender ID.
const page = await client.campaigns.list({ page: 1, limit: 10, status: 'DRAFT' });
const totals = await client.campaigns.stats();Statistics contain totalCampaigns, totalSent, totalFailed, activeSending, totalRecipients, successRate, and scheduledCount.
Lifecycle and editing
| Status | Meaning |
|---|---|
DRAFT | Saved without a send time |
SCHEDULED | Queued for a scheduled or immediate send |
SENDING | The worker has started processing |
COMPLETED | Sending finished; inspect failure counts |
FAILED | Sending could not finish; inspect error and partial counts |
CANCELLED | Cancelled before sending started |
PAUSED | Recognized stored state; there is no customer pause/resume endpoint |
Only drafts and future scheduled campaigns can be edited. Use scheduledAt: null in a patch to return an eligible scheduled campaign to a draft. When replacing an audience, send both manualNumbers and contactGroupIds if you want to retain both sources; omitted sources are not merged automatically.
Drafts and scheduled campaigns can be cancelled before the worker claims them. Sending campaigns cannot be cancelled or deleted. Cancel a scheduled campaign before deleting it. Conflicting state changes return 409; reload the campaign before trying again.
successfulDeliveries and failedDeliveries track sending results, not handset delivery receipts. See delivery and sending results.