Context conditions
Last updated
Last updated
Tous droits réservés @ 2023 dydu.
Context conditions are used to store information during the dialog, which can then be used to provide different answers.
Take the example of a site that offers several products. If the question of the user does not specify what type of product is concerned by his question, we will ask him. Once he has responded, the bot retains the information and will be able to give him the answer directly for the product concerned. The information is then stored in such a way that the question is not asked if the user asks more questions about the product.
In this practical case, the user declares an intention for which the bot needs to adjust its response according to a condition to be met. Here, the condition to be met is to be 18 years old. The bot will therefore detect whether the user is of age or not by means of a context condition based on a mathematical expression. It will adjust its response according to Success or Failure in relation to the implemented context condition.
Go to Content > Context conditions.
To create a new condition, click Add condition.
Fill in the fields:
Condition name: enter the name of the condition that will appear in the branches.
Condition: select the name of the variable that will determine the condition.
Operation and value: select a combination between an operation (is defined, is, is contained or contains) and a value.
Usage: displays the knowledge that uses this context condition.
Click + to confirm the addition of a context condition.
Note that you can create priority groups by clicking ... located at the right of the context condition: Move in a group.
You can then create a priority group or select an existing one to associate it with the condition you selected.
You can then easily manage the hierarchy of your groups/conditions using the small arrows at the left of the context condition.
You can then use these conditions in a decision tree and different answer in each case:
The current action option will allow you to create the success of the condition on the current window.
The empty action option will allow you to create the success of the condition on a new window.
The left branch represents the success of applying the condition while the branch on the right represents its failure.
Select the context condition via the drop-down list.
In our example, we have determined that if the user did not order product B, we check if he ordered the product A. If it did not order the product A, then it is necessary to recover the information on the product which it ordered.
In order to retrieve the information, make a redirection to the condition tree (in our example, it is choice_products) which will allow the user to choose the type of product that concerns him if he does not have already been informed in his question.
Create the decision tree that will allow you to retrieve the information:
Click the small arrow at the right of Constant.
Enter the name you have defined for your variable (please repeat exactly the variable name you created in your context conditions beforehand) and enter Ok as the value (or the value you previously determined).
Click Update.
The registration of your variable is done.
Choose Empty and enter the name of the capture to be dumped. In our example, it is product_B. Click Update.
Repeat the operation to create the product choice B.
Once all the variables are saved, you have to replay the previous interaction that accessed the knowledge "Product question". You can now access this knowledge, knowing that the user has ordered product A or product B and will be given the answer "Product A" or "Product B". In order to replay the previous interaction, click More options and fill in the field Redirect to another knowledge ${replay_interaction:-1}
Click Update.
Here is a summary of the user's path:
The user asks his question "Question product" without specifying the type of product, it is then redirected to the tree "choice_product".
The selected product is registered and returns to the "Question product" knowledge to direct it to the branch of the chosen product.
The user asks another question which knowledge also uses the two conditions on the type of product, it is now directed directly in the branch corresponding to the previously registered product.
Here is a simple case of the use of mathematical expressions within a context condition.
Go to the Knowledge page and create a Simple knowledge "I want X meters" by adding the group Number in order to capture the number and assign a variable name that will be used in the context condition.
Then go to Content >Context conditions then click Add a condition. Set up your context condition (with mathematical expression) like this:
Click + to confirm the creation of your condition and return to the initially created knowledge.
Add the newly created context condition and build your knowledge as follows:
You can manage the schedules of Livechat operators via the context conditions. This option allows you to manage time slots in a different way compared to the Livechat parameters option.
To do this, go to Content > Context conditions.
Click the Add Condition button and then, in the first field, select the condition IsDateDayAndHour (...). A window opens with the possibility to easily manage the time slots.
Fill in the other fields and click Okto validate the creation of your context condition.
To add a context condition to a knowledge, click on the button.
To create the "Product A" and "Product B" knowledge, click the icon and choose Constant.
You must now indicate that you want to eliminate the other variable. To do so, place your cursor following product_A:=ok then click on the icon.