How to handle country code and trunk prefix for sending text messages for input field on website

314 Views Asked by At

We're working on improving our SMS input field on the website for text notifications for freight tracking. After some research, still in some doubt as to the best way to guide customers to input the correct detail {country code}+{carrier prefix minus the leading zero}+{mobile number}. Were there any suggestions for best practice way to handle, or best to let customers figure it out with some system text and a nice help button?

1

There are 1 best solutions below

0
On

We're looking for the same solution and found this tool:

libphonenumber-js

As it quotes: A simpler and smaller rewrite of Google Android's libphonenumber library: easy phone number parsing and formatting in javascript.

We believe this tool is able to help.

Here's the demo provided.