Skip to main content

phone to $var

The phone to $var block is used to receive a phone number from the client and save it to a variable.

The values of the variable can be used in other screens of the script.

How to add the block

To add the block, select Add blockMore blocksphone to $var.

Parameters

Fill in the following settings:

  • Message that the bot should send to the client before getting the number.
  • Variable name where the bot will save the result.
  • An Error message the bot will display if the client sends an invalid number.
    • You can specify several error messages that will be displayed randomly.

HTML markup

You can use HTML markup in the bot messages. To do this, activate the Use HTML markup in the message toggle.

caution
Not all channels support HTML markup. Learn more about this in the HTML markup article.

Phone number format

The block accepts Russian phone numbers that consist of:

  • the 8 or +7 code in the beginning;
  • number 9;
  • 9 digits of the phone number.

The phone to $var block also accepts numbers without the 8 or +7 code, such as:

901 234 56 78

Regardless of whether the client writes the country code or not, the bot will save the number in the +79xxxxxxxxx format, e.g., +79012345678.

The bot will recognize the phone number if the client provides it according to the following structure:

  • The 8 or +7 code in the beginning: eight or plus nine.
  • Three digits with the first 9 digit: nine one one or nine hundred eleven.
  • Three digits written or pronounced in one of the ways:
    • three numbers in a row: eight six five;
    • zero and a two-digit number: zero twenty two;
    • a three-digit number: three hundred twenty six.
  • Four digits written or pronounced in one of the ways:
    • four digits in a row: three eight six one;
    • zero, digit, and a two-digit number: zero five sixty three;
    • zero and a three-digit number: zero eight hundred thirty two;
    • two two-digit numbers: twenty three forty seven;
    • a two-digit number, zero, and a digit: seventy three zero five.

The client can also enter the number with brackets or hyphens, e.g., 8(912)3456789 or 8912-345-67-89.

The phone number will be saved into the $phone variable. Also, you can name the variable as you want when adding a block.