SMS Calculator
Analyze a message locally to predict encoding, part count, and the credits it will cost — no network call, no credits spent.
| Function | Description |
|---|---|
GetSMSPartInfo(string) | Returns encoding, length, part count, required credits. |
DetectEncoding(string) | Returns EncodingGSM7 or EncodingUCS2. |
info := sendafrica.GetSMSPartInfo("Hello world")
fmt.Println(info.Encoding, info.Length, info.Parts, info.CreditsRequired)
enc := sendafrica.DetectEncoding("Thanks 🙏") // EncodingUCS2The same analysis is exposed on the client as client.SMS.Analyze(message).
Billing rules
- GSM-7 messages fit 160 septets in one part, or 153 septets per part when concatenated.
- Unicode messages (emoji, Arabic, Chinese, curly quotes) fit 70 UTF-16 code units in one part, or 67 per part when concatenated.
- You are billed one credit per part. A single emoji can force a message into Unicode and change the bill.
Combine with Rates to compute an exact upfront price for a campaign message before you send it.
Last updated on