Bulk SMS
Send one message to many recipients in a single API call. The SDK enforces a 100-recipient safety cap; the server returns partial failures per recipient and refunds them individually.
res, err := client.SMS.Bulk(ctx, sendafrica.BulkSMSRequest{
To: []string{"0712345678", "0765432109"},
Message: "Black Friday starts now!",
Sender: "SENDAFRICA",
})
// res.Total, res.Sent, res.Failed, res.ResultsResult shape
The BulkSendResult exposes:
Total— recipients in the batchSent— recipients accepted by the providerFailed— recipients that failedResults—[]BulkSMSRecipient{To, Status, MessageID, CreditsUsed, Error}
Partial failures are per-recipient; only whole-request problems surface as errors. Iterate Results to inspect every outcome:
for _, r := range res.Results {
if r.Error != "" {
fmt.Println("failed:", r.To, r.Error)
}
}POST /v1/sms/bulkIdempotency
Pass RequestOptions{IdempotencyKey: "..."} (max 128 chars) to make the bulk call safe to retry — a repeat request replays the stored whole-batch result, and concurrent duplicates are rejected with 409.
When to pick which
| Need | Use |
|---|---|
| One message → many recipients | SMS.Bulk |
| Different messages → many recipients | SMS.SendMany (paced) |
| Thousands of recipients, scheduled | Dashboard campaigns (client.CreateCampaign) — the worker throttles automatically |
Last updated on