We recently added the
intent keyword to the Execution language. This allows to retrieve and use information about the matched intent during the execution of the rule triggered by it.
intent can be used in any expression supported by the Execution language, and provides some utility methods to access intent-related information:
- intent.getMatchedInput(): returns the raw input that has been matched
- intent.getRecognitionConfidence(): returns the confidence of the match (between 0 and 1)
- intent.getDefinition(): returns the definition of the intent (its required contexts, parameters, etc)
You can now finely customize your bots based on these values. The example below shows how to use
intent.getMatchedInput() to tune the message sent by the bot when the bot doesn’t understand what the user is trying to say (as its name indicates, the default fallback is the rule triggered when we are unable to match any of the user-defined intents).
Note that these values are accessible regardless of the concrete messaging platform you target (Slack, Discord, or our brand new Twitter platform), and are defined by both the DialogFlow and the RegExp intent providers.
This feature was initially discussed in the reviews of our article published at the CAiSE’19 conference.