{"id":27067,"date":"2021-03-17T06:40:04","date_gmt":"2021-03-17T06:40:04","guid":{"rendered":"https:\/\/developer.kore.ai\/v10-1\/?p=27067"},"modified":"2022-09-26T20:35:45","modified_gmt":"2022-09-26T19:35:45","slug":"alert-task-message-definition","status":"publish","type":"post","link":"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/bot-builder-tool\/alert\/alert-task-message-definition\/","title":{"rendered":"Alert Task \u2013 Message Definition"},"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><span style=\"font-weight: 400\">For some Alert tasks, <\/span><a href=\"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/bot-builder-tool\/alert\/notification-tasks\/#Bot_Response\"><span style=\"font-weight: 400\">as seen here<\/span><\/a><span style=\"font-weight: 400\">, you can define the look and feel of the data presented to the end-user when the alert is displayed, based on the payload delivered by the webhook.<\/span><\/p>\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>\n<h1><span class=\"ez-toc-section\" id=\"Message_Definition_Overview\"><span style=\"font-weight: 400\">Message Definition Overview<\/span><\/span><\/h1>\n<p><span style=\"font-weight: 400\">To define the messages shown to a user when displaying an Alert Task, please follow the steps below:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Go to <\/span><strong>Build &gt; Conversation Skills &gt; Alert Tasks<\/strong><span style=\"font-weight: 400\">.<\/span><\/li>\n<li style=\"font-weight: 400\"><strong>Create or select the task<\/strong><span style=\"font-weight: 400\"> you want to work with.&nbsp;<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Select the <\/span><strong>Bot Response <\/strong><span style=\"font-weight: 400\">tab, then expand <\/span><strong>Message Definition<\/strong><span style=\"font-weight: 400\">.<\/span><\/li>\n<\/ul>\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>\n<h1><span class=\"ez-toc-section\" id=\"Response_Types\"><span style=\"font-weight: 400\">Response Types<\/span><\/span><\/h1>\n<p><span style=\"font-weight: 400\">You can define two kinds of bot responses for a task:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><strong>The default response for all channels:<\/strong><span style=\"font-weight: 400\"> Create the default title and message response for all channels based on the payload response from the API request and any processors defined. You can create a mixture of data from the response object along with your own inputs, a set of <\/span><strong>Variable Keys<\/strong><span style=\"font-weight: 400\"> derived from the Kore.ai system, custom variables, and the response sample. The response is displayed as a message, usually as a well-formed HTML message that contains one or more variables, such as the ID number or subject, from the requested object data.<\/span><\/li>\n<li style=\"font-weight: 400\"><strong>Channel-specific response:<\/strong><span style=\"font-weight: 400\"> You can also customize a response message for specific channels, for example, Facebook Messenger, Skype, SMS, or Web\/Mobile SDK, along with applying predefined message templates (tables, lists, graphs, etc.) for selected channels.<\/span><\/li>\n<\/ul>\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>\n<h1><span class=\"ez-toc-section\" id=\"Message_Definition_Editor_Features\"><span style=\"font-weight: 400\">Message Definition Editor Features<\/span><\/span><\/h1>\n<p><span style=\"font-weight: 400\">To open the editor for your Action task, go to <\/span><strong>Bot Response &gt;<\/strong> <strong>Message Definition<\/strong><span style=\"font-weight: 400\">. The Message Definition editor uses three tabs to offer the following features:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><strong>Standard Text<\/strong><span style=\"font-weight: 400\">: Use basic editor controls and HTML markup, and variable keys to define and format the response. Enter text, and then format it using buttons for bold, italics, header styles, hyperlinks, ordered and unordered lists, and inserting lines.<\/span><span style=\"font-weight: 400\"><br \/><\/span><\/li>\n<p><a ref=\"magnificPopup\" href=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220926194256\/Standard-text-1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220926194256\/Standard-text-1-1024x449.png\" alt=\"\" width=\"640\" height=\"281\" class=\"alignnone size-large wp-image-45530\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220926194256\/Standard-text-1.png 1024w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220926194256\/Standard-text-1-300x132.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<li style=\"font-weight: 400\"><strong>JavaScript<\/strong><span style=\"font-weight: 400\">: Add custom code to handle the end-user task response message, declare variables, use variable keys, and interact with third-party applications.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\"><strong>Preview<\/strong>: View a sample of the rendered output message, with markup, as the bot users see it.<\/span><\/li>\n<\/ul>\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>\n<h1><span class=\"ez-toc-section\" id=\"Adding_Variable_Keys\"><span style=\"font-weight: 400\">Adding Variable Keys<\/span><\/span><\/h1>\n<p><span style=\"font-weight: 400\">Follow these steps to add variable keys:<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Whether you are using Standard Text or JavaScript mode, to add a variable key, place the cursor where you want to add the variable and then click <\/span><strong>Variable Keys<\/strong><span style=\"font-weight: 400\">.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">In the <\/span><strong>Request\/Response Keys<\/strong><span style=\"font-weight: 400\"> dialog, expand the type of key node&nbsp; containing the variable you want to insert.<\/span><span style=\"font-weight: 400\"><br \/><\/span><\/li>\n<p><a ref=\"magnificPopup\" href=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220926195730\/variable-keys.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220926195730\/variable-keys.png\" alt=\"\" width=\"691\" height=\"123\" class=\"alignnone size-full wp-image-45542\" \/><\/a><\/p>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Select the variable that you want to add, for example, <code><\/span><span style=\"font-weight: 400\">env.FlightData <\/span><span style=\"font-weight: 400\"><\/code>and then click <\/span><strong>Ok<\/strong><span style=\"font-weight: 400\">,<\/span><\/li>\n<\/ol>\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>\n<h2><span class=\"ez-toc-section\" id=\"Standard_Keys\"><span style=\"font-weight: 400\">Standard Keys<\/span><\/span><\/h2>\n<p><strong>Standard Keys<\/strong><span style=\"font-weight: 400\"> are the following Kore.ai variable placeholders for reusable data.<\/span><\/p>\n<p><a ref=\"magnificPopup\" href=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220926201923\/standard-keys.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220926201923\/standard-keys.png\" alt=\"\" width=\"362\" height=\"490\" class=\"alignnone size-full wp-image-45554\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220926201923\/standard-keys.png 362w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220926201923\/standard-keys-222x300.png 222w\" sizes=\"auto, (max-width: 362px) 100vw, 362px\" \/><\/a><\/p>\n<ul>\n<li style=\"font-weight: 400\"><strong>_labels _<\/strong><span style=\"font-weight: 400\">: Returns the friendly label in place of a GUID. For example, when user data is requested from a web service API, the ID of a project or workspace returned is a GUID. You can use the <\/span><code><span style=\"font-weight: 400\">_labels_<\/span><\/code><span style=\"font-weight: 400\"> key to show the user-friendly name of the GUID to the end-user instead of the GUID. In Kore.ai, a drop-down control stores the response for the <\/span><code><span style=\"font-weight: 400\">_labels_<\/span><\/code><span style=\"font-weight: 400\"><span style=\"font-weight: 400\"> key as, for example:<br \/><\/span><\/span><br \/>\n<table style=\"height: 18px;width: 100%;border-collapse: collapse;background-color: #f7f7f7\">\n<tbody>\n<tr style=\"height: 18px\">\n<td style=\"width: 100%;height: 18px\">{<br \/>&nbsp; &nbsp; &#8220;_labels_&#8221;: {<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &#8220;15379386734832&#8221;: &#8220;roadlabs.com&#8221;,<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &#8220;26377329985341&#8221;: &#8220;Test Project&#8221;,<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &#8220;workspace&#8221;: &#8220;roadlabs.com&#8221;,<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &#8220;project&#8221;: &#8220;Test Project&#8221;<br \/>&nbsp; &nbsp; },<br \/>&nbsp; &nbsp; &#8220;_fields_&#8221;: {<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &#8220;workspace&#8221;: &#8220;15379386734832&#8221;,<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &#8220;project&#8221;: &#8220;26377329985341&#8221;<br \/>&nbsp; &nbsp; }<br \/>}<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/li>\n<li style=\"font-weight: 400\"><strong>_tenant_<\/strong><span style=\"font-weight: 400\"> &ndash; Returns the tenant for the enterprise when defined. For example, <\/span><em><span style=\"font-weight: 400\">JIRA<\/span><\/em><span style=\"font-weight: 400\"> requires a tenant for URLs, such as <\/span><span style=\"color: #0000ff\"><span style=\"font-weight: 400\">koreteam<\/span><\/span><span style=\"font-weight: 400\">, in <\/span><span style=\"color: #0000ff\"><span style=\"font-weight: 400\">https:\/\/<\/span>koreteam<span style=\"font-weight: 400\">.atlassian.net\/browse\/BBF-3265<\/span><\/span><span style=\"font-weight: 400\">. You can use the <\/span><code><span style=\"font-weight: 400\">_tenant_<\/span><\/code><span style=\"font-weight: 400\"> key to build a link in a task response such as:<\/span><\/li>\n<li style=\"font-weight: 400\"><strong>_fields_<\/strong><span style=\"font-weight: 400\"> &ndash; Used to return a task field input provided by the end-user that is not part of a payload response. For example, in a <\/span><em><span style=\"font-weight: 400\">JIRA<\/span><\/em><span style=\"font-weight: 400\"> task, the end-user is prompted to enter a workspace name. You can use the <\/span><code><span style=\"font-weight: 400\">_fields_<\/span><\/code><span style=\"font-weight: 400\"> key to store the end-user input as: <\/span><code><span style=\"font-weight: 400\">_fields_[\"workspace\"]<\/span><\/code><\/li>\n<li style=\"font-weight: 400\"><strong>_last_run<\/strong><span style=\"font-weight: 400\"> &ndash; Used to return the UTC date timestamp of a web service poll using ISO 8601 format, for example, 2016-03-05T12:44:38+00:00. For example, if a web service request returns all activity in a payload response, you can use the <\/span><code><span style=\"font-weight: 400\">_last_run<\/span><\/code><span style=\"font-weight: 400\"> key to filter results displayed before or after the value for <\/span><span style=\"font-weight: 400\"><code>_last_run<\/code>.<\/span><\/li>\n<\/ul>\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>\n<h2><span class=\"ez-toc-section\" id=\"Session_Keys\"><span style=\"font-weight: 400\">Session Keys<\/span><\/span><\/h2>\n<p><strong>Session Keys<\/strong><span style=\"font-weight: 400\"> are Kore.ai variable placeholders for user data specific to a single session instance.<\/span><\/p>\n<p><a ref=\"magnificPopup\" href=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220926195528\/session-keys.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220926195528\/session-keys.png\" alt=\"\" width=\"427\" height=\"172\" class=\"alignnone size-full wp-image-45539\" \/><\/a><\/p>\n<ul>\n<li style=\"font-weight: 400\"><strong>UserContext.get(&ldquo;_id&rdquo;)<\/strong><span style=\"font-weight: 400\"> &ndash; The Kore.ai userId.<\/span><\/li>\n<li style=\"font-weight: 400\"><strong>UserContext.get(&ldquo;emailId&rdquo;)<\/strong><span style=\"font-weight: 400\"> &ndash; The email address associated with the userId.<\/span><\/li>\n<li style=\"font-weight: 400\"><strong>UserContext.get(&ldquo;lastName&rdquo;)<\/strong><span style=\"font-weight: 400\"> &ndash; The last name of the user.<\/span><\/li>\n<li style=\"font-weight: 400\"><strong>UserContext.get(&ldquo;firstName&rdquo;)<\/strong><span style=\"font-weight: 400\"> &ndash; The first name of the user.<\/span><\/li>\n<li style=\"font-weight: 400\"><strong>UserContext.get(&ldquo;profImage&rdquo;)<\/strong><span style=\"font-weight: 400\"> &ndash; The image or avatar filename of the user.<\/span><\/li>\n<li style=\"font-weight: 400\"><strong>UserContext.get(&ldquo;profColor&rdquo;)<\/strong><span style=\"font-weight: 400\"> &ndash; The account color for the user.<\/span><\/li>\n<li style=\"font-weight: 400\"><strong>UserContext.get(&ldquo;activationStatus&rdquo;)<\/strong><span style=\"font-weight: 400\"> &ndash; The account status of the user.<\/span><\/li>\n<li style=\"font-weight: 400\"><strong>UserContext.get(&ldquo;jTitle&rdquo;)<\/strong><span style=\"font-weight: 400\"> &ndash; The title of the user, if defined.<\/span><\/li>\n<li style=\"font-weight: 400\"><strong>UserContext.get(&ldquo;orgId&rdquo;)<\/strong><span style=\"font-weight: 400\"> &ndash; The organizational ID of the user account, if defined.<\/span><\/li>\n<li style=\"font-weight: 400\"><strong>UserContext.get(&ldquo;customData&rdquo;)<\/strong><span style=\"font-weight: 400\"> &ndash; A developer-defined custom key.<\/span><\/li>\n<li style=\"font-weight: 400\"><strong>UserContext.get(&ldquo;identities&rdquo;)<\/strong><span style=\"font-weight: 400\"> &ndash; Alternate user IDs, if defined.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">Additional session keys may be available depending on how the task is defined and the context of keys available for that task. For more information about session and context keys, see <\/span><a href=\"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/bot-builder-tool\/dialog-task\/using-session-and-context-variables-in-tasks\/\"><span style=\"font-weight: 400\">Using Session and Context Variables in Tasks<\/span><\/a><span style=\"font-weight: 400\">.<\/span><\/p>\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>\n<h2><span class=\"ez-toc-section\" id=\"Response_Keys\"><span style=\"font-weight: 400\">Response Keys<\/span><\/span><\/h2>\n<p><span style=\"font-weight: 400\">Response Keys are parsed directly from your <\/span><strong>Response Sample<\/strong><span style=\"font-weight: 400\"> text in the <\/span><strong>API Response<\/strong><span style=\"font-weight: 400\"> tab. Response Keys vary depending on the Response Sample defined.<\/span><\/p>\n<p><a ref=\"magnificPopup\" href=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220926200219\/response-keys-1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220926200219\/response-keys-1.png\" alt=\"\" width=\"328\" height=\"653\" class=\"alignnone size-full wp-image-45545\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220926200219\/response-keys-1.png 328w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220926200219\/response-keys-1-151x300.png 151w\" sizes=\"auto, (max-width: 328px) 100vw, 328px\" \/><\/a><br \/>\n<span style=\"font-weight: 400\">The following list is an example of Response Keys available for an <\/span><em><span style=\"font-weight: 400\">Asana<\/span><\/em><span style=\"font-weight: 400\"> task.<\/span><br \/>\n<code><\/p>\n<p><span style=\"font-weight: 400\">request.data.workspace<br \/><\/span><span style=\"font-weight: 400\">request.data.projects<br \/><\/span><span style=\"font-weight: 400\">request.data.name<br \/><\/span><span style=\"font-weight: 400\">request.data.notes<br \/><\/span><span style=\"font-weight: 400\">labels.498346170860<br \/><\/span><span style=\"font-weight: 400\">labels.30887755353556<br \/><\/span><span style=\"font-weight: 400\">labels[\"data.workspace\"]<\/span><span style=\"font-weight: 400\">labels[\"data.projects\"]<\/span><span style=\"font-weight: 400\">_tenant_<br \/><\/span><span style=\"font-weight: 400\">response.data.id<br \/><\/span><span style=\"font-weight: 400\">response.data.created_at<br \/><\/span><span style=\"font-weight: 400\">response.data.modified_at<br \/><\/span><span style=\"font-weight: 400\">response.data.name<br \/><\/span><span style=\"font-weight: 400\">response.data.notes<br \/><\/span><span style=\"font-weight: 400\">response.data.completed<br \/><\/span><span style=\"font-weight: 400\">response.data.assignee_status<br \/><\/span><span style=\"font-weight: 400\">response.data.completed_at<br \/><\/span><span style=\"font-weight: 400\">response.data.due_on<br \/><\/span><span style=\"font-weight: 400\">response.data.due_at<br \/><\/span><span style=\"font-weight: 400\">response.data.workspace.id<br \/><\/span><span style=\"font-weight: 400\">response.data.workspace.name<br \/><\/span><span style=\"font-weight: 400\">response.data.num_hearts<br \/><\/span><span style=\"font-weight: 400\">response.data.parent<br \/><\/span><span style=\"font-weight: 400\">response.data.followers[0].id<br \/><\/span><span style=\"font-weight: 400\">response.data.followers[0].name<br \/><\/span><span style=\"font-weight: 400\">response.data.hearted<br \/><\/span><span style=\"font-weight: 400\">response.data.assignee<br \/><\/span><span style=\"font-weight: 400\">response.data.projects[0].id<br \/><\/span><span style=\"font-weight: 400\">response.data.projects[0].name<br \/><\/span><span style=\"font-weight: 400\">response.data.memberships[0].project.id<br \/><\/span><span style=\"font-weight: 400\">response.data.memberships[0].project.name<br \/><\/span><span style=\"font-weight: 400\">response.data.memberships[0].section<\/span><\/p>\n<p>  <\/code><br \/>\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>\n<h2><span class=\"ez-toc-section\" id=\"Report_Keys\"><span style=\"font-weight: 400\">Report Keys<\/span><\/span><\/h2>\n<p><span style=\"font-weight: 400\">Report Keys are Kore.ai variable placeholders that you can use in Report Template Definitions and Bot Responses to show links for additional information in a message that a user can click.<\/span><\/p>\n<p><a ref=\"magnificPopup\" href=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220926200715\/report-keys-1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220926200715\/report-keys-1.png\" alt=\"\" width=\"285\" height=\"429\" class=\"alignnone size-full wp-image-45548\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220926200715\/report-keys-1.png 285w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220926200715\/report-keys-1-199x300.png 199w\" sizes=\"auto, (max-width: 285px) 100vw, 285px\" \/><\/a><\/p>\n<ul>\n<li style=\"font-weight: 400\"><strong>reportInfo.reportLink<\/strong><span style=\"font-weight: 400\"> &ndash; The link defined in the <\/span><strong>Report Template Definition<\/strong><span style=\"font-weight: 400\"> section for this task.<\/span><\/li>\n<li style=\"font-weight: 400\"><strong>reportInfo.reportTitle<\/strong><span style=\"font-weight: 400\"> &ndash; The title defined in the <\/span><strong>Report Template Definition<\/strong><span style=\"font-weight: 400\"> for this task.<\/span><\/li>\n<\/ul>\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>\n<h1><span class=\"ez-toc-section\" id=\"Previewing_the_Response\"><span style=\"font-weight: 400\">Previewing the Response<\/span><\/span><\/h1>\n<p><span style=\"font-weight: 400\">On the message editor, click <\/span><strong>Preview<\/strong><span style=\"font-weight: 400\"> to generate a preview of your response using one of the following options:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><strong>Test &amp; Preview<\/strong><span style=\"font-weight: 400\"> &ndash; Opens the task setup page for your VA to define the task settings, authenticate, and then shows a preview of your response generated through your third-party web service, for example, <\/span><em><span style=\"font-weight: 400\">Asana<\/span><\/em><span style=\"font-weight: 400\">.<\/span><\/li>\n<li style=\"font-weight: 400\"><strong>Preview with sample response<\/strong><span style=\"font-weight: 400\"> &ndash; Generates the preview using the sample data provided with the key-value pairs defined in the <\/span><strong>Response Sample<\/strong><span style=\"font-weight: 400\"> section on the <\/span><strong>API Request<\/strong><span style=\"font-weight: 400\"> tab for the task.<\/span><\/li>\n<\/ul>\n<p><a ref=\"magnificPopup\" href=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220926200821\/message-preview.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220926200821\/message-preview.png\" alt=\"\" width=\"1010\" height=\"219\" class=\"alignnone size-full wp-image-45551\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220926200821\/message-preview.png 1010w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220926200821\/message-preview-300x65.png 300w\" sizes=\"auto, (max-width: 1010px) 100vw, 1010px\" \/><\/a><br \/>\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>\n<h1><span class=\"ez-toc-section\" id=\"Examples_of_Custom_JavaScript_Responses\"><span style=\"font-weight: 400\">Examples of Custom JavaScript Responses<\/span><\/span><\/h1>\n<p><span style=\"font-weight: 400\">The following examples show response objects using JavaScript to define the <\/span><strong>Post Title<\/strong><span style=\"font-weight: 400\"> and <\/span><strong>Post Description<\/strong><span style=\"font-weight: 400\"> sections that display output messages to the end-user when the task response message is sent.<\/span><\/p>\n<p><span style=\"font-weight: 400\">In the following example, the variable labeled <\/span><span style=\"color: #0000ff\"><span style=\"font-weight: 400\">desc <\/span><\/span><span style=\"font-weight: 400\">is only displayed if the value for the caption is defined in the JSON response.<\/span><\/p>\n<p><code><span style=\"font-weight: 400\">var desc = (caption !== \"undefined\" ? caption : \"\")<\/span><\/code><\/p>\n<p><span style=\"font-weight: 400\">In the next example, a clickable URL using the task <\/span><span style=\"color: #0000ff\"><span style=\"font-weight: 400\">title <\/span><\/span><span style=\"font-weight: 400\">is displayed in the task response message.<\/span><\/p>\n<p><code><span style=\"font-weight: 400\">var tasklink = '<\/span><a href=\"https:\/\/www.wunderlist.com\/webapp#\/tasks\/'%20+%20id%20+%20'\"><span style=\"font-weight: 400\">' + title + '<\/span><\/a><span style=\"font-weight: 400\">';<\/span><\/code><\/p>\n<p><span style=\"font-weight: 400\">In this last example, the link variable depends on the <\/span><span style=\"font-weight: 400\">type<\/span><span style=\"font-weight: 400\">, either <\/span><span style=\"font-weight: 400\">video<\/span><span style=\"font-weight: 400\"> or <\/span><span style=\"font-weight: 400\">photo<\/span><span style=\"font-weight: 400\">. Based on the <\/span><span style=\"font-weight: 400\">type<\/span><span style=\"font-weight: 400\">, the proper link is displayed.<\/span><\/p>\n<table style=\"height: 18px;width: 100%;border-collapse: collapse;background-color: #f7f7f7\">\n<tbody>\n<tr style=\"height: 18px\">\n<td style=\"width: 100%;height: 18px\">\n<p>var link = &#8220;&#8221;;<br \/>switch (type) {<br \/>&nbsp;&nbsp;&nbsp;&nbsp;case &#8220;video&#8221;:<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var video = (typeof(video_url) != &#8220;undefined&#8221;) ? video_url : permalink_url;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;link = &#8216;&lt;video controls&gt;&lt;source src =&#8221;&#8216; + video + &#8216;&#8221; type=&#8221;video\/mp4&#8243;&gt;&lt;\/video&gt;&#8217;;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;case &#8220;photo&#8221;:<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;link = &#8216;&lt;img src=&#8221;&#8216; + image_permalink + &#8216;&#8221;&gt;&lt;\/img&gt;&#8217;;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br \/>}<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"font-weight: 400\">You can create custom JavaScript to handle task-specific requirements on the <\/span><strong>JavaScript <\/strong><span style=\"font-weight: 400\">tab based on the payload response for the task.<\/span><\/p>\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>\n<h1><span class=\"ez-toc-section\" id=\"Channel-Specific_Responses\"><span style=\"font-weight: 400\">Channel-Specific Responses<\/span><\/span><\/h1>\n<p><span style=\"font-weight: 400\">A task response message may be dependent on the channel that the response message is displayed in, for example, in the Kore.ai Messenger client, an email, or in a text message. By default, the response message that you configure for <\/span><strong>Default for all Channels<\/strong><span style=\"font-weight: 400\"> is sent to all channels. However, you can define a specific response for one or more of the supported channels to display to the end-user in that channel instead of the default response.<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">To define the response message for a specific channel, click<\/span><strong> + Add Channel<\/strong><span style=\"font-weight: 400\"> to display the <\/span><strong>Choose a Channel<\/strong><span style=\"font-weight: 400\"> drop-down list.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Select a channel, for example, <\/span><strong>Kore.ai<\/strong><span style=\"font-weight: 400\">, and then configure the response for that channel on the <\/span><strong>JavaScript<\/strong><span style=\"font-weight: 400\"> tab.<\/span><\/li>\n<\/ol>\n<p><span style=\"font-weight: 400\">Only one response can be defined for each channel. The following JavaScript examples show how you can override the Kore.ai default formatting template by channel.<\/span><\/p>\n<table style=\"background-color: #fffbea;width: 100%\" width=\"100%\">\n<tbody>\n<tr>\n<td width=\"100%\">\n<p><strong><em>Note<\/em><\/strong><em><span style=\"font-weight: 400\">: Use the following keys to return default values for:<\/span><\/em><\/p>\n<ul>\n<li style=\"font-weight: 400\"><strong><em>response.message<\/em><\/strong><em><span style=\"font-weight: 400\"> &ndash; Returns the default message as a string.<\/span><\/em><\/li>\n<\/ul>\n<ul>\n<li style=\"font-weight: 400\"><strong><em>response.message.choices<\/em><\/strong><em><span style=\"font-weight: 400\"> &ndash; Returns the options choice or confirmation message types as an array.<\/span><\/em><\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<table style=\"height: 18px;width: 100%;border-collapse: collapse;background-color: #f7f7f7\">\n<tbody>\n<tr style=\"height: 18px\">\n<td style=\"width: 100%;height: 18px\">\n<p><strong>Slack Channel Override Example<\/strong><strong><br \/><\/strong><code><span style=\"font-weight: 400\">var message = {};<br \/><\/span><\/code><code><span style=\"font-weight: 400\">var attachments = [];<br \/><\/span><\/code><code><span style=\"font-weight: 400\">var attachment = {<br \/><\/span><\/code><code><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;'text': \"Exception occurred during API execution\",<br \/><\/span><\/code><code><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;'color': '#FFCC00',<br \/><\/span><\/code><code><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;'attachment_type': 'default'<br \/><\/span><\/code><code><span style=\"font-weight: 400\">};<br \/><\/span><\/code><code><span style=\"font-weight: 400\">attachments.push(attachment);<br \/><\/span><\/code><code><span style=\"font-weight: 400\">message.attachments = attachments;<br \/><\/span><\/code><code><span style=\"font-weight: 400\">print(JSON.stringify(message));<\/span><\/code><\/p>\n<p><code><\/code><\/p>\n<p><strong>FaceBook Channel Override Example<\/strong><strong><br \/><\/strong><code><span style=\"font-weight: 400\">var message = {<br \/><\/span><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;text: response.message<br \/><\/span><span style=\"font-weight: 400\">};<br \/><\/span><span style=\"font-weight: 400\">var buttons = [];<br \/><\/span>for (var i = 0; i &lt; response.choices.length; i++) {<\/code><br \/><code><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;var choiceItem = response.choices[i];<br \/><\/span><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;if (choiceItem.length &gt; 20) {<br \/><\/span>&nbsp; &nbsp; &nbsp; &nbsp; choiceItem = choiceItem.substring(<\/code><br \/><code><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0, 18) + '..';<br \/><\/span>&nbsp; &nbsp; }<\/code><br \/><code><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;var element = {<br \/><\/span><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;content_type: 'text',<br \/><\/span><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;title: choiceItem,<br \/><\/span><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;payload: choiceItem<br \/><\/span><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;};<br \/><\/span><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;buttons.push(element);<br \/><\/span><span style=\"font-weight: 400\">}<br \/><\/span><span style=\"font-weight: 400\">message.quick_replies = buttons;<br \/><\/span><span style=\"font-weight: 400\">print(JSON.stringify(message));<\/span><\/code><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Email Channel Override Example<\/strong><strong><br \/><\/strong><code><span style=\"font-weight: 400\">var message = {};<br \/><\/span><span style=\"font-weight: 400\">var text = response.message + ' &lt;br&gt; ';<br \/><\/span><span style=\"font-weight: 400\">for (var i = 0; i &lt; response.choices.length; i++) {<br \/><\/span><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;text = text.concat(<br \/><\/span><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'&lt;u&gt; + response.choices[i] + ' &lt;<br \/><\/span><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/u&gt; &lt;br&gt;');<br \/><\/span><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;}<br \/><\/span><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;message.text = text;<\/p>\n<p><\/span><\/code><span style=\"font-weight: 400\"><code>&nbsp;&nbsp;&nbsp;&nbsp;print(JSON.stringify(message));<\/code><\/p>\n<p><\/span><\/p>\n<p><strong>SMS Channel Override Example<\/strong><strong><br \/><\/strong><code><span style=\"font-weight: 400\">var message = {};<br \/><\/span><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;var indexArray = ['a', 'b', 'c',<br \/><\/span><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'d', 'e',<br \/><\/span><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'f', 'g', 'h', 'i', 'j',<br \/><\/span><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'k', 'l', 'm', 'n', 'o',<br \/><\/span><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'p', 'q', 'r', 's', 't',<br \/><\/span><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'u', 'v', 'w', 'x', 'y',<br \/><\/span><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'z'<br \/><\/span><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;];<br \/><\/span><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;var text = response.message + '\\\\n';<br \/><\/span><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;for (var i = 0; i &lt; response.choices<br \/><\/span><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.length; i++) {<br \/><\/span><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;text = text.concat(indexArray[i] +<br \/><\/span><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;') ' + response.choices[<br \/><\/span><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;i] + '\\\\n');<br \/><\/span><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;}<br \/><\/span><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;message.text = text;<\/span><span style=\"font-weight: 400\">&nbsp;&nbsp;&nbsp;&nbsp;<br \/>print(JSON.stringify(message));<\/span><\/code><\/p>\n<p>&nbsp;<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/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><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\r\n\t\t<\/div>\r\n\t<\/div>\r\n<\/div><\/div><\/div><\/div><\/div><\/section>\n","protected":false},"excerpt":{"rendered":"For some Alert tasks, as seen here, you can define the look and feel of the data presented to the end-user when the alert is displayed, based on the payload delivered by the webhook. Message Definition Overview To define the messages shown to a user when displaying an Alert Task, please follow the steps below:...","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[67],"tags":[],"class_list":["post-27067","post","type-post","status-publish","format-standard","hentry","category-alert"],"_links":{"self":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/27067","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=27067"}],"version-history":[{"count":6,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/27067\/revisions"}],"predecessor-version":[{"id":45560,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/27067\/revisions\/45560"}],"wp:attachment":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/media?parent=27067"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/categories?post=27067"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/tags?post=27067"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}