Categories:
context-filter dialog
Description of the global context-filter dialog that manages contextFilters to configure the behavior of a specific dialog.
Introduction
ℹ️ The context-filter dialog is an aura-bot core dialog, deployed jointly with the corresponding Aura Platform release.
Find the source code of this dialog in its different versions:
- If your
channelDataversion is v1, then use context-filter.ts - If your
channelDataversion is v3, then use context-filter-v3.ts
The context-filter dialog handles the execution of all the contextFilters configured in each dialog, evaluating all the properties of the contextFilter, within the triggerCondition model.
-
Does the current
contextFilterbreak the dialog execution? IfbreakDialogExecutionistrue, then the response to the request is just handled by thecontextFilter, as the dialog is not executed. -
Does the current
contextFilterbreak the rest of thecontextFiltersevaluation? IfbreakFilterEvalistrue, then the rest of the configuredcontextFiltersare not evaluated. -
resource: if thecontextFiltercondition is matched, then the configured resource is returned to the user. -
redirectToIntent: if thecontextFiltercondition is matched, then the execution passes to the dialog in charge of the configured intent for the current channel. -
suggestions: flag to indicate whether or not the response handled by thecontextFiltershould return suggestions to the user.
Example: Scenario 1
- Couple of
contextFilter, both of them break the dialog execution and only return a resource. - None of them break the rest of the
contextFilterevaluation, so the last matchingcontextFilterresource is returned.
In this case, if the user is prepaid, the response is bill:bill.check.prepaid with suggestions; if the user is multimisdn, the response is context-filter:multimsisdn-users-intent-not-allowed.text without suggestions. It works the same than setting breakFilterEval to true, what it is in fact recommended, to avoid performance loss.
"triggerConditions": [
{
"intent": "intent.billing.check",
"contextFilters": [
{
"name": "subscription_type_prepaid_invoice",
"type": "subscription_type_filter",
"conditions": "/authData/subscriptionType eq 'prepaid'",
"true": {
"name": "subscription_type_prepaid_invoice_true",
"breakDialogExecution": true,
"breakFilterEval": false,
"resource": "bill:bill.check.prepaid",
"suggestions": true
}
},
{
"name": "Multimsisdn Not Allowed",
"type": "UserType",
"conditions": "/type eq 'multimsisdn'",
"true": {
"name": "Return_resource_not_multimsisdn_allowed",
"breakDialogExecution": true,
"breakFilterEval": false,
"resource": "context-filter:multimsisdn-users-intent-not-allowed.text",
"suggestions": false
}
}
]
Example: Scenario 2
-
Single filter configured, that matches whether the user is anonymous or not. If the user is anonymous, then the dialog execution is broken and the rest of the
contextFilterare not evaluated. The execution is redirected to the dialog that handlesintent.account.linkingfor the current channel. -
Redirect to the dialog indicated in the
contextFilterof the dialog settings:
"contextFilters": [
{
"name": "Anonymous redirect to linking",
"type": "type",
"conditions": "/type eq 'anonymous'",
"true": {
"name": "Anonymous redirect to linking",
"breakDialogExecution": true,
"breakFilterEval": true,
"redirectToIntent": "intent.account.linking",
"suggestions": false
}
}
]