Conditions
The Condition is a building block that allows you to guide the conversation depending on the caller’s answer, or it could be based on either Intelli or a WebService miniApps response. You can configure it to cover multiple scenarios of the conversation.
For example, there is a miniApp in the Dialog Application that asks the caller: “Do you want to know more about our service?”. The caller may answer “yes” or “no”. The Condition building block allows to drive this conversation depending on the caller’s answers by creating multiple scenarios.
The symbols used for Condition scenarios and their meanings:
The * symbol means any possible value except for the empty one can be used;
The !=* symbol means not equals any value (undefined).
Follow these steps to create a Condition:
Navigate to the Dialog Control panel on the left, drag and drop the Condition building block onto canvas and connect it with the miniApp just like you do with any building block.
2. Select a miniApp or create one by clicking the Manage button and drag and drop it onto the canvas.
3. Connect the miniApp with the Condition just like any other building block. The condition setting window pops up.
4. Click the + Add Condition button.
5. Select the Field 1 value from the dropdown menu: it contains the value of the Ouput fields of the previous miniApps
6. Provide the Value 1: it is the name of the field that contains the value for the caller’s answer in the miniApp. It is possible to select any value for the Value 1 field by entering a * symbol. It means that when * is entered, the predefined condition scenario can use any possible value except for the empty one.
7. Click Save when finished.
It is also possible to create a scenario where the value of the Field 1 doesn’t equal the value of the Value 1 field.
To do this, click the equals symbol in the Condition Settings area and select the inequality sign.
Configure Default Condition
It is also possible to branch the scenarios of the Dialog Application by using the default condition. If created, the Dialog Application will use this condition in all the possible cases that are not configured in this condition.
To create a default condition, follow the steps below:
Select a miniApp from the list, drag and drop it onto the canvas, and connect with the Condition block with a line.
Once connected, click Save so the default condition will be created automatically.
For example, when the default condition is applied, if the caller answers "no" to the yes-no question of the ProvideExtraInformation miniApp while running the conversation, then the default condition that brings to the AskIntent miniApp will be played.
Manage multiple Conditions
You can use multiple Conditions when there are more than one conditions that you need to check simultaneously, or you have various intents to select. You can select two conditions at the same time, or you can provide a choice of conditions with the use of the AND and OR scenarios.
To set multiple Conditions follow the steps:
Create a scenario where the caller answers Yes and wants to change pin number.
Navigate to the Dialog Application, and click the label of the condition to start editing it.
2. Click the + Add Condition button.
3. Select AND radio button if you want to apply another condition. For example, if the caller answers “yes” AND has an intent to change the PIN number. In this case, you need to select the Field 2 value from the dropdown list of the available fields and assign a variable to the Value 2 field, which, at this point, is changePinNumber value. Click Save when finished.
The Dialog Application will be the following: if the caller provides the extra information and, at the same time, the intent is to change their PIN code, then the ExtraInfoAnnouncement miniApp will be played next.
4. Click Save when finished.
Create the scenario where the caller answers “no” OR wants to check the balance.
Navigate to the Dialog Application, and click the label of the condition to start editing it.
2. Click the + Add Condition button.
3. Click the OR radio button, then navigate to the Field 2 and select Intent from the dropdown list, and assign balanceCheck to the Value 2.
4. Click Save when finished.
Therefore, if the caller answers “no” and wants to check the balance, the AskIntent miniApp will be played.
Configure LastFailReason Field
Configuring the LastFailReason allows to specify the last error that occurred but does not end the conversation. If the defined error occurs, it doesn’t trigger any Error Handlers or stops the Dialog Application, but plays the next miniApp or another building block in a row. It allows keeping a conversation running instead of just being finished even though the error happened.
Since it is a part of the Condition feature, the multiple conditions can be executed alongside with defining the LastFailReason.
For example, if a caller doesn’t have the information asked by the miniApp (which is one of the error types that can end a conversation), the conversation will be running if this error was specified as the LastFailReason. To read more about the error types, read the Fail Exit Reason document.
To configure the LastFailReason, do the following:
Select a miniApp from the list, drag and drop it onto the canvas, and connect with the Condition block with a line.
Once connected, click the + Add Condition button.
3. Select the LastFailReason from the Field 1 dropdown menu, and specify the error that can happen in a miniApp, but won’t stop a conversation from running or trigger the Error Handler.
The LastFailReason can be used as an input field in the next miniApp, so it could allow to specify the cause of this error.
Use OCP Variables
It is possible to use OCP variables in the Condition blocks. If you are not familiar with OCP variables and Variable Collections, please refer to the Environments Manager User Guide.
Once you create an OCP variable in the Environments Manager, you can select it from the dropdown in Condition Settings as shown on the screenshot below. This will allow referencing the OCP variable stored in the Variable Collection of your application.