Phone Number Formatting for SMS
  • 11 May 2022
  • 1 Minute to read
  • Dark
    Light

Phone Number Formatting for SMS

  • Dark
    Light

Article Summary

Configuring a Phone Number for SMS Authentication

The SMS function assumes the mobile number is stored in the format [areacode][number] and follows these basic rules:

  • If the mobile number starts with a +, nothing will be added to it when dialing.
  • If the mobile number does not start with a +, the dialPrefix will be prepended to the number before dialing. The dialPrefix must be defined for anything to be prepended to the number.
    • The dial prefix must include a + followed by 0-4 digits. For the majority of users, this will include the country code. If the user's number does not match the country code of the dialPrefix, it should be stored with +[countrycode][areacode][number].
  • All other non-numeric characters will be stripped per SMS requirements.

Example:

Dial prefix: +1  
Stored mobile number: +1-(123)-456-7890
Sent to mobile number: +11234567890

Dial prefix: +1
Stored mobile number: (123)-456-7890
Sent to mobile number: +11234567890

Dial prefix: +1
Stored mobile number: +44-(123)-456-7890
Sent to mobile number: +441234567890

No Dial prefix
Stored mobile number: 1-(123)-456-7890
Error, not sent... missing '+' 

Was this article helpful?