Context conditions

Context Conditions

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.

Practical case

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.

Creating a context condition

  1. Go to Content > Context conditions.

  2. To create a new condition, click Add condition.

  3. 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.

  4. 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.

Usage of a 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.

  1. 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.

  1. 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.

  2. Create the decision tree that will allow you to retrieve the information:

  1. Click the small arrow at the right of Constant.

  2. 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).

  3. Click Update.

The registration of your variable is done.

  1. Choose Empty and enter the name of the capture to be dumped. In our example, it is product_B. Click Update.

  2. Repeat the operation to create the product choice B.

  3. 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}

  4. Click Update.

Here is a summary of the user's path:

  1. The user asks his question "Question product" without specifying the type of product, it is then redirected to the tree "choice_product".

  2. The selected product is registered and returns to the "Question product" knowledge to direct it to the branch of the chosen product.

  3. 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.

Mathematical expression

Here is a simple case of the use of mathematical expressions within a context condition.

  1. 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.

  1. Then go to Content >Context conditions then click Add a condition. Set up your context condition (with mathematical expression) like this:

  1. Click + to confirm the creation of your condition and return to the initially created knowledge.

  2. Add the newly created context condition and build your knowledge as follows:

Schedule management

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.

Last updated

Tous droits réservés @ 2023 dydu.