Help the bot to understand when your customers enter natural numbers into the chat window.
The sys.integer
is a system entity that recognizes natural numbers. Add it to your story when you want your bot to automatically identify English numerals and reuse them in another part of the scenario or pass the values your web service or database.
You’ll use sys.integer
entity, to know amounts of orders, identify your users or ask for an evaluation.
Chatbot example with the sys.integer entity
Sys.integer comes in handy when you want to know a quantity, sizes, age and other natural numbers. Imagine that you sell jeans and need to ask customers and you want to ask users for the number of pairs of jeans that they wish to purchase. Sys.integer will help you to verify the answer and save it as an attribute.
{{
to trigger the entity window and select the one you you need.{{
to trigger the entity window and select the one you you need.-
Go to an existing story or create a new one. To complete orders, we need a simple interaction with cards. Add a couple of products together with short descriptions and buttons with
postback
orgo to
actions that allow customers to buy your products. -
Create a child interaction. In the bot responses section, prompt users for the number of jeans they want to buy. Remember that this interaction should be triggered by the
Buy now
button. -
In the next child interaction, we can finally use our system entity to verify the user input. In the user says section type two curly brackets
{{ ... }}
to open the entity window and select:
-
Validation Entity – choose Sys.Integer
-
Save input to attribute – give a name to your new attribute
-
Now add a bot reply using the collected attribute value.
-
Save all your work and test it.