{"id":17958,"date":"2016-12-09T14:43:35","date_gmt":"2016-12-09T14:43:35","guid":{"rendered":"https:\/\/developer.kore.com\/?post_type=docs&#038;p=9233"},"modified":"2021-03-30T12:43:23","modified_gmt":"2021-03-30T11:43:23","slug":"working-with-the-service-node","status":"publish","type":"post","link":"https:\/\/developer.kore.ai\/v7-1\/docs\/bots\/bot-builder-tool\/dialog-task\/working-with-the-service-node\/","title":{"rendered":"Working with the Service 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>The <strong>Service\u00a0node<\/strong> is a component\u00a0type in a dialog task that\u00a0you can use to add an API service to make REST or SOAP requests to third-party web services. You can use this node when you have collected the parameters needed for the API request using Entity or other nodes to capture the user input.<\/p>\n<p>You can define the Service Type as one of:<\/p>\n<ul>\n<li><strong>Custom Service<\/strong> &#8211;\u00a0Define an API request to a third-party web service. This is the default setting.<\/li>\n<li><strong>HTML to Image<\/strong> &#8211; Define HTML to render as an image using JavaScript. For example, you want to compose HTML or the value of a key in a web service response contains HTML markup as a string that you want to convert to an image.<\/li>\n<li><strong>URL to Image<\/strong> &#8211; Define a\u00a0web page URL to load to render an image.<\/li>\n<li><strong>Alert Subscription Service<\/strong> &#8211; Define contextually relevant alerts to be sent proactively to the user as a part of the dialog journey.<\/li>\n<\/ul>\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=\"propertiesPanel\"><span class=\"ez-toc-section\" id=\"Creating_a_Service_node\">Creating a Service node<\/span><\/h2>\n<ol>\n<li>Click the <strong>Plus icon<\/strong> <img loading=\"lazy\" decoding=\"async\" class=\"icon alignnone wp-image-9160\" src=\"\/wp-content\/uploads\/sites\/12\/DIYDialogTaskPlusIcon.png\" alt=\"diydialogtaskplusicon\" width=\"15\" height=\"15\" \/> where you want to add a new Service\u00a0node,<\/li>\n<li>Select <strong>Service <\/strong>and then click <strong>Create new Service Call<\/strong>. You can also select from a list of pre-defined Service Nodes.<\/li>\n<li>A new default Service node is added, and the <strong>Component\u00a0Properties<\/strong> panel is displayed.<br \/>\n<a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/12\/Component-Properties-5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-19487\" src=\"\/wp-content\/uploads\/sites\/12\/Component-Properties-5.png\" alt=\"\" width=\"820\" height=\"649\" \/><\/a><\/li>\n<li>In the <strong>General Settings<\/strong>, enter the <strong>Name<\/strong> and <strong>Display Name<\/strong> of your Service node, for example, <span style=\"color: #0000ff\">FetchWeather<\/span>.<\/li>\n<li>Choose the <strong>Service Type<\/strong> as:\n<ul>\n<li><strong>Custom Service<\/strong> &#8211;\u00a0Define an API request to a third-party web service. This is the default setting.<\/li>\n<li><strong>HTML to Image<\/strong> &#8211; Define HTML to render as an image using JavaScript. For example, you want to compose HTML or the value of a key in a web service response contains HTML markup as a string that you want to convert to an image.<\/li>\n<li><strong>URL to Image<\/strong> &#8211; Define a\u00a0web page URL to load to render an image.<\/li>\n<li><strong>Custom Authentication Service<\/strong> &#8211; Define a URL to a third-party\u00a0application that provides\u00a0the authentication services necessary for the task flow. <a href=\"\/v7-1\/docs\/bots\/bot-builder-tool\/develop\/dialog-task\/implementing-custom-authentication\/\">Learn more<\/a>.<\/li>\n<li><strong>Alert Subscription Service<\/strong> &#8211; Define contextually relevant alerts to be sent proactively to the user as a part of the dialog journey.<\/li>\n<\/ul>\n<\/li>\n<li>Based upon the Service Type selected, enter the Type\/Sub Type or Auth URL.<\/li>\n<li>In the <strong>Request Definition<\/strong> section, click &gt;<strong>Define Request<\/strong>.<\/li>\n<li>The <strong>Define Request for\u00a0&lt; <em>ServiceXXXX<\/em>\u00a0&gt;<\/strong> dialog is displayed. Depending on the <strong>Service Type<\/strong> selected, see one of the following sections in this topic:<br \/>\nNote: In the case of Custom Authentication Service, the Request Definition section doesn&#8217;t apply and you can see a Response section instead. <a href=\"\/v7-1\/docs\/bots\/bot-builder-tool\/develop\/dialog-task\/implementing-custom-authentication\/\">Learn more.\u00a0<\/a><\/p>\n<ul>\n<li><a href=\"#custom\">Defining a Custom Service<\/a><\/li>\n<li><a href=\"#URL\">Defining a URL to Convert to Image<\/a><\/li>\n<li><a href=\"#HTML\">Defining HTML to Convert to Image<\/a><\/li>\n<li><a href=\"#auto\">Defining Alert Subscription Service<\/a><\/li>\n<\/ul>\n<\/li>\n<li>From the node\u2019s <strong>Connections panel<\/strong> 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:\n<ol>\n<li>You can select from the available nodes under the\u00a0<strong>Default<\/strong> connections.<\/li>\n<li>To configure a conditional flow, click <b>Add IF<\/b>.<\/li>\n<li>Configure the conditional expression based on one of the following criteria:\n<ol>\n<li><b>Entity<\/b>: Compare an Entity node 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>. Select the entity, operator using the respective drop-down lists, and type the number in the <b>Value <\/b>box. Example: <i>PassengerCount (entity) greater than (operator) 5 (specified value)<\/i><\/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<\/ol>\n<\/li>\n<li>In the <b>Then go to<\/b> the 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.<\/li>\n<\/ol>\n<div class=\"alert alert-info\"><b>Note:<\/b> If you want to write multiple If conditions, click <strong>Add Else If<\/strong> below the last If conditional expression.<\/div>\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=\"custom\"><span class=\"ez-toc-section\" id=\"Defining_a_Custom_Service\">Defining a Custom Service<\/span><\/h3>\n<ol>\n<li>When\u00a0<strong>Custom Service<\/strong> is selected for <strong>Service Type<\/strong>, then in the <strong>Sub-Type<\/strong> field, select one of:\n<ul>\n<li><strong>REST<\/strong> &#8211; The API web service is using REST services.<\/li>\n<li><strong>SOAP<\/strong> &#8211; The API web service is using SOAP services.<\/li>\n<\/ul>\n<\/li>\n<li>In the <strong>Request\u00a0Definition<\/strong>\u00a0section, click <span style=\"color: #33cccc\"><strong>Define Request<\/strong><\/span>\u00a0to specify the settings for the web service type.<\/li>\n<li>The <strong>Define Request for &lt; <em>Service Node Name<\/em> &gt;<\/strong>\u00a0dialog is displayed as shown in the following illustration.<br \/>\n<a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/12\/Defining-Custom-Service-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-19488\" src=\"\/wp-content\/uploads\/sites\/12\/Defining-Custom-Service-1.png\" alt=\"\" width=\"820\" height=\"461\" \/><\/a><\/p>\n<ol>\n<li>In the <strong>Request URL<\/strong> field, in the first field, select the HTTP method used for the request. One of:\n<ul>\n<li><strong>POST\u00a0<\/strong>\u2013 Used to send data to the server, for example, customer information, file upload, and so forth\u00a0using HTML forms.<\/li>\n<li><strong>PUT\u00a0<\/strong>\u2013\u00a0Replaces the content\u00a0of the target resource with the content sent.<\/li>\n<li><strong>PATCH<\/strong> \u2013 Appends\u00a0the content\u00a0of an existing target resource with the content sent.<\/li>\n<li><strong>DELETE<\/strong> \u2013 Deletes the content of an existing target resource.<\/li>\n<li><strong>GET<\/strong> \u2013 Returns the content of an existing target resource.<\/li>\n<\/ul>\n<p><strong>NOTE<\/strong>: For SOAP services, you can pass the XML payload in the &#8216;body&#8217; by using the POST method<\/li>\n<li>In the second field of the <strong>Request URL<\/strong>,\u00a0specify the URL for the Dialog task\u00a0response to process at Kore.ai, for example,\u00a0<span style=\"color: #0000ff\">http:\/\/koremessenger.com\/postURL<\/span>. Add query or path parameters as part of the URL, if required. To use Entity node values as parameters, use the following syntax for accessing the <code>Context<\/code> object:\u00a0<span style=\"color: #0000ff\">https:\/\/myDomain.com\/{{context.entities.topic}}<\/span>\u00a0for the\u00a0<code>context.entities.topic<\/code>. You must use the double brackets <code>{{ context.object }}<\/code>. For more information, see the <a href=\"\/v7-1\/docs\/bots\/bot-builder-tool\/dialog-task\/context-object\/\">Context Object<\/a>.<\/li>\n<li>Optionally, click <strong>Show Advanced<\/strong>, and then select\n<ul>\n<li><strong>Yes<\/strong>\u00a0in the<strong> Access Using A Connector<\/strong>\u00a0field if\u00a0access for Kore.ai Bots are using\u00a0the Kore.ai Connector agent. For more information, see <a href=\"\/v7-1\/docs\/bots\/admin-console\/security-control\/security-module-overview\/#connector\">Using the Kore.ai Connector<\/a>.<\/li>\n<li><strong>Yes<\/strong> in the\u00a0<strong>De-Identification of PII Data<\/strong> to redact any sensitive information types that users share with your bots. For more information, see <a href=\"\/v7-1\/docs\/bots\/advanced-topics\/bot-settings\/pii-data-masking\/\">Redacting Personally Identifiable Information<\/a><\/li>\n<\/ul>\n<\/li>\n<li>In the <strong>Auth<\/strong> tab, select the type of authorization needed for this Service node call, or define a new authorization\u00a0type if needed. For more information, see <a href=\"\/v7-1\/docs\/bots\/advanced-topics\/authorization\/bot-authentication\/\">Setting Up Authentication<\/a>.<\/li>\n<li>In the <strong>Headers<\/strong> tab, specify the headers as key\/value pairs if required to access the specified <strong>Request\u00a0URL<\/strong>. \u00a0Authentication headers are auto-generated based on the authorization type specified on the <strong>Auth<\/strong> tab.\u00a0You need to define any other standard headers, for example, Content-type, Accept, etc. or any custom headers.\u00a0Headers defined here are only applicable to this Service node.<\/li>\n<li>In the <strong>Body<\/strong> tab, select the body content type. One of:\n<ul>\n<li><strong>application\/x-www-form-urlencoded<\/strong> &#8211; Also known as Multipart\/Form-data, which is an encoding type that allows files to be sent through an HTTP POST request method if you want to allow a user to upload a file from a form. You can add key\/value pairs which are encoded by the Bots platform.<\/li>\n<li><strong>application\/json<\/strong> &#8211; Use JSON\u00a0to transmit data between the Kore.ai servers and your Bot\u00a0web application. Any JSON is sent with the request without any processing.<\/li>\n<li><strong>application\/xml<\/strong> \u2013 For SOAP services, pass XML payload using POST methods. You can pass Entity node values as part of the XML, using the following syntax for accessing the <code>Context<\/code>\u00a0object:\u00a0https:\/\/myDomain.com\/{{context.entities.topic}}\u00a0for the\u00a0<code>context.entities.topic<\/code>. You must use the double brackets\u00a0<code>{{ context.object }}<\/code>. For more information, see the\u00a0<a href=\"\/v7-1\/docs\/bots\/bot-builder-tool\/dialog-task\/context-object\/\">Context Object<\/a>.<\/li>\n<\/ul>\n<\/li>\n<li>In the <strong>Test Request<\/strong> tab, click <strong>Test<\/strong> to optionally send\u00a0your API <strong>Request URL<\/strong>, using the specify <strong>Auth<\/strong> type, HTTP headers, and body parameters, if defined. The response is displayed in the text area. Click <strong>Save as Sample Response<\/strong> to save the test response as the sample response for this node.<\/li>\n<li>Click <strong>Save<\/strong> to save the request for the Service node and close the\u00a0<strong>Define Request for &lt; <em>Service Node Name<\/em> &gt;<\/strong>\u00a0dialog.<\/li>\n<\/ol>\n<\/li>\n<li>In the <strong>Sample Response<\/strong> section, optionally click <strong>Add Sample Response<\/strong> to display the <strong>Add Sample Response<\/strong> dialog that you can use to manually enter or paste a sample response.<\/li>\n<li>Optionally, in the <strong>Add Sample Response<\/strong> drop-down list, select one of:\n<ul>\n<li><strong>JSON<\/strong> &#8211; A list of JSON key\/value pairs available in the Request URL response that can be used in other nodes as variables.<\/li>\n<li><strong>RAW<\/strong> &#8211;\u00a0A list of key\/value pairs that can be used in other nodes as variables.<\/li>\n<\/ul>\n<\/li>\n<li>In the <strong>Component Properties<\/strong> section, under <strong>Advanced Controls<\/strong>, you can configure the <strong>Timeout<\/strong> for terminating the service call. By default, it is set for 20 seconds, you can choose a value anywhere between 5 to 20 seconds.<\/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=\"URL\"><span class=\"ez-toc-section\" id=\"Defining_a_URL_to_Convert_to_Image\">Defining a URL to Convert to Image<\/span><\/h3>\n<ol>\n<li>When\u00a0<strong>URL to Image<\/strong>\u00a0is selected for <strong>Service Type<\/strong>,\u00a0the <strong>Type<\/strong>\u00a0setting is read-only.<\/li>\n<li>In the\u00a0<strong>Request\u00a0Definition<\/strong>\u00a0section, click <span style=\"color: #33cccc\"><strong>Define Request<\/strong><\/span>\u00a0to specify the settings when <strong>URL to Image<\/strong>\u00a0is selected for <strong>Service Type<\/strong>. The <strong>Define Request for &lt; <em>Service Node Name<\/em> &gt;<\/strong>\u00a0dialog is displayed as shown in the following illustration.<br \/>\n<a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/12\/URL-to-Image-1024x239.png\" rel=\"attachment wp-att-15645\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-15645\" src=\"\/wp-content\/uploads\/sites\/12\/URL-to-Image-1024x239.png\" alt=\"\" width=\"835\" height=\"195\" \/><\/a><\/li>\n<li>In the <strong>URL to Convert<\/strong> field, enter the URL for the image. The\u00a0syntax when using a\u00a0<code>Context<\/code> object key in a URL is to enclose the object name in double brackets, for example, <span style=\"color: #0000ff\">https:\/\/myURLimage.com\/<strong>{{context.entities.imageName}}<\/strong>.<\/span><\/li>\n<li>In the <strong>Render Sizes<\/strong> section, specify a name for the image size, for example, <span style=\"color: #0000ff\">iPhone<\/span> or <span style=\"color: #0000ff\">tablet<\/span>, enter the <strong>Width<\/strong> and <strong>Height<\/strong> in pixels, and then click <strong><span style=\"color: #33cccc\">+Add<\/span><\/strong> to add additional sizes, or click <strong>Add<\/strong> to save and close the dialog.<\/li>\n<li>Click <strong>Save<\/strong> to save the request for the Service node and close the\u00a0<strong>Define Request for &lt; <em>Service Node Name<\/em> &gt;<\/strong>\u00a0dialog.<\/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=\"HTML\"><span class=\"ez-toc-section\" id=\"Defining_HTML_to_Convert_to_Image\">Defining HTML\u00a0to Convert to Image<\/span><\/h3>\n<ol>\n<li>When\u00a0<strong>HTML to Image<\/strong>\u00a0is selected for <strong>Service Type<\/strong>,\u00a0the <strong>Type<\/strong>\u00a0setting is read-only.<\/li>\n<li>In <strong>Request\u00a0Definition<\/strong>\u00a0section, click <span style=\"color: #33cccc\"><strong>Define Request<\/strong><\/span>\u00a0to specify the settings when <strong>HTML to Image<\/strong>\u00a0is selected for <strong>Service Type<\/strong>. The <strong>Define Request for &lt; <em>Service Node Name<\/em> &gt;<\/strong>\u00a0dialog is displayed as shown in the following illustration.<br \/>\n<a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/12\/HTML-to-Image-1024x384.png\" rel=\"attachment wp-att-15646\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-15646\" src=\"\/wp-content\/uploads\/sites\/12\/HTML-to-Image-1024x384.png\" alt=\"\" width=\"835\" height=\"313\" \/><\/a><\/li>\n<li>In the <strong>HTML to Convert<\/strong> field, enter the HTML\u00a0for the image.<\/li>\n<li>In the <strong>Render Sizes<\/strong> section, specify a name for the image size, for example, <span style=\"color: #0000ff\">iPhone<\/span> or <span style=\"color: #0000ff\">tablet<\/span>, enter the <strong>Width<\/strong> and <strong>Height<\/strong> in pixels, and then click <strong><span style=\"color: #33cccc\">+Add<\/span><\/strong> to add additional sizes, or click <strong>Add<\/strong> to save and close the dialog.<\/li>\n<\/ol>\n<p><strong><em>Example HTML Definition<\/em><\/strong><br \/>\nThe following is an example for converting HTML to an image:<\/p>\n<pre class=\"lang:default decode:true\">&lt;head&gt;\r\n&lt;link href=\"..\/assets\/styles.min.css\" rel=\"stylesheet\"\/&gt;\r\n&lt;title&gt;HTML: Print Wide HTML Tables&lt;\/title&gt;\r\n&lt;script src=\"\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/1.10.2\/jquery.min.js\"&gt;&lt;\/script&gt;\r\n&lt;style&gt;\r\n  .style1 {\r\n     border-collapse: collapse;\r\n     }\r\n  .style1 th {\r\n     background-color: #DDDDDD;\r\n     white-space: nowrap;\r\n     }\r\n  .style1 .d {\r\n     white-space: nowrap;\r\n     }\r\n  .style1 .n {\r\n     padding-left: 20px;\r\n     text-align: right;\r\n     }\r\n&lt;\/style&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n&lt;table id=\"table1\" class=\"style1\" border=\"1\" cellpadding=\"4\" cellspacing=\"0\"&gt;\r\n  \/\/\/TODO Add Table Rows here.\r\n&lt;\/table&gt;\r\n&lt;input type=\"button\" id=\"print-button\" value=\"Make this table printable contact@ {{context.session.UserContext.emailId}}\"\/&gt;\r\n&lt;script&gt;\r\n\/*\r\n * HTML: Print Wide HTML Tables\r\n * http:\/\/salman-w.blogspot.com\/2013\/04\/printing-wide-html-tables.html\r\n*\/\r\n$(function() {\r\n$(\"#print-button\").on(\"click\", function() {\r\n   var table = $(\"#table1\"),\r\n       tableWidth = table.outerWidth(),\r\n       pageWidth = 600,\r\n       pageCount = Math.ceil(tableWidth \/ pageWidth),\r\n       printWrap = $(\"&lt;div&gt;&lt;\/div&gt;\").insertAfter(table),\r\n       i,\r\n       printPage;\r\n   for (i = 0; i &lt; pageCount; i++) {\r\n      printPage = $(\"&lt;div&gt;&lt;\/div&gt;\").css({\r\n          \"overflow\": \"hidden\",\r\n          \"width\": pageWidth,\r\n          \"page-break-before\": i === 0 ? \"auto\" : \"always\"\r\n        }).appendTo(printWrap);\r\n   table.clone().removeAttr(\"id\").appendTo(printPage).css({\r\n      \"position\": \"relative\",\r\n      \"left\": -i * pageWidth\r\n     });\r\n   }\r\n table.hide();\r\n $(this).prop(\"disabled\", true);\r\n});\r\n});\r\n&lt;\/script&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p>The preceding HTML example, when table rows are added into the example, can render the following image to an end-user.<br \/>\n<a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/12\/DIYDialogTaskServiceNodeHTMLtoImageUser.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-9703\" src=\"\/wp-content\/uploads\/sites\/12\/DIYDialogTaskServiceNodeHTMLtoImageUser.png\" alt=\"HTML Image Example\" width=\"280\" height=\"465\" \/><\/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>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3 id=\"auto\"><span class=\"ez-toc-section\" id=\"Defining_Alert_Subscription_Service\">Defining Alert Subscription Service<\/span><\/h3>\n<p>You can now automatically subscribe your bot users to send contextually relevant alerts as part of the dialog journey. For example, a person booking a flight ticket for a specific date can be auto-subscribed to get regular updates on the weather forecast for the destination city.<br \/>\n<b>To set up an Alert Subscription service<\/b><\/p>\n<ol>\n<li>Open the Properties panel of the Service Node to which you want to associate the alert.<\/li>\n<li>In the <b>Service Type <\/b>drop-down list, select <b>Auto Subscription Service.<\/b><br \/>\n<a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/12\/Properties-Panel-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-16721\" src=\"\/wp-content\/uploads\/sites\/12\/Properties-Panel-1.png\" alt=\"\" width=\"500\" height=\"640\" \/><\/a><\/li>\n<li>Click <b>Define Request<\/b>. It opens the Smart\/Automatic Alerts dialog.<br \/>\n<b>Note<\/b>: To create an Alert Subscription service, you must base it on an existing alert task. Users will be auto-subscribed to the alert task on reaching the associated service node in the dialog.<\/li>\n<li>From the <b>Choose Alert <\/b>drop-down list, select an alert task. The list consists of only the published alert tasks related to your bot.<br \/>\n<a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/12\/Select-Alert.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-13196\" src=\"\/wp-content\/uploads\/sites\/12\/Select-Alert.png\" alt=\"\" width=\"506\" height=\"225\" \/><\/a><\/li>\n<li>Enter the necessary information as explained below.<\/li>\n<\/ol>\n<h4>Alert Subscription (Smart Alert) Configurations<br \/>\n<a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/12\/Settings.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-13197\" src=\"\/wp-content\/uploads\/sites\/12\/Settings.png\" alt=\"\" width=\"435\" height=\"360\" \/><\/a><\/h4>\n<p>In a typical alert setup, the alert parameters, filters, and other necessary details are entered by the bot users. Since this is an auto-subscription for alerts, you need to configure those details as a developer.<\/p>\n<h5>ALERT PARAMETERS<\/h5>\n<p>These vary according to the alert you select. Provide the default parameter values to be used for the Alert Subscription service.<br \/>\nIn this example, the parameters to be defined for the alert are Topic name and News Region. Since the idea is to send weather forecast to the user for the destination city, you could set the parameter values are <i>Weather Forecast<\/i> and <i>context.entity.destinationcity<\/i> respectively.<\/p>\n<h5>FILTERS<\/h5>\n<p>These vary according to the alert you select. Provide the filter criteria to be used for the Alert Subscription service.<\/p>\n<h5>ALERT FREQUENCY<\/h5>\n<p>Provide the frequency for sending alert notifications. You need to select a Scheme, Frequency and a Time Frame.<\/p>\n<ul>\n<li>From the <b>Select Scheme<\/b> drop-down, select daily, weekday, or weekend, depending on when you want to send the alert.<\/li>\n<li>From the <b>Select Frequency <\/b>drop-down, select Every if you want to send the multiple alerts at regular intervals of time in a day or select at to send one alert a specific time of the day.<\/li>\n<li>From the <b>Select Time<\/b> drop-down, select an interval time value or a time of the day, depending on the frequency value chosen above.<\/li>\n<\/ul>\n<p>In our example, we have selected Daily At 6 a.m. which means an alert is sent to the user every day at 6 a.m.<\/p>\n<h5>SMART ALERT EXPIRY<\/h5>\n<p>Configure when to expire sending alerts to the users from one of the following options:<\/p>\n<ul>\n<li>Duration: Stops sending notification after the entered number of days from the date of subscription.<\/li>\n<li>Number of Notifications: Stops sending alerts after an entered number of notifications are sent.<\/li>\n<\/ul>\n<h5>ALERT UPGRADES<\/h5>\n<p>Define the expected behavior of this alert if an upgraded version of the underlying alert task (the published alert that you have selected at the beginning) is published.<\/p>\n<ul>\n<li><b>Remove Existing Instances<\/b><br \/>\nAll existing subscriptions of this smart alert will be removed and users will no longer receive notifications. Users will be auto-subscribed to the upgraded alert task only when they execute the dialog and reach the service node in the dialog journey.<\/li>\n<li><b>Allow Users To Manually Upgrade Subscription<br \/>\n<\/b>Users will receive an Upgrade notification on the selected channel which a link that guides them through to upgrade their auto-subscription. If the upgrade is successful, the user will receive a success notification.<\/li>\n<\/ul>\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":"The Service\u00a0node is a component\u00a0type in a dialog task that\u00a0you can use to add an API service to make REST or SOAP requests to third-party web services. You can use this node when you have collected the parameters needed for the API request using Entity or other nodes to capture the user input. You can...","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29],"tags":[],"class_list":["post-17958","post","type-post","status-publish","format-standard","hentry","category-dialog-task"],"_links":{"self":[{"href":"https:\/\/developer.kore.ai\/v7-1\/wp-json\/wp\/v2\/posts\/17958","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developer.kore.ai\/v7-1\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/developer.kore.ai\/v7-1\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v7-1\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v7-1\/wp-json\/wp\/v2\/comments?post=17958"}],"version-history":[{"count":7,"href":"https:\/\/developer.kore.ai\/v7-1\/wp-json\/wp\/v2\/posts\/17958\/revisions"}],"predecessor-version":[{"id":21634,"href":"https:\/\/developer.kore.ai\/v7-1\/wp-json\/wp\/v2\/posts\/17958\/revisions\/21634"}],"wp:attachment":[{"href":"https:\/\/developer.kore.ai\/v7-1\/wp-json\/wp\/v2\/media?parent=17958"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.kore.ai\/v7-1\/wp-json\/wp\/v2\/categories?post=17958"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.kore.ai\/v7-1\/wp-json\/wp\/v2\/tags?post=17958"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}