Phone Number Formatting Made Simple
For anyone who’s tried to implement an accurate yet user friendly UI flow capturing users’ phone numbers, this will resonate with you.
Voice · 10/12/2015 · 2 min read
For the others, luckily you will be able to avoid this hassle using our latest Verification SDKs.
Getting a phone number from your app users and formatting them into an international standard (such as E164) often proves to be cumbersome and inaccurate, leading to poor conversion in your verification flow and little reach of your user base via SMS. And until now, building your own phone number formatting system took extra weeks of research, development, and more importantly, maintenance.
Global Apps – Local Phone Numbers
One key aspect when building applications distributed globally is to embrace local specificities such as language and date formatting to perform well in all markets. For phone numbers, the challenge comes from capturing phone numbers in a format the user is most familiar with – a local or national format – and standardising it to be able to use it with Verification or Voice or SMS services.
Let’s take an example: in Argentina, transforming a local phone number to the international format should follow this rule:
- A “9″ needs to be added between country code and mobile number, while the 15 domestic prefix has to be removed
- In a real use case, if a user enters the following number (223) 15 123–4567, its equivalent international format would be +5492231234567
- You can note that the + sign, the country prefix and a leading 9 were added while the 15 domestic prefix was removed
Those are not rare cases and many countries are subject to custom rules, making efficient phone number formatting difficult in all areas.
Sinch APIs for Phone Number Formatting
In a continuous effort to make in app communication and verifications flows always simpler, we’ve now added new APIs to our Verification SDKs that help app developers with phone number formatting, which makes parsing and displaying phone numbers in any iOS or Android app very easy. Features include:
- Listing regions and country dialing codes: enables to automatically populate a table view with a list of countries and their country dialing codes
- Sample phone format: display an example phone number for any selected country
- As-you-type formatting: validate in real time a text field and provide visual feedback to the user
- E164 conversion: convert a local phone number into an international phone number following each specific country rule
With the example of Argentina mentioned above, using the Sinch Verification SDK will take care of the international phone number formatting and can provide users with a feedback on whether the phone number inputted is in a valid format.
- Step 1: Based on the selected country, the app can display and sample number to better understand the expected format
- Step 2: When the phone number is not in a valid format, the app can immediately display this information to the user
- Step 3: When the phone number is properly entered, the user automatically knows it and can proceed to a verification
We know phone number formatting can be a real hassle in certain countries and as part of our mission to make a phone number verification process as smooth as possible, we believe those new APIs will make this process simpler and faster. Do let us know your feedback, questions and suggestions on how you use this new feature and where it can be improved.