improved

Phone number validation changes for Transactional API

Route: Transactional SMS endpoints

New phone number validations are added for the Transactional endpoints.

  • if the number starts with 00 -> it replaces 00 with +

    • So numbers starting with 00 or + are same.
  • if the number starts with + it does nothing

    • If a number starts with + it is checked directly using https://www.npmjs.com/package/libphonenumber-js without sanitizing the input.
  • if the number starts with single 0 -> it removes leading zero

    • In this case the single 0 is removed and before passing to library https://www.npmjs.com/package/libphonenumber-js we add a prefix of + because the library expects the country code before the number.
  • Any other string of digits are assumed to be a national number

    • In this case we add a prefix of + before checking the validity of number using https://www.npmjs.com/package/libphonenumber-js.