Check a phone number

Manage erroneous entries

In other pages of the online help, we explain how to check emails. We will do the same for phone numbers.

Capturing a phone number is much more complicated than it sounds. Indeed, Botnation is a solution used by hundreds of companies, each with its own particular cases and requirements.

Users may need to enter “+”, subscripts, “-” or spaces to separate numbers. In addition, this may need to be exported to a CRM or spreadsheet. Some CRM’s require for example a separate area code (+33, +41…) others with “+” in front, others not and so on. In this case, we strongly recommend using the text capture option rather than numbers:

In the “User input” module, choose “Free text” instead of “Number detection”.

But most of all, users never enter their code themselves: a normal person in France does not indicate +336 but 06… moreover, it is difficult to fix the number of digits, as the number is not the same size in all countries.

On a French-speaking bot, how can you differentiate a Belgian, Canadian, Swiss or French number if the user does not enter his own area code in front of it (+33, +41..)?

It would be better to propose a first menu where he selects his code and then indicates his number.

However, if there is a + and spaces it is no longer a number but it is a phone number.

Here are a few things to think about before installing the user input module.

The easiest way to do this is to do a free text capture as seen above and then, if you want to check the number, set an ‘If’ condition for the length of the captured variable.

A phone number must contain between 10 and 20 characters… below that it’s suspicious, in between there is surely everything you need even with spaces, area codes, dots or dashes between the numbers… Above 20 the user is talking nonsense, you can then redirect him by the “If” condition to an alternative.

That’s why we added a text length module :

For example, if you want to measure the length of the variable {{TELEPHONE}} retrieved from the previous user input, assign the result to a new variable that we will use to measure the size of the text, for example {{texte_size}}

Then measure this variable with the appropriate tool:

Then, set up an “If” condition to exclude numbers that are too long or too short:

Plus:
All about variables
IF conditions
Generate a random value
Get an email and a phone number from a Facebook Messenger chatbot
How to check an email

Create your Chatbot Easily and for Free!