The Logic Node provides a simpler experience for developers, primarily business users to use context variables and define complex transition conditions. It’s two primary functions are:
- Ability to manage variables and values of variables in the context object, and
- Ability to define nested transitions conditions.
Step 1: Adding a Logic Node to the Dialog Task
- Open the Dialog Task in which you want to add the Logic node.
- Hover over the node next to which you want to add the node, and click the Plus icon.
- Go to Logic option and either select existing Logic node from the available list or create a new logic node.
- The Component Properties panel opens.
Step 2: Define Component Properties
- Modify general Component Properties like Name and Description
- Use the Manage Context Variables section to set the context variables by entering a key-value pair. Use the full path of the variable in the key field ie. “context.BotUserSession.<variable_name>“
Step 3: Configuring the Instance Properties
Use the Instance Properties to define any user tags that you want to set.
Note: The settings in the Instance Properties panel are specific to the current Dialog Task and do not reflect in the other dialog tasks that use this entity node.
- Click the Instance Properties icon on the Entity node.
- Custom Tags defines tags to build custom profiles of your bot conversations. See here for more.
Step 4: Configuring the Connections Properties
From the node’s Connections panel you can determine which node in the dialog task to execute next. You can write the conditional statements based on the values of any Entity or Context Objects in the dialog task, or you can use intents for transitions.
To setup Component Transitions, follow these steps:
- You can select from the available nodes under the Default connections.
- To configure a conditional flow, click Add IF.
- Configure the conditional expression based on one of the following criteria:
- Entity: Compare an Entity node in the dialog with a specific value using one of these operators: Exists, equals to, greater than equals to, less than equals to, not equal to, greater than, and less than. Select the entity, operator using the respective drop-down lists, and type the number in the Value box. Example: PassengerCount (entity) greater than (operator) 5 (specified value)
- Context: Compare a context object in the dialog with a specific value using one of these operators: Exists, equals to, greater than equals to, less than equals to, not equal to, greater than, and less than. Example: Context.entity.PassengerCount (Context object) greater than (operator) 5 (specified value)
- Intent: Select an intent that should match the next user utterance.
- In the Then go to the drop-down list, select the next node to execute in the dialog flow if the conditional expression succeeds. For example, if the PassengerCount (entity) greater than (operator) 5 (specified value), Then go to Offers (sub-dialog).
- In the Else drop-down list, select the node to execute if the condition fails.
Note: If you want to write multiple If conditions, click Add Else If below the last If conditional expression.