GETTING STARTED
Kore.ai XO Platform
Virtual Assistants Overview
Natural Language Processing (NLP)
Concepts and Terminology
Quick Start Guide
Accessing the Platform
Working with the Builder
Building a Virtual Assistant
Using Workspaces
Release Notes
Current Version
Previous Versions
Deprecations

CONCEPTS
Design
Storyboard
Dialog Tasks
Overview
Dialog Builder
Node Types
Intent Node
Dialog Node
Entity Node
Form Node
Confirmation Node
Message Nodes
Logic Node
Bot Action Node
Service Node
Webhook Node
Script Node
Group Node
Agent Transfer
User Prompts
Voice Call Properties
Dialog Task Management
Connections & Transitions
Component Transition
Context Object
Event Handlers
Knowledge Graph
Introduction
Knowledge Extraction
Build Knowledge Graph
Add Knowledge Graph to Bot
Create the Graph
Build Knowledge Graph
Add FAQs
Run a Task
Build FAQs from an Existing Source
Traits, Synonyms, and Stop Words
Manage Variable Namespaces
Update
Move Question and Answers Between Nodes
Edit and Delete Terms
Edit Questions and Responses
Knowledge Graph Training
Knowledge Graph Analysis
Knowledge Graph Import and Export
Importing Knowledge Graph
Exporting Knowledge Graph
Creating a Knowledge Graph
From a CSV File
From a JSON file
Auto-Generate Knowledge Graph
Alert Tasks
Small Talk
Digital Skills
Digital Forms
Views
Introduction
Panels
Widgets
Feedback Survey
Train
Introduction
ML Engine
Introduction
Model Validation
FM Engine
KG Engine
Traits Engine
Ranking and Resolver
NLP Configurations
NLP Guidelines
Intelligence
Introduction
Contextual Memory
Contextual Intents
Interruption Management
Multi-intent Detection
Amending Entities
Default Conversations
Sentinment Management
Tone Analysis
Test & Debug
Talk to Bot
Utterence Testing
Batch Testing
Conversation Testing
Deploy
Channels
Publish
Analyze
Introduction
Conversations Dashboard
Performance Dashboard
Custom Dashboards
Introduction
Meta Tags
Dashboards and Widgets
Conversations History
Conversation Flows
Feedback Analytics
NLP Metrics
Containment Metrics
Usage Metrics
Smart Bots
Universal Bots
Introduction
Universal Bot Definition
Universal Bot Creation
Training a Universal Bot
Universal Bot Customizations
Enabling Languages
Store
Manage Assistant
Plan & Usage
Overview
Usage Plans
Support Plans
Invoices
Authorization
Multilingual Virtual Assistants
Masking PII Details
Variables
IVR Settings
General Settings
Assistant Management
Data Table
Table Views
App Definitions
Sharing Data Tables or Views

HOW TOs
Build a Flight Status Assistant
Design Conversation Skills
Create a Sample Banking Assistant
Create a Transfer Funds Task
Create a Update Balance Task
Create a Knowledge Graph
Set Up a Smart Alert
Design Digital Skills
Configure Digital Forms
Configure Digital Views
Add Data to Data Tables
Update Data in Data Tables
Add Data from Digital Forms
Train the Assistant
Use Traits
Use Patterns for Intents & Entities
Manage Context Switching
Deploy the Assistant
Configure an Agent Transfer
Use Assistant Functions
Use Content Variables
Use Global Variables
Web SDK Tutorial
Widget SDK Tutorial
Analyze the Assistant
Create a Custom Dashboard
Use Custom Meta Tags in Filters

APIs & SDKs
API Reference
API Introduction
API List
API Collection
koreUtil Libraries
SDK Reference
SDK Introduction
SDK Security
SDK Registration
Web Socket Connect and RTM
Using the BotKit SDK
BotKit SDK Tutorial - Blue Prism

ADMINISTRATION
Introduction
Assistant Admin Console
Administration Dashboard
User Management
Add Users
Manage Groups
Manage Roles
Assistant Management
Enrollment
Invite Users
Send Bulk Invites
Import User Data
Synchronize Users from AD
Security & Compliance
Using Single-Sign On
Security Settings
Cloud Connector
Analytics
Billing
  1. Home
  2. Docs
  3. Virtual Assistants
  4. Builder
  5. Alert Task
  6. Alert Task – Message Definition9 min read

Alert Task – Message Definition9 min read

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.

Defining the Message Definition

You can define two kinds of bot responses for a task:

  • The default for all channels: Author 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 Variable Keys derived from the Kore.ai system, custom variables, and the response sample. The message 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 request object data.
  • Channel-specific response: You can also customize a Bot 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.
Message Definition Editor Features

To open the editor for your Action task, go to Bot Response > Message Definition. The Message Definition editor uses three tabs to offer the following features:

  • Standard Text: 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.
  • JavaScript: Add custom code to handle the end-user task response message, declare variables, use variable keys, and interact with third-party applications.
  • Preview: View a sample of the rendered output message, with markup, as the bot users see it.
Adding Variable Keys

Follow these steps to add variable keys:

  1. 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 Variable Keys.
  2. In the Request/Response Keys dialog, expand the type of key node that contains the variable you want to insert.
  3. Select the variable that you want to add, for example, response.data.idand then click Ok,

Bot Response Tab Message Definition Keys

Standard Keys

Standard Keys are the following Kore.ai variable placeholders for reusable data.

  • _labels _: 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 _labels_ 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 _labels_ key as, for example:
    {
        "_labels_": {
            "15379386734832": "roadlabs.com",
            "26377329985341": "Test Project",
            "workspace": "roadlabs.com",
            "project": "Test Project"
        },
        "_fields_": {
            "workspace": "15379386734832",
            "project": "26377329985341"
        }
    }
  • _tenant_ – Returns the tenant for the enterprise when defined. For example, JIRA requires a tenant for URLs, such as koreteam, in https://koreteam.atlassian.net/browse/BBF-3265. You can use the _tenant_ key to build a link in a task response such as:
  • _fields_ – Used to return a task field input provided by the end-user that is not part of a payload response. For example, in a JIRA task, the end-user is prompted to enter a workspace name. You can use the _fields_ key to store the end-user input as:
    _fields_["workspace"]
  • _last_run – 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 _last_run key to filter results displayed before or after the value for_last_run
Session Keys

Session Keys are Kore.ai variable placeholders for user data specific to a single session instance.
Session Keys

  • UserContext.get(“_id”) – The Kore.ai userId.
  • UserContext.get(“emailId”) – The email address associated with the userId.
  • UserContext.get(“lastName”) – The last name of the user.
  • UserContext.get(“firstName”) – The first name of the user.
  • UserContext.get(“profImage”) – The image or avatar filename of the user.
  • UserContext.get(“profColor”) – The account color for the user.
  • UserContext.get(“activationStatus”) – The account status of the user.
  • UserContext.get(“jTitle”) – The title of the user, if defined.
  • UserContext.get(“orgId”) – The organizational ID of the user account, if defined.
  • UserContext.get(“customData”) – A developer defined custom key.
  • UserContext.get(“identities”) – Alternate user IDs, if defined.

Additional session keys may be available depending on how the Bot task is defined and the context of keys available for that task. For more information about session and context keys, see Using Session and Context Variables in Tasks.

Response Keys

Response Keys are parsed directly from your Response Sample text in the API Response tab. Response Keys vary depending on the Response Sample defined.Response Keys
The following list is an example of Response Keys available for an Asana task.

request.data.workspace
request.data.projects
request.data.name
request.data.notes
labels.498346170860
labels.30887755353556
labels["data.workspace"]
labels["data.projects"]
_tenant_
response.data.id
response.data.created_at
response.data.modified_at
response.data.name
response.data.notes
response.data.completed
response.data.assignee_status
response.data.completed_at
response.data.due_on
response.data.due_at
response.data.workspace.id
response.data.workspace.name
response.data.num_hearts
response.data.parent
response.data.followers[0].id
response.data.followers[0].name
response.data.hearted
response.data.assignee
response.data.projects[0].id
response.data.projects[0].name
response.data.memberships[0].project.id
response.data.memberships[0].project.name
response.data.memberships[0].section
Report Keys

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.
Report Keys

  • reportInfo.reportLink – The link defined in the Report Template Definition section for this task.
  • reportInfo.reportTitle – The title defined in the Report Template Definition for this task.
Previewing the Response

On the message editor, click Preview to generate a preview of your response using one of the following options:

  • Test & Preview – Opens the task setup page for your Bot to define the task settings, authenticate, and then shows a preview of your response generated through your third-party web service, for example, Asana.
  • Preview with sample response – Generates the preview using the sample data provided with the key-value pairs defined in the Response Sample section on the API Request tab for the task.

Examples of Custom JavaScript Response

The following examples show response objects using JavaScript to define the Post Title and Post Description sections that display output messages to the end-user when the task response message is sent.
In the following example, the variable labeled desc is only displayed if the value for the caption is defined in the JSON response.

var desc = (caption !== "undefined" ? caption : "")

In the next example, a clickable URL using the task title is displayed in the task response message.

var tasklink = '' + title + '';

In this last example, the link variable depends on the type, either video or photo. Based on the type, the proper link is displayed.

var link = "";
switch (type) {
    case "video":
        var video = (typeof(video_url) != "undefined") ? video_url : permalink_url;
        link = '<video controls><source src ="' + video + '" type="video/mp4"></video>';
        break;
    case "photo":
        link = '<img src="' + image_permalink + '"></img>';
        break;
}

You can create custom JavaScript to handle task-specific requirements on the JavaScript tab based on the payload response for the task.

Channel-Specific Bot Response

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 Default for all Channels is sent to all channels. However, you can define a specific response for one or more of the 20+ supported channels to display to the end-user in that channel instead of the default response.

  1. To define the response message for a specific channel, click + Add Channel to display the Choose a Channel drop-down list.
  2. Select a channel, for example, Kore.ai, and then configure the response for that channel on the JavaScript tab.


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.

Note: Use the following keys to return default values for:
response.message – Returns the default message as a string.
response.message.choices – Returns the options choice or confirmation message types as an array.

  • Slack Channel Override Example
    var message = {};
    var attachments = [];
    var attachment = {
        'text': "Exception occurred during API execution",
        'color': '#FFCC00',
        'attachment_type': 'default'
    };
    attachments.push(attachment);
    message.attachments = attachments;
    print(JSON.stringify(message));
  • FaceBook Channel Override Example
    var message = {
        text: response.message
    };
    var buttons = [];
    for (var i = 0; i < response.choices.length; i++) {
        var choiceItem = response.choices[i];
        if (choiceItem.length > 20) {
            choiceItem = choiceItem.substring(
                0, 18) + '..';
        }
        var element = {
            content_type: 'text',
            title: choiceItem,
            payload: choiceItem
        };
        buttons.push(element);
    }
    message.quick_replies = buttons;
    print(JSON.stringify(message));
  • Email Channel Override Example
    var message = {};
    var text = response.message + ' <br> ';
    for (var i = 0; i < response.choices.length; i++) {
        text = text.concat(
            '<u> + response.choices[i] + ' <
            /u> <br>');
        }
        message.text = text;
        print(JSON.stringify(message));
  • SMS Channel Override Example
    var message = {};
        var indexArray = ['a', 'b', 'c',
            'd', 'e',
            'f', 'g', 'h', 'i', 'j',
            'k', 'l', 'm', 'n', 'o',
            'p', 'q', 'r', 's', 't',
            'u', 'v', 'w', 'x', 'y',
            'z'
        ];
        var text = response.message + '\\n';
        for (var i = 0; i < response.choices
            .length; i++) {
            text = text.concat(indexArray[i] +
                ') ' + response.choices[
                    i] + '\\n');
        }
        message.text = text;
        print(JSON.stringify(message));
Menu