Skip to Content
SDKsGoPhone Numbers

Phone Numbers

Top-level utilities handle Tanzania phone validation and normalization.

FunctionDescription
NormalizeTZPhone(string)Converts 0712345678, 255..., +255... to E.164 +255...; errors on invalid numbers.
IsValidTZPhone(string)Returns bool — validation without an error.
phone, err := sendafrica.NormalizeTZPhone("0712345678") // phone == "+255712345678" if sendafrica.IsValidTZPhone("0712345678") { fmt.Println("valid Tanzania mobile") }

Accepted formats

FormatExampleResult
Tanzania local0712345678Normalized to +255712345678
International with ++255712345678Passed through
International without +255712345678Normalized with country code

Tanzania mobile prefixes are 071078, 068, and 069. The same logic runs inside SMS.Send — invalid numbers fail local validation (ErrInvalidPhone) before any network call. International destinations must be present in GET /v1/rates to be billable.

Last updated on