The Collect Phone Number interaction will help you to find and highlight valid telephone numbers from users’ responses.
- Click Add new interaction/plugin
- Select Collect Phone Number
- Specify the interaction name, e.g. ‘Telephone’
- (Optional) Tick Highlight Extracted data in chat for a better user experience
- Click the Add button to add the interaction to the bot’s structure:
After that, you should specify the bot’s message along with an error response:
In the Phone tab specify two-letter country codes that the bot will use for identifying valid phone numbers:
- If you leave the 'Phone codes' field blank, the interaction will trigger if a user enters any valid phone number that starts with the '+' symbol.
- If you enter some codes in the 'Phone codes' field, for example, FR, US, then the interaction will trigger if a user enters any phone number which contains one of the selected codes. In this case, it does not matter if the response contains the “+” symbol or not. Also, if a user enters any phone number which does not contain one of the selected codes, then the bot will send the Error response.
The length of the phone number depends on the international code.
To see a full list of country phone codes, please visit this page.
For the Facebook channel you have an option to add an additional Quick Reply to the interaction, which will suggest users to send their phone number, which is extracted from the user’s Facebook account. This option is located in the Connections tab:
If a user enters an invalid phone number, then the bot will give the Error response:
If a user enters a valid phone number, then the system will trigger the interaction that is set in the Connections tab. Otherwise, by default, the Fallback connection is set to 'do nothing'. In this case, the bot will give the same message again. If you change the Fallback connection then the system will redirect a user to another interaction after a correct phone number format has been entered.
The same goes for conditionals connections: if you add a simple or NLP connection, and if a user's response matches the conditions of one of the connections, then the system will redirect a user to another interaction.
The default valid format for a Collect Phone Number:
In order to see the extracted phone number in the Test chat, press the 'Highlight extracted data' button:
As needed, you can connect the Collect Phone Number interaction to the other types of interaction. For example, you could connect it to a Bot Statement thanking the user for providing their number. Or, if no conditions are met, the bot can be directed to move to another interaction:
Updated over 2 years ago