1. Home
  2. Kore.ai Conversational Platform
  3. Bot Builder Tool
  4. Develop
  5. Dialog Task
  6. Working with the Dialog Node

Working with the Dialog Node

Dialog node lets you start a new Dialog task within an existing Dialog task if the user intent changes. For example, let’s consider a travel bot that has the following three Dialog tasks: Flight Availability, Book a Flight, and Book a Hotel. You may want to invoke the Book a Flight Dialog task from the Flight Availability Dialog task. A key feature of Dialog nodes is the ability to carry data from the current Dialog task to the target dialog task as entity pre-assignments described later in this topic.

When a target Dialog task is invoked, the current Dialog flow begins at the root intent of the new Dialog task. If you write transitions for the Dialog node, then the flow returns to the source Dialog task after completing the Target. If you do not write transitions, the Dialog task ends after executing the target Dialog task. This differs from an optional User Intent node, where the dialog flow processes a related user intent and then continues in the same Dialog task thereafter. For more information, see Working with the User Intent Node.

Mapping Dialog Tasks

When the Dialog node invokes the target Dialog tasks it functions similar to flows. The mapped Dialog nodes are Dialog tasks that end users receive as a list of options or links.

  • To transition to a mapped intent using a list of options, the NLP interpreter must recognize the user utterance or input matched to one of the list options.
  • To display a link to the user as a transition for a new dialog, you need to define JavaScript on the target Dialog task Context object variable. The Context object postbackpayload key value is generated by the bot server and can be used as the value for a channel-specific requirement, such as in the Facebook channel, but not in the SMS channel. For more information, see the Context Object.

Configuring a Dialog Node

Follow these steps to set up a Dialog Node to invoke a new Dialog Task:

Step 1: Adding a Dialog Node to the Dialog Task

  1. Open the Dialog Task in which you want to add the Dialog node.
  2. Hover over the node next to which you want to add the node, and click the Plus diydialogtaskplusicon icon.
  3. Go to Intent > Dialog Task. The Component Properties panel opens.

Step 2: Define Component Properties

  1. In the Intent field, view or modify the user intent, for example, Flight Booking.
  2. In the Description field, review the Dialog task’s Description, and modify if necessary.
  3. The Machine Learning, Bot Synonyms, and Patterns section, sections show the respective utterances, synonyms, and patterns of the invoked Dialog task. You can add new utterances, synonyms, and patterns, here, and they get automatically added to the Dialog task.

Step 3: Define Transition Properties

Typically if you do not add a transition for a Dialog node, the dialog flow stops after completing the target Dialog task. However, if you want the flow to return to the source Dialog task, you need to add transitions to the Dialog node. You can write the conditional statements based on the values of Entity, Context Objects or you can use intents for transitions.

To setup Component Transitions, follow these steps:

  1. Hover over the Dialog node, and click the transition icon. The Connections pane opens.
  2. On the Connections pane, click Add IF.
  3. Configure the conditional expression based on one of the following criteria:
    1. Entity: Compare an Entity node in the dialog with a specific value using one of these operators: Existsequals togreater than equals toless than equals tonot equal togreater 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)
    2. Context: Compare a context object in the dialog with a specific value using one of these operators: Existsequals togreater than equals toless than equals tonot equal togreater than, and less than. ExampleContext.entity.PassengerCount (Context object) greater than (operator) 5 (specified value)
    3. Intent: Select an intent that should match the next user utterance.
  4. In the Then go to 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).
  5. 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.

Step 4: Define Instance Properties

The Entity Pre-Assignments section in the Instance Properties node shows the list of Entity nodes defined in the target Dialog task as key/value pairs. Add values to the entity keys, or add new custom keys and values used to pre-populate data in the new Dialog task.

About Entity Pre-Assignments

You can pre-populate data in the destination Dialog task by adding values to the entity keys, add additional custom keys, and values to pass data from the current Dialog task Context object to the destination Dialog task as needed. Transitioning from the source Dialog task to the destination Dialog task occurs at runtime when the user input matches one of any linked dialog tasks. When more than dialog task must be mapped linked, you can define which dialog tasks are displayed to the end-users using conditional transitions.

When you call another dialog task, you may want to carry information from the first Dialog task, into the next Dialog task. For example, customer information collected in a Book a Flight dialog task could be passed to the Book a Hotel dialog task. On the Bots Platform, you can use the mappedIntents variable in the Context object which holds the reference of the Intent nodes as well as the context of the source dialog task as shown in the following JSON syntax:

{ 'title': 'title of the link', 'link':' url for the link' ,'postbackpayload': 'system generated payload'}

For example, a link to GetEmail in the Context object can be:

{  
   "title":"GetEmail",
   "link":"https://app.collab.ai/wf/1.1/market/users/bots/st-bb1eb3da-cfa7-5244-b241-b5042d333e76/dialogue/dg-15fd2927-219c-5795-b038-5b830718bea7/execute?nodeId=message2&contextId=dcx-f9bae173-4d69-53e4-9aa7-21e89aae776d&intent=GetEmail",
   "postbackpayload":"MappedDialog_dc-f7b42932-dc06-53ac-92c0-1db706794f91_dg-15fd2927-219c-5795-b038-5b830718bea7_dcx-f9bae173-4d69-53e4-9aa7-21e89aae776d"
}

You can access these variables in a prompt message to a user to display a list of mapped dialog tasks with link, or as a list of choices that the user can choose from. You can pass the source dialog context to the target dialog task even if the source Dialog task is no longer active using the Context object.

The value for the postbackpayload key is generated by the Bots Platform, and can be used in some channels, such a Facebook and Slack, which defines when a link or choice is made for a target Dialog task.

By default, the Entity nodes defined in the target Dialog task are displayed as key/value pairs. You can then define values for associated entities or add custom keys and values as needed using session and context variables. For more information, see Using Session and Context Variables in Tasks and the Context Object.

Was this article helpful to you? Yes 1 No