{"id":22286,"date":"2019-08-16T11:53:07","date_gmt":"2019-08-16T10:53:07","guid":{"rendered":"https:\/\/developer.kore.ai\/v7-3\/?p=22286"},"modified":"2019-11-01T10:19:50","modified_gmt":"2019-11-01T10:19:50","slug":"working-with-the-dialog-node","status":"publish","type":"post","link":"https:\/\/developer.kore.ai\/v7-3\/docs\/bots\/bot-builder-tool\/dialog-task\/working-with-the-dialog-node\/","title":{"rendered":"Working with the Dialog Node"},"content":{"rendered":"<section class=\"l-section wpb_row height_auto\"><div class=\"l-section-h i-cf\"><div class=\"g-cols vc_row type_default valign_top\"><div class=\"vc_col-sm-12 wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\">\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<p>Dialog node lets you start a new Dialog task within an existing Dialog task if the user intent changes.<\/p>\n<p>For example, let&#8217;s consider a travel bot that has the following three Dialog tasks:\u00a0<em>Flight Availability<\/em>, <em>Book a Flight<\/em>, and <em>Book a Hotel<\/em>. You may want to invoke the <em>Book a Flight<\/em>\u00a0Dialog task from the <em>Flight Availability<\/em> Dialog task.<\/p>\n<p><strong>Key features<\/strong> of Dialog nodes:<\/p>\n<ul>\n<li>The ability to carry data from the current Dialog task to the target dialog task as <em>entity pre-assignments<\/em> described in the later section.<\/li>\n<li>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.<\/li>\n<\/ul>\n<p><a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/15\/Intro-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-14675\" src=\"\/wp-content\/uploads\/sites\/15\/Intro-1.png\" alt=\"\" width=\"224\" height=\"295\" \/><\/a><\/p>\n<p><strong>Configuring a Dialog Node<\/strong><\/p>\n<p>Follow these steps to set up a Dialog Node to invoke a new Dialog Task:<\/p>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3 id=\"d-step1\"><span class=\"ez-toc-section\" id=\"Step_1_Adding_a_Dialog_Node_to_the_Dialog_Task\">Step 1: Adding a Dialog Node to the Dialog Task<\/span><\/h3>\n<ol>\n<li>Open the Dialog Task in which you want to add the Dialog node.<\/li>\n<li>Hover over the node next to which you want to add the node, and click the <strong>Plus<\/strong>\u00a0<img loading=\"lazy\" decoding=\"async\" class=\"icon alignnone wp-image-9160\" src=\"\/wp-content\/uploads\/sites\/15\/DIYDialogTaskPlusIcon.png\" alt=\"diydialogtaskplusicon\" width=\"15\" height=\"15\" \/>\u00a0icon.<\/li>\n<li>Go to <b>Dialog Task\u00a0<\/b>and select the dialog task from the available list (Note you cannot create a new Dialog Task from within a Dialog like other nodes).<\/li>\n<li>The Component Properties panel opens.<\/li>\n<\/ol>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3 id=\"d-step2\"><span class=\"ez-toc-section\" id=\"Step_2_Define_Component_Transition_NLP_Properties\">Step 2: Define Component, Transition &amp; NLP Properties<\/span><\/h3>\n<ol>\n<li>Modify general <strong>Component Properties<\/strong>\u00a0like Name and Description<\/li>\n<li>From the <strong>Connections tab<\/strong> set the Transition properties to 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. If you have defined the <em>Transition Property<\/em> as &#8220;<em>End the current task<\/em>&#8220;, then these settings will be ignored.\n<ol>\n<li>Select the Connections tab<\/li>\n<li>Click <b>Add IF<\/b>.<\/li>\n<li>Configure the conditional expression based on one of the following criteria:\n<ul>\n<li><b>Entity<\/b>: Compare an Entity node in the dialog with a specific value:\n<ul>\n<li>Select the entity;<\/li>\n<li>select an operator using the drop-down lists: <b>Exists<\/b>, <b>equals to<\/b>, <b>greater than equals to<\/b>, <b>less than equals to<\/b>, <b>not equal to<\/b>, <b>greater than<\/b>, and <b>less than<\/b>.<\/li>\n<li>type the number in the <b>Value <\/b>box. Example: <i>PassengerCount (entity) greater than (operator) 5 (specified value)<\/i><\/li>\n<\/ul>\n<\/li>\n<li><b>Context<\/b>: Compare a context object in the dialog with a specific value using one of these operators: <b>Exists<\/b>, <b>equals to<\/b>, <b>greater than equals to<\/b>, <b>less than equals to<\/b>, <b>not equal to<\/b>, <b>greater than<\/b>, and <b>less than. <\/b>Example<b>: <\/b><i>Context.entity.PassengerCount<\/i> <i>(Context object) greater than (operator) 5 (specified value)<\/i><\/li>\n<li><b>Intent: <\/b>Select an intent that should match the next user utterance.<\/li>\n<\/ul>\n<\/li>\n<li>In the <b>Then go to<\/b> drop-down list, select the next node to execute in the dialog flow if the conditional expression succeeds. For example, if the <i>PassengerCount (entity) greater than (operator) 5 (specified value), <\/i><b>Then go to <\/b><i>Offers (sub-dialog).<\/i><\/li>\n<li>In the <b>Else <\/b>drop-down list, select the node to execute if the condition fails.\n<div class=\"alert alert-info\"><b>Note<\/b>: If you want to write multiple If conditions, click <b>Add Else If <\/b> below the last If conditional expression.<\/div>\n<\/li>\n<\/ol>\n<\/li>\n<li>From the NLP Properties tab\n<ul>\n<li><a href=\"\/v7-3\/docs\/bots\/bot-builder-tool\/train-nlp-optimization\/machine-learning\/user-utterances\/\"><b>Machine Learning<\/b><\/a> settings to provide user utterances to improve the detection for this Node.<\/li>\n<li><a href=\"\/v7-3\/docs\/bots\/bot-builder-tool\/train-nlp-optimization\/fundamental-meaning\/fundamental-meaning\/#Adding_Bot_Synonyms\"><b>Bot Synonyms<\/b><\/a> or related phrases for this Node.<\/li>\n<li><a href=\"\/v7-3\/docs\/bots\/bot-builder-tool\/train-nlp-optimization\/fundamental-meaning\/fundamental-meaning\/#Navigating_to_the_Patterns_Tab\"><b>Patterns<\/b><\/a> to capture this Node if the user\u2019s utterance contains these specific patterns.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3 id=\"d-step3\"><span class=\"ez-toc-section\" id=\"Step_3_Define_Instance_Properties\">Step 3: Define Instance Properties<\/span><\/h3>\n<p>Instance Properties include the settings for this instance of the Dialog.<\/p>\n<ol>\n<li>Click the Instance Properties icon on the Dialog node.<\/li>\n<li>Click the <strong>Advanced controls<\/strong> to set up these options:\n<ul>\n<li><strong>Hold &amp; Resume<\/strong>\n<ul>\n<li><strong>Use the task level \u2018Hold &amp; Resume\u2019 setting<\/strong>: The bot refers to the Hold &amp; Resume settings set at the dialog task level.<\/li>\n<li><b>Customize for this node option:<\/b> You can customize the Hold &amp; Resume settings for this node by selecting this option and configuring the same. \u00a0Read the <a href=\"\/v7-3\/docs\/bots\/bot-builder-tool\/train-nlp-optimization\/bot-intelligence\/interruption-handling-context-switching-intents\/\" target=\"_blank\" rel=\"noopener noreferrer\">Interruption Handling and Context Switching<\/a> article for more information.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Custom Tags\u00a0<\/strong>defines tags to build custom profiles of your bot conversations. <a href=\"\/v7-3\/docs\/bots\/bot-builder-tool\/dialog-task\/custom-meta-tags\/\">See here for more<\/a>.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Entity Pre-assignments<\/strong> can be used to pre-assign values from this session or node data to the entities required by the Dialog Task. Any remaining required values will be handled by the sub-intent.\u00a0 (<a href=\"#entity-preassignment\">see below for details<\/a>)<\/li>\n<li><strong>Transition Options<\/strong> define the flow to be followed once the task completes. You can choose from two options:\n<ul>\n<li>return to the current node on task completion<\/li>\n<li>end the current task and initiate this task<\/li>\n<\/ul>\n<\/li>\n<li><strong>Entity Post-Assignments<\/strong> displays a list of entities available in the current task with an option to add custom variables. These entities can be assigned with values from the linked dialogs session data. For example, <em><code>context.entities. <\/code><\/em> will list the entities from the linked sub-dialog for selection. The values will be assigned once the linked dialog execution is complete.<br \/>\nNOTE: This option is available only if the Transition Options is set to return to the current node on task completion. This feature was introduced in ver 7.1 of the platform.<br \/>\nCurrently, there is a limitation when using URL entity types. URL values with <code>http<\/code> as opposed to <code>https<\/code> or without <code>www<\/code> suffix will not work.<\/li>\n<\/ol>\n<h4 id=\"entity-preassignment\">About Entity Pre-Assignments<\/h4>\n<p>You can pre-populate data for the destination Dialog task by:<\/p>\n<ul>\n<li>adding values to the entity keys,<\/li>\n<li>adding additional custom keys and values to pass data from the current Dialog task <code>Context<\/code> object to the destination Dialog task as needed.<\/li>\n<\/ul>\n<p>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.<\/p>\n<p>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 one dialog task must be mapped, you can define which dialog tasks are displayed to the end-users using conditional transitions.<\/p>\n<p>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 <em>Book a Flight<\/em> dialog task could be passed to the <em>Book a Hotel<\/em> dialog task.<\/p>\n<p>In the Bots Platform, you can use the <code>mappedIntents<\/code> variable in the <code>Context<\/code> object which holds the reference of the Intent nodes as well as the context of the source dialog task as shown in the following\u00a0JSON syntax:<br \/>\n<code>{ 'title': 'title of the link', 'link':' url for the link' ,'postbackpayload': 'system generated payload'}<\/code><br \/>\nFor example, a link to <code>GetEmail<\/code> in the <code>Context<\/code> object can be:<\/p>\n<pre>{\r\n   \"title\":\"GetEmail\",\r\n   \"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&amp;contextId=dcx-f9bae173-4d69-53e4-9aa7-21e89aae776d&amp;intent=GetEmail\",\r\n   \"postbackpayload\":\"MappedDialog_dc-f7b42932-dc06-53ac-92c0-1db706794f91_dg-15fd2927-219c-5795-b038-5b830718bea7_dcx-f9bae173-4d69-53e4-9aa7-21e89aae776d\"\r\n}<\/pre>\n<p>You can access and present these variables in a prompt message to a user to display a list of mapped dialog tasks with the link, or as a list of choices. You can pass the source dialog context to the target dialog task even if the source Dialog task is no longer active using the <code>Context<\/code> object.<\/p>\n<p>The value for the <code>postbackpayload<\/code> key is generated by the Bots Platform, and can be used in some channels, such a <em>Facebook<\/em> and <em>Slack,\u00a0<\/em>which defines when a link or choice is made for a target Dialog task.<\/p>\n<p>For more information, see <a href=\"\/v7-3\/docs\/bots\/bot-builder-tool\/dialog-task\/using-session-and-context-variables-in-tasks\/\" target=\"_blank\" rel=\"noopener noreferrer\">Using Session and Context Variables in Tasks<\/a>\u00a0and the\u00a0<a href=\"\/v7-3\/docs\/bots\/bot-builder-tool\/dialog-task\/context-object\/\" target=\"_blank\" rel=\"noopener noreferrer\">Context Object<\/a>.<\/p>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div><\/div><\/div><\/div><\/div><\/div><\/section>\n","protected":false},"excerpt":{"rendered":"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:\u00a0Flight Availability, Book a Flight, and Book a Hotel. You may want to invoke the Book a Flight\u00a0Dialog task from the Flight Availability...","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29],"tags":[],"class_list":["post-22286","post","type-post","status-publish","format-standard","hentry","category-dialog-task"],"_links":{"self":[{"href":"https:\/\/developer.kore.ai\/v7-3\/wp-json\/wp\/v2\/posts\/22286","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developer.kore.ai\/v7-3\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/developer.kore.ai\/v7-3\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v7-3\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v7-3\/wp-json\/wp\/v2\/comments?post=22286"}],"version-history":[{"count":6,"href":"https:\/\/developer.kore.ai\/v7-3\/wp-json\/wp\/v2\/posts\/22286\/revisions"}],"predecessor-version":[{"id":22670,"href":"https:\/\/developer.kore.ai\/v7-3\/wp-json\/wp\/v2\/posts\/22286\/revisions\/22670"}],"wp:attachment":[{"href":"https:\/\/developer.kore.ai\/v7-3\/wp-json\/wp\/v2\/media?parent=22286"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.kore.ai\/v7-3\/wp-json\/wp\/v2\/categories?post=22286"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.kore.ai\/v7-3\/wp-json\/wp\/v2\/tags?post=22286"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}