Collect positive and negative numbers, decimals, and quintillions with a chatbot.
Thanks to the system number entity, your chatbot can validate numbers written by users in a chat. You can then save collected data like attributes, reuse it later in a conversation, and pass it to external systems.
The number entity can help you gather data, such as the amount of money, height, weight, latitude, longitude, user ID, etc. The system analyzes the user input from left to right. It then automatically exchanges numerals for numbers if needed.
Examples:
-
four hundred thirty-five million two hundred forty thousand = 435240000
-
1,10 = 10.1
-
3000K = 3000000
How to use the number entity
Let’s say you run a real estate business. You want to use a chatbot to gather information about properties. The number entity can help your chatbot recognize the property’s price entered by your potential customer on chat.
-
Open a Story you want to use to collect information about properties.
-
Add a Question action in a place where you want to ask the user about the price of a property. Then in the Question variant field type in your questions.
-
Now, you need to validate the user response. To do so, in the Validate response with entity select the system number entity from the list.
-
Once the user input is validated, you can save it. To do so, select the Save response to attribute field**.** Then, click **Add custom attribute** and enter the attribute’s name. This way, you will be able to quickly recognize the attributes collected through this Story.
-
Finally, you need to decide what should happen if the user fails to provide your chatbot with any number.
-
Now, you can use the collected attributes to confirm the price the user declared. To do so, add a Bot response after the Success block.
-
Open the Bot response you added. Write the chatbot reply; you can use the custom propertyPrice attribute you collected earlier in the Story.
-
Finally, you can test your Story to see if the chatbot works as expected.