improved
Phone number validation changes for Transactional API
over 1 year ago by Obaidullah Khan
Route: Transactional SMS endpoints
New phone number validations are added for the Transactional endpoints.
-
if the number starts with
00-> it replaces00with+- So numbers starting with
00or+are same.
- So numbers starting with
-
if the number starts with
+it does nothing- If a number starts with
+it is checked directly usinghttps://www.npmjs.com/package/libphonenumber-jswithout sanitizing the input.
- If a number starts with
-
if the number starts with single
0-> it removes leading zero- In this case the single
0is removed and before passing to libraryhttps://www.npmjs.com/package/libphonenumber-jswe add a prefix of+because the library expects the country code before the number.
- In this case the single
-
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 usinghttps://www.npmjs.com/package/libphonenumber-js.
- In this case we add a prefix of
