SMS Calculator
Analyze a message locally to predict encoding, part count, and the credits it will cost — no network call, no credits spent.
import { getSmsPartInfo, countSmsParts, detectEncoding } from 'sendafrica'
const info = getSmsPartInfo('Hello world')
// { encoding: 'GSM-7', length: 11, parts: 1, creditsRequired: 1 }
countSmsParts('A long message that spills over 160 characters...') // 2
detectEncoding('Thanks 🙏') // 'UCS-2'| Helper | Description |
|---|---|
detectEncoding(message) | Returns 'GSM-7' or 'UCS-2'. |
getSmsPartInfo(message) | Returns { encoding, length, parts, creditsRequired }. |
countSmsParts(message) | Parts count shorthand. |
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
UCS-2and change the bill.
Combine with Rates to compute an exact upfront price for a campaign message before you send it.
Last updated on