Sending SMS
result, err := client.SMS.Send(ctx, sendafrica.SendSMSRequest{
To: "0712345678",
Message: "Welcome to SendAfrica!",
Sender: "SENDAFRICA", // optional; defaults when omitted
})| Field | Type | Notes |
|---|---|---|
To | string | Normalized to E.164 (+255...) automatically. |
Message | string | Required. |
Sender | string | Optional sender ID; must be a registered/usable ID. |
Returns SMSResult with MessageID, Status, Cost, CreditsUsed, and To. Submission success is not handset delivery — use webhooks for delivery state.
Idempotency
Add RequestOptions to make the send replay-safe:
result, err := client.SMS.Send(ctx, sendafrica.SendSMSRequest{
To: "0712345678", Message: "Retry-safe send",
}, sendafrica.RequestOptions{IdempotencyKey: "order-123"})A repeat request with the same key replays the stored result instead of sending twice.
Send many (client-side, paced)
Send N distinct messages while pacing requests and collecting per-message failures instead of aborting on the first error:
res, err := client.SMS.SendMany(ctx, sendafrica.SendManyRequest{
Messages: []sendafrica.SendManyMessage{
{To: "0712345678", Message: "Hi Ali"},
{To: "0765432109", Message: "Hi Zainab", IdempotencyKey: "m2"},
},
RateLimitPerSec: 10.0, // default 10
})
// res.Results → []SMSResult, res.Failed → []BulkSMSFailedItem{Index,To,Error}Client-side SMS analysis
info := client.SMS.Analyze("Hello world")
fmt.Println(info.Encoding, info.Parts, info.CreditsRequired)Returns SMSPartInfo locally — no network call. See SMS Calculator.
Message logs
logs, err := client.SMS.Logs(ctx, sendafrica.MessageLogQuery{
Page: 1,
PerPage: 25,
Status: "delivered", // pending | sent | delivered | failed
Search: "0712345678",
DateFrom: "2026-09-01T00:00:00Z",
})
// logs.Items []MessageLog, logs.Total/Page/PerPage/TotalPagesReference
| Method | Endpoint | Returns |
|---|---|---|
SMS.Send(ctx, SendSMSRequest, opts...) | POST /sms | SMSResult |
SMS.SendMany(ctx, SendManyRequest, opts...) | Loops POST /sms | BulkSMSResult |
SMS.Logs(ctx, MessageLogQuery, opts...) | GET /sms/logs | MessageLogs |
SMS.Analyze(message) | — (local) | SMSPartInfo |
Last updated on