Context/Entity
As you build your bot, you may find that there will be moments that you need to accept information from the user, and use it for different purposes like storing the information or confirming it with the user. In this case, how do you access the information?
It is something we refer to as entity. You will come across this word quite often as you explore ChatClay.
Entity is a parameter or a value. For instance, when you are trying to get the user’s email ID. In this case, the entity would be the name you refer to the value in the future. Eg: email or user_email. The entity value would be the response/value assigned to the entity. Eg: chat@chatclay.com
You can think of entity as person while the value of it might be the name of the person. The entity should be based on the kind of information you would be storing in it.
Let’s take a few more examples to get it right.
When you are asking for the user’s age
- Entity: age
- Entity value: user’s age, Eg: 20
From a carousel of food items, the user picks one
- Entity: food_selected/food
- Entity value: the card selected by the user, Eg: pizza
A list selection of services, the user picks one
- Entity: services
- Entity value: the service picked, Eg: digital marketing
You get the hang of it now.
You’ve managed to save it, but how do we access it? It’s as simple as writing:
{{entity_name}}
That’s all. So if we take an example from above, let’s say we are getting the age of the user.
- Entity: age
- Entity value: 20
- Access: {{age}}
- Output: 20
Let us see it in a few steps there, shall we?
In this example we are using Quick Replies to get the answer to why you want to build a bot.
Step 1: Name the entity and give it a value
The common entity is going to be “reason” while the entity values will vary based on the replies. Eg: Enhance business, For Fun, etc
Step 2: Access the entity
You see the {{reason}} there? Well that’s you trying to access the users response.
Step 3: Test it and see it for yourself! And there you go!
Congratulations! 🎉 You have come this far, and understood one of the most confusing and most commonly used features in ChatClay.
You totally deserve a pat on the back there!
Now you can go ahead, use it and make your bot 10x more intuitive and useful 💯