improved
Phone number validation changes for Transactional API
10 months 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 replaces00
with+
- So numbers starting with
00
or+
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-js
without sanitizing the input.
- If a number starts with
-
if the number starts with single
0
-> it removes leading zero- In this case the single
0
is removed and before passing to libraryhttps://www.npmjs.com/package/libphonenumber-js
we 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