{"id":18003,"date":"2017-08-22T19:52:02","date_gmt":"2017-08-22T19:52:02","guid":{"rendered":"http:\/\/developer.kore.ai\/v10-1\/?post_type=docs&#038;p=11876"},"modified":"2021-08-14T10:54:57","modified_gmt":"2021-08-14T09:54:57","slug":"default-dialog","status":"publish","type":"post","link":"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/bot-intelligence\/default-dialog\/","title":{"rendered":"Default Conversations"},"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 id=\"default-dialog\">There are multiple places where the platform responds to user utterances without the developer having to code the details. Examples include:<\/p>\n<ul>\n<li><strong>Default Dialog<\/strong> when the user intent is not found or understood by the bot.<\/li>\n<li><strong>Standard Responses<\/strong> to certain questions, greetings, error and warning scenarios, etc.<\/li>\n<li><strong>Event Handlers<\/strong> for certain common bot events can be defined, <a href=\"\/docs\/bots\/advanced-topics\/event-based-bot-actions\/\" target=\"_blank\" rel=\"noopener noreferrer\">click here for more<\/a>.<\/li>\n<\/ul>\n<p>Though these are set by default by the platform, you can customize them as per your business requirements. In this document, we look into such customizations.<\/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=\"default-dialog\"><span class=\"ez-toc-section\" id=\"Default_Dialog\">Default Dialog<\/span><\/h3>\n<p>You can choose to run a dialog task or display a standard error message if the Natural Language Processor for Kore.ai cannot determine the user intent. The default setting is to display a standard error message.<\/p>\n<p>Under the <strong>Build<\/strong> tab, from the left menu, click <strong>Intelligence &gt; Default Dialog <\/strong>to define a default dialog task.<\/p>\n<p>For example, you can switch the conversation from the bot to a live agent, or run a generic dialog such as the main menu if the user intent is not determined in the bot conversation.<\/p>\n<p>If a default dialog task is not defined, standard error messages and any customizations defined in the <strong>Standard Responses<\/strong> section are used.<\/p>\n<p>The following illustration is an example of the <strong>Default Dialog<\/strong> section in Bot Builder configured to run the <em>Get Account Help<\/em> dialog task when the user intent cannot be determined in the <em>Banking Portal<\/em>\u00a0bot.<br \/>\n<a ref=\"magnificPopup\" href=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20210622111319\/intelligence_DefaultDialog.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-27896\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20210622111319\/intelligence_DefaultDialog.png\" alt=\"\" width=\"1365\" height=\"431\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20210622111319\/intelligence_DefaultDialog.png 1365w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20210622111319\/intelligence_DefaultDialog-300x95.png 300w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20210622111319\/intelligence_DefaultDialog-1024x323.png 1024w\" sizes=\"auto, (max-width: 1365px) 100vw, 1365px\" \/><\/a><\/p>\n<h4>Define a Default Dialog<\/h4>\n<p>To complete the following procedure, you must have already defined a dialog to select as the default dialog.<\/p>\n<ol>\n<li>Select the <strong>Build<\/strong> tab from the top menu.<\/li>\n<li>From the left menu, click the <strong>Intelligence &gt; <\/strong><strong>Default Dialog<\/strong> option.<\/li>\n<li>In the <strong>If user&#8217;s intent is not understood<\/strong> section, select <strong>Automatically run a dialog task<\/strong>.<\/li>\n<li>In the <strong>Default Dialog Task<\/strong> field, select a default dialog from the list.<\/li>\n<li>Click <strong>Save<\/strong>.<\/li>\n<\/ol>\n<p>The <strong>Settings successfully saved<\/strong> message is displayed.<\/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<h2 id=\"standard-responses\"><span class=\"ez-toc-section\" id=\"Standard_Responses\">Standard Responses<\/span><\/h2>\n<p>In the Kore.ai Bot Builder tool, you can view the default Natural Language Processing, or NLP interpreter responses to user inputs or events.<\/p>\n<p>For example, a reply to a user input of <em>Hi!\u00a0<\/em>The bot replies with one of the following responses, chosen randomly at runtime:<\/p>\n<ul>\n<li>Hi!<\/li>\n<li>Hello<\/li>\n<li>Hi there!<\/li>\n<li>Hey \ud83d\ude42<\/li>\n<\/ul>\n<p>The NLP interpreter displays pre-defined text responses to users based on an event, condition, trigger, or user input. Depending on your custom bot and users of that bot, you may want to modify the default responses to users displayed for an event or request for input.<\/p>\n<p>Example<\/p>\n<ul>\n<li><strong>User Input<\/strong> &#8211; When were you born?<\/li>\n<li><strong>Event<\/strong> &#8211; Authorization Failure<\/li>\n<li><strong>Trigger<\/strong> &#8211; Task canceled<\/li>\n<\/ul>\n<p>You can define both standard bot responses, or if desired, add a channel override response that is displayed only in the specified channel the user is in, otherwise, one of the standard default responses is displayed. <a href=\"\/docs\/bots\/bot-builder-tool\/train-nlp-optimization\/custom-behavior\/default-standard-responses\/\">Click here for a comprehensive list of default standard responses<\/a>.<\/p>\n<p>For example, in the SMS channel, you may only want to use short bot responses to save data.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Default_Responses\">Default Responses<\/span><\/h3>\n<p>To access and manage the default responses in bot builder, follow the below steps:<\/p>\n<ul>\n<li>Select the\u00a0<strong>Build<\/strong> tab from the top menu<\/li>\n<li>From the left menu, click <strong>Intelligence &gt; <\/strong><strong>Standard Responses<\/strong>.<br \/>\n<a ref=\"magnificPopup\" href=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20210622115029\/intelligence_StdResponse.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-27898\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20210622115029\/intelligence_StdResponse.png\" alt=\"\" width=\"1366\" height=\"768\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20210622115029\/intelligence_StdResponse.png 1366w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20210622115029\/intelligence_StdResponse-300x169.png 300w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20210622115029\/intelligence_StdResponse-1024x576.png 1024w\" sizes=\"auto, (max-width: 1366px) 100vw, 1366px\" \/><\/a><\/li>\n<\/ul>\n<p>For each standard response category tab, the event or user input is listed followed by one or more NLP interpreter standard responses. You can modify the default response, and if needed, add additional responses selected randomly by the NLP interpreter in response to user input or system event.<\/p>\n<p>In the <strong>Standard Response<\/strong>\u00a0section, the standard\u00a0bot responses are categorized in the following tabs:<\/p>\n<ul>\n<li><strong>Statements<\/strong> &#8211; Responses displayed to the user as the result of an action by the bot or user. For example, a user cancels a task, or a user gives an invalid response to your bot request.<\/li>\n<li><strong>Queries<\/strong> &#8211; Statements from the bot to the user to ask for more information. For example, <em>Which field do you want to change?<\/em><\/li>\n<li><strong>Error &amp; Warnings<\/strong> &#8211; Statements from the bot to the user when an error occurs during the scenario, such as the\u00a0<em>End date cannot be before or same as the start date!<\/em><\/li>\n<li><strong>Questions<\/strong> &#8211; Questions the bot may pose to the user when not included in any other category.<\/li>\n<li><strong>Choices<\/strong> &#8211; The bot is asking for Yes\/No input. For example, <em>Would you like to receive push notifications every time this task occurs?<\/em><\/li>\n<li><strong>Greeting<\/strong> &#8211; Initial responses by the bot when the bot is installed, or other initial contacts. For example, when a user returns to the interaction after a period of inactivity.<\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"Add_and_Edit_Responses\">Add and Edit Responses<\/span><\/h3>\n<p>Add a New Standard Response<\/p>\n<p>Note: If the standard responses are updated at the conditions wherein an ambiguity is presented to the user, the bot response will not display the ambiguous choices to the user and you need to use the function <strong><em>getChoices()<\/em><\/strong> to present the ambiguity list (refer to point 6 below).<\/p>\n<ol>\n<li>Select a tab category for the standard response. For example, <strong>Greeting<\/strong>, and then hover the situation for which you want to add the response. Click <strong>Add Response<\/strong>:\n<ol>\n<li>The <strong>Add Channel Overrides<\/strong>\u00a0dialog is displayed.<\/li>\n<li>In the <strong>Choose a channel<\/strong> drop-down list, select a channel to create a channel-specific response. You can go with the Any Channel option to enable the response for all channels.<\/li>\n<li>In the case of channel-specific response, from the <strong>Choose a Task <\/strong>drop-down list, select <strong>Any Task<\/strong> to apply this channel-specific response to all tasks or select a specific task.<\/li>\n<li>When\u00a0a specific task is selected, the <strong>Choose a Field is<\/strong> drop-down is displayed. Select <strong>Any Field<\/strong> or a specific field for this channel-specific response.<br \/>\n<a ref=\"magnificPopup\" href=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20210622120200\/intelligence_StdResponse_addChannel.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-27900\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20210622120200\/intelligence_StdResponse_addChannel.png\" alt=\"\" width=\"691\" height=\"531\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20210622120200\/intelligence_StdResponse_addChannel.png 691w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20210622120200\/intelligence_StdResponse_addChannel-300x231.png 300w\" sizes=\"auto, (max-width: 691px) 100vw, 691px\" \/><\/a><\/li>\n<li>In the bot <strong>Response<\/strong> editor, you can override the default Bot Response for this channel using basic editor controls on the <strong>Simple Mode<\/strong> tab, or write custom JavaScript for the response on the <strong>Advanced Mode<\/strong> tab. For the:\n<ul>\n<li><strong>Simple Mode<\/strong> tab &#8211; Enter the text for the default standard response. For example, <span style=\"color: #0000ff;\">*There* you are, I was ~hoping~ you would return soon!<span style=\"color: #333333;\"> and then o<\/span><\/span>ptionally, format the text using the formatting buttons for bold, italics, header styles, hyperlinks, ordered and unordered lists, and inserting a line. For more information, refer to <a href=\"\/docs\/bots\/bot-builder-tool\/dialog-task\/prompt-editor\/\">Using the Prompt Editor<\/a>.<\/li>\n<li><strong>Advanced Mode tab<\/strong> &#8211; Enter JavaScript to override the channel message as described in the following code examples.\n<p class=\"note\"><strong>Note:<\/strong>\u00a0Use the following keys to return default values for:<br \/>\n<span style=\"color: red; font-family: courier;\">response.message<\/span> &#8211; Returns the default message as a string.<br \/>\n<span style=\"color: red; font-family: courier;\">response.choices<\/span> &#8211; Returns the options choice or confirmation message types as an array.<\/p>\n<ul>\n<li><strong>Slack Channel Override Example<\/strong>\n<pre class=\"lang:default decode:true\">var message = {};\r\nvar attachments = [];\r\nvar attachment = {\r\n    'text': \"Exception occurred during API execution\",\r\n    'color': '#FFCC00',\r\n    'attachment_type': 'default'\r\n};\r\nattachments.push(attachment);\r\nmessage.attachments = attachments;\r\nprint(JSON.stringify(message));<\/pre>\n<\/li>\n<li><strong>FaceBook Channel Override Example<\/strong>\n<pre class=\"lang:default decode:true \">var message = {\r\n    text: response.message\r\n};\r\nvar buttons = [];\r\nfor (var i = 0; i &lt; response.choices.length; i++) {\r\n    var choiceItem = response.choices[i];\r\n    if (choiceItem.length &gt; 20) {\r\n        choiceItem = choiceItem.substring(\r\n            0, 18) + '..';\r\n    }\r\n    var element = {\r\n        content_type: 'text',\r\n        title: choiceItem,\r\n        payload: choiceItem\r\n    };\r\n    buttons.push(element);\r\n}\r\nmessage.quick_replies = buttons;\r\nprint(JSON.stringify(message));<\/pre>\n<\/li>\n<li><strong>Email Channel Override Example<\/strong>\n<pre class=\"lang:default decode:true \">var message = {};\r\nvar text = response.message + ' &lt;br&gt; ';\r\nfor (var i = 0; i &lt; response.choices.length; i++) {\r\n    text = text.concat(\r\n        '&lt;u&gt; + response.choices[i] + ' &lt;\r\n        \/u&gt; &lt;br&gt;');\r\n    }\r\n    message.text = text;\r\n    print(JSON.stringify(message));<\/pre>\n<\/li>\n<li><strong>SMS Channel Override Example<\/strong>\n<pre class=\"lang:default decode:true \">var message = {};\r\n    var indexArray = ['a', 'b', 'c',\r\n        'd', 'e',\r\n        'f', 'g', 'h', 'i', 'j',\r\n        'k', 'l', 'm', 'n', 'o',\r\n        'p', 'q', 'r', 's', 't',\r\n        'u', 'v', 'w', 'x', 'y',\r\n        'z'\r\n    ];\r\n    var text = response.message + '\\\\n';\r\n    for (var i = 0; i &lt; response.choices\r\n        .length; i++) {\r\n        text = text.concat(indexArray[i] +\r\n            ') ' + response.choices[\r\n                i] + '\\\\n');\r\n    }\r\n    message.text = text;\r\n    print(JSON.stringify(message));<\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>Using the <strong>getChoices()<\/strong> function, you can also customize the <strong>response display format<\/strong> using the <a href=\"\/docs\/bots\/sdks\/message-templates\/\" target=\"_blank\" rel=\"noopener noreferrer\">message formatting templates<\/a>. When the getChoices() function is called and there is an ambuguity, the platform returns the ambiguous choices information as an array which can be used to present the options to the end users.<br \/>\nFor example, to display the standard response for <em>Did you mean in<\/em> a button format, you can use the following code:<\/p>\n<pre class=\"lang:default decode:true \">var info =getChoices() ;\r\nvar message = {\r\n\"type\": \"template\",\r\n\"payload\": {\r\n  \"template_type\": \"button\",\r\n  \"text\": \"Did you mean\",\r\n  \"subText\": \"You can now customize response for did you mean\",\r\n  \"buttons\": []\r\n }\r\n};\r\nfor (i = 0; i &lt; info.length; i++) {\r\nvar button = {\r\n  \"type\": \"postback\",\r\n  \"title\": info[i],\r\n  \"payload\": \"payload1\"\r\n};\r\n\r\nmessage.payload.buttons.push(button);\r\n}\r\nprint(JSON.stringify(message)); \r\n<\/pre>\n<\/li>\n<li>Click\u00a0<strong>Done<\/strong> to save and close the <strong>Edit Response<\/strong> dialog and apply the new standard response.<\/li>\n<\/ol>\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><\/div><\/div><\/div><\/div><\/div><\/section>\n","protected":false},"excerpt":{"rendered":"There are multiple places where the platform responds to user utterances without the developer having to code the details. Examples include: Default Dialog when the user intent is not found or understood by the bot. Standard Responses to certain questions, greetings, error and warning scenarios, etc. Event Handlers for certain common bot events can be...","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[47],"tags":[],"class_list":["post-18003","post","type-post","status-publish","format-standard","hentry","category-bot-intelligence"],"_links":{"self":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/18003","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/comments?post=18003"}],"version-history":[{"count":23,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/18003\/revisions"}],"predecessor-version":[{"id":31081,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/18003\/revisions\/31081"}],"wp:attachment":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/media?parent=18003"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/categories?post=18003"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/tags?post=18003"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}