When creating an intent, we can specify three things that can influence when that intent will be used. You can:
- Add necessary conditions.
- Add queries.
- Add triggers.
Clicking on Add necessary condition or Add new trigger will show similar dialogs with similar options, but the results of defining a necessary condition or a trigger are very different.
Remember, chatbot will look at the user's question and compares it to the list of queries associated with the intent. It then generates a match score, indicating how close the question is to something the bot has trained on. The intent with the highest match score will be triggered, provided it meets a minimum threshold.
Necessary conditions
As discussed in the article How do Necessary Conditions work?, if the condition is not met, the intent's match score becomes zero, meaning the intent will not be used.
If the condition is met, the match score is generated normally, comparing the user's question to the list of queries the chatbot has been trained on. This intent will only trigger if the match score is high enough, as normal.
Triggers
Triggers, on the other hand, provide a way to definitely trigger a particular intent if its rules are met.
If the trigger is met, the intent will be used, even if otherwise the intent's match score was not high enough.
When rules conflict
If you create an intent that has both a necessary condition and a trigger, both will be checked.
In this case, if the necessary condition is not met, the trigger will not be used. Its match score will be zero and can't be increased by the trigger.
That is to say, if an intent has a necessary condition for Opening Hours and you are currently closed, the intent will have a match score of zero even if the intent's trigger is valid.
Example: Any word
Let's consider the Any word rule. This is available as either a necessary condition or a trigger. In both cases, it lets you define a list of words and checks to see if the user's query contains one or more of the words in the list.
In this example we use Any word and we define the list of words as LeadDesk and Chatbot.
If we use this rule as a necessary condition and the user's question is:
|
|
If we use this rule as a trigger, and the user's question is:
|