Send Bulk SMS
Send Millions of SMS at once.
Overview
The Bulk SMS feature supports sending:
A single message to multiple recipients through a single request.
Different messages to different recipients using Single SMS in a loop.
Outbox functionalities and cost management are included. For different messages, the request initiates a loop internally via the Single SMS endpoint.
Endpoint: Send Bulk SMS
Method:
POST
URL:
/api/sms/send-bulk
Request Body (Same Message for All Recipients)
Request Body (Different Messages Per Recipient)
For different messages per recipient, call the Single SMS endpoint in a loop.
Example Loop Data:
Bulk Endpoint Response for Loop Processing:
Bulk SMS Outbox Structure
Each Bulk Outbox entry tracks the entire bulk SMS transaction. Nested records capture individual SMS details.
Field
Type
Description
outboxId
string
Unique identifier for the bulk outbox entry.
userId
string
The user who initiated the bulk SMS.
senderId
string
The sender ID used for the bulk SMS.
messageId
string
Unique identifier for the bulk message.
messageName
string
Name of the bulk message (for tracking purposes).
message
string
SMS content (if common across all recipients).
recipients
array<string>
List of phone numbers (if common message).
totalSmsUnitsUsed
number
Total SMS units charged for the bulk transaction.
totalCost
number
Total cost for the bulk transaction.
status
string
Status of the bulk SMS (sent
, failed
, partial
).
timestamps
object
Includes createdAt
, completedAt
, and lastAttemptAt
.
retryCount
number
Number of retry attempts for the bulk SMS.
nestedOutbox
array<object>
Individual SMS records (nested) for the bulk SMS.
tags
array<string>
Tags for tracking the bulk SMS (e.g., bill-reminder
, bulk
).
customData
object
Optional metadata (e.g., purpose
, linkedTransactionId
).
Nested Outbox for Bulk SMS
Each nested record captures individual SMS details:
Field
Type
Description
nestedOutboxId
string
Unique identifier for the nested SMS entry.
recipientPhoneNumber
string
The phone number of the recipient.
smsUnitsUsed
number
Number of SMS units charged for this individual SMS.
costPerUnit
number
Cost of each SMS unit (retrieved from SMS cost model).
totalCost
number
Total cost for this individual SMS.
status
string
Status of the SMS (sent
, failed
, pending
).
timestamps
object
Includes createdAt
, sentAt
, and lastAttemptAt
.
retryCount
number
Number of retry attempts for this SMS.
errorDetails
string
Optional: Reason for failure, if applicable.
Workflow
Common Message:
Handles a single message sent to multiple recipients.
Cost calculation:
Total SMS units = Total recipients × SMS segments (160 characters per segment).
Costs are logged in the Bulk Outbox and nested records.
Different Messages:
The system processes individual SMS requests internally.
Logs each SMS in the Single SMS Outbox but links them to a parent Bulk Outbox.
Outbox Management:
All sent SMS are recorded in the Bulk Outbox, with nested tracking for each recipient.
Retry mechanism for failed messages, with individual or batch retries.
Statuses:
sent
: All SMS in the bulk transaction were successfully delivered.failed
: None of the SMS in the bulk transaction were delivered.partial
: Some SMS were delivered, others failed.
Send Bulk SMS Response
Additional Retry Endpoint
Retry failed SMS from Bulk Outbox.
Developer Guidance for Custom SMS Per Recipient
If you want to create a customized SMS for each recipient, you can handle this logic directly within your application. For example, you can design a UI that allows you to define fields such as {name}
, {date}
, or {balance}
as placeholders in your message template (e.g., Dear {name}, your balance as of {date} is Kes {balance}). These placeholders would then be dynamically replaced with actual data fetched from your database. Once the customized messages are generated in your app, you can send them using the Single SMS API in a loop. This method gives you the flexibility of personalization while using the existing Tuku Pay infrastructure for SMS sending.