What is Condition in a story and how to use it?

Written by Muhammad Aamir
Posted On May, 13, 2019
Condition plugin helps bot identify if the user has responded matches any of the predetermined conditions you have setup.

This feature allows your chatbot to figure out if a user interacting falls under the Fallback case condition or the one you setup yourself.

For example, if I want to create a contest chatbot, I will make stories for correct and incorrect answers. To identify if the user has responded with the correct answer I will setup a Condition for my chatbot in which the correct answer will be given.

Similarly, I will setup my ‘fallback case’ with incorrect answer story, so that any user responds with a message other than my provided answer, the chatbot can determine that it is wrong.

Other than that, I can also setup my chatbot to take no more than one attempt from each user. Your ‘fallback case’ works as the default condition here. Meaning, that a user will begin a conversation with your main story if he/she has not played the contest yet. And alternatively, the condition you created will send the response telling that multiple attempts cannot be made.

Here’s how to setup this condition:

Click create a story and choose any ‘user message’ format and write any query you want.

Create a new condition here. Choose the story you created as a response to users who have already played your contest in ‘select story’ dropdown.

Select the entity you created under ‘Entity’ dropdown.

Choose ‘equals’ as your operator from the dropdown.

And finally, add the value ‘True’ and click create.

Now select your ‘Fallback case’ and add your main story (the one to initiate the conversation) and save it.

Save your story and that's it, you have successfully created all your stories, entities and conditions.