What is Condition in a story and how to use it?
Condition plugin helps bot identify if the user has responded matches any of the predetermined conditions you have set up.
This feature allows your chatbot to figure out if a user interacting falls under the Fallback case condition or the one you set up 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 set up a Condition for my chatbot in which the correct answer will be given.
Similarly, I will set up my ‘fallback case’ with an 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 set up 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 set up 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 a ‘select story’ dropdown. Select the datastore you created under the ‘DataStore’ 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, datastore, and conditions.