Challenge
Is there any way to make a button visible in a question node, if a condition is met/not met?
Solution
It is possible to make a button or quick reply appear under certain conversations conditions.
For example: A single question node could be configured with multiple buttons, but only certain buttons appear based on the intent that is found.
Here's how to do it:
Each button or quick reply has a field called "Condition". To access the field, open the button/QR editing menu from the node editing menu.
In this field, you can write a simple or complex javascript conditional statement that will be required to resolve as true for the button/QR to show.
In the example shown below, the "order now" quick reply is only showing because the user's last message (available on input.text) was "show".
When the user's last message is not exactly "show", the quick reply does not display.
The button/QR condition field can access any variables in the Cognigy Input, Context and Profile data locations.
Please note: Tokens cannot be used in condition fields, you must use CognigyScript omitting curly brackets.
Comments
0 comments