Getting your clients` phone number is an easy and natural way to stay in touch. Thanks to the system entities, your bot can do it for you.
The phone-number entity helps your bot to recognize phone numbers in all popular standards — with country code, dashes, and brackets. The system checks if the user input is correct and memorizes the given contact number so you can reuse it in the ongoing conversation or pass it to your web services and databases.
Chatbot example with the sys.phone-number
entity
Your bot isn’t omniscient and even its best configuration may leave some of your clients without the answer. In this quick example, we’ll build an interaction that collects the phone number from clients that ask questions that cannot be recognized by the bot.
{{
to trigger the entity window and select the one you you need.{{
to trigger the entity window and select the one you you need.-
Create a new story
and name itGet phone number
. Inside the storyadd a new interaction
with the same name. Ask a Question is the best bot action to collect user data. Add it to the bot responses. -
Type your message and
select the phone-number system entity
as the validation type. Also, decide the name for the new attribute. -
Add a text message
to confirm that the phone number has been saved. -
Let’s connect this interaction with the default fallback interaction.
Add the following filter:Lifespan > 0
to your default fallback response. -
When the fallback equals 0
, order your bot to ask for the phone number. To do so,add the go to actio
n that jumps to our Get phone number interaction. -
Save
your work and test out the bot.