Requesting user phone number

You can watch all the steps to requesting user phone number in the video tutorial:

Telegram

The simplest way is to create a button on pressing which the user would provide phone number information.

Such a button can be created using Buttons with Hints. In the button settings, select Button Type - Share Contact.

You can write Phone number in a variable with User Input component or a Fork with Contact data type.

Check Allow User Contact Only checkbox in the Fork settings to only allow users who have clicked the button to pass through the Fork.

Since the Default Fork Target is set to the same screen on which phone number is requested, if the user does not press the button to send contact, they will not be able to proceed until they send their phone number.

If sent, the user phone number will be written to usPhone variable, which we specified in Variable Name field of Fork Target.

In other messengers

There are several ways:

1. The simplest option is to ask for a phone number and write it to a variable with data type Text (using Fork or User Input). This is a universal type for all text messages. With it you will definitely get the number, even if the bot user writes it in letters. However, anything the user writes will also go into the variable.

2. You can use Number Data Type. This way you’ll have to request to input only numbers without spaces or other characters: e.g. 380951110512 or 79613221414.

3. If the best-fit option is desired, for example, input by country code or set format, use Regular expression.

For example, the following regular expression would match Russian phone numbers: (\+?(8|7)[\-\s]?)?\(?9\d{2}\)?[\-\s]?\d{3}[\-\s]?\d{2}[\-\s]?\d{2}.

Requesting a Contact with User Input is possible on any platform, but for some platforms there are restrictions on requesting a contact with Buttons with Hints and Forks:

  • On Telegram and Viber this works with desktop and smartphone.
  • On Facebook, it works only with desktop.
  • On VK, Instagram and Odnoklassniki it does not work.

To the beginning ↑