Skip to Content
SDKsGoSending SMS

Sending SMS

result, err := client.SMS.Send(ctx, sendafrica.SendSMSRequest{ To: "0712345678", Message: "Welcome to SendAfrica!", Sender: "SENDAFRICA", // optional; defaults when omitted })
FieldTypeNotes
TostringNormalized to E.164 (+255...) automatically.
MessagestringRequired.
SenderstringOptional 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/TotalPages

Reference

MethodEndpointReturns
SMS.Send(ctx, SendSMSRequest, opts...)POST /smsSMSResult
SMS.SendMany(ctx, SendManyRequest, opts...)Loops POST /smsBulkSMSResult
SMS.Logs(ctx, MessageLogQuery, opts...)GET /sms/logsMessageLogs
SMS.Analyze(message)— (local)SMSPartInfo
Last updated on