Skip to content

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 ​

MethodPathPurpose
POST/api/sms/campaignsCreate a draft or queue a campaign
GET/api/sms/campaignsList your campaigns
GET/api/sms/campaigns/statsGet account campaign totals
GET/api/sms/campaigns/:idRead a campaign and its sending results
PATCH/api/sms/campaigns/:idEdit a draft or a future scheduled campaign
DELETE/api/sms/campaigns/:idDelete an eligible campaign
POST/api/sms/campaigns/:id/sendQueue a draft or scheduled campaign to send now
POST/api/sms/campaigns/:id/cancelCancel a draft or scheduled campaign

Create a draft ​

bash
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"
  }'
FieldRequirements
nameRequired; 1–191 characters after trimming
messageRequired; 1–10,000 characters after trimming
senderIdRequired; 3–11 alphanumeric characters; default or approved for your account
manualNumbersOptional; up to 100,000 Kenyan mobile-number strings
contactGroupIdsOptional; up to 100 group IDs belonging to your account
saveAsDraftOptional boolean; true saves without sending
scheduledAtOptional future ISO date; include the timezone
requestIdOptional 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 ​

js
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:

js
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.

js
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 ​

StatusMeaning
DRAFTSaved without a send time
SCHEDULEDQueued for a scheduled or immediate send
SENDINGThe worker has started processing
COMPLETEDSending finished; inspect failure counts
FAILEDSending could not finish; inspect error and partial counts
CANCELLEDCancelled before sending started
PAUSEDRecognized 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.

Powered by Galatext Software