1. Home
  2. Kore.ai Conversational Platform
  3. Bot Builder Tool
  4. Develop
  5. Simple Tasks
  6. Alert Tasks
  7. Alert Task: Configuring API Request (WebHook)

Alert Task: Configuring API Request (WebHook)

After you define the General tab settings and authentication for an alert task, you are ready to start configuring the API request chain that asks for data from your Bot website or web application.

This topic describes how to define the API Request for a task with the Connection Type specified as Webhook.

Configuring API Request (WebHook)

For a task with the Connection Type specified as Webhook, you will need to define:

  • Content Type – They type of data exchanged between Kore.ai and your web application. For more information, see Defining the Content Type.
  • Response Sample – Define key-value pairs that you expect to receive in the Alert task payload. The keys that you provide are available as drop-down choices for handling the data to display to the end-user. For more information, see Adding Response Sample Data.
  • Alert Tasks Path – Optionally define a specific path for data from the API. For more information, see Defining the Alerts Task Path.

The following illustration is an example of the API Request tab on the Edit Alert – < Task Name > page for an alert task with the Connection Type set to Webhook on the General tab.

Defining the Content Type

The Content Type describes the type of data exchanged between Kore.ai and your Bot website or application, and the key-value pairs expected in the task payload response. To define the Content Type for the API Request, expand the Content Type tab and select one of these options:

  • JSON – JavaScript Object Notation is an open standard format using human-readable text to transmit data objects as attribute-value pairs. You can use JSON to transmit data between the Kore.ai servers and your Bot web application.
  • RSS – Rich Site Summary, or Really Simple Syndication, is family of standardized formats used to publish frequently updated information such as blog entries, news headlines, audio, and video.
  • XML – Extensible Markup Language is a markup language that defines a set of rules for encoding documents in a format which is both human-readable and machine-readable. Oftentimes, web services use XML schemas to process the XML data.
  • URL Encoded JSON – URLs using JSON encoding for reserved characters.
  • CSV – Comma-separated value lists.
  • Text – Text-based key-value pairs.
  • Twitter Encoded JSON – URLs for Twitter using JSON encoding for reserved characters.
  • Multipart/Form-data – 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.
  • Multipart/Related – Used when the same information is presented in different body parts in different forms. The body parts are ordered by increasing complexity.
  • Oracle ADF – For Oracle Application Development Framework.

Adding Response Sample Data

In the Response Sample section, you can enter or paste examples of the key-value pairs that you expect to receive in the task payload. When you define the response sample, the keys specified in the Response Sample section are available as drop-down choices for handling the output data.

Adding the Sample Response

  1. On the API Request tab, Expand the Sample Response section.
  2. Enter your Response Sample that contains the key-value pairs from your JSON response payload. Do one of the following:
    • To format the view of the response as a JSON structure with indentation as shown in the following illustration, click the Formatted  icon.
    • To format the view of the response in serialized compact form as shown in the following illustration, click the Unformatted  icon.

Defining the Alert Tasks Path

The last section, Alert Tasks Path, is an optional field that you can specify if the Response Sample section contains a hierarchical tree structure of data and you only want a specific hierarchical level submitted for the task request object.

To define the Alert Tasks Path for an alert task using a webhook, on the API Request tab, click the Expand  icon in the Alert Tasks Path section as shown in the following illustration.

Alert Task API Request Tab - Alerts Task Path

For example, in the following Response Sample, you may only want to expose the user data in the alert task response by defining user in the Alert Tasks Path field.

   {  
   "user":{  
      "timeZone":"Asia/Kolkata",
      "active":"true",
      "displayName":"John Doe",
      "avatarUrls":{  
         "32x32":"https://koreteam.atlassian.net/secure/useravatar?size=medium&ownerId=john.doe&avatarId=11801",
         "16x16":"https://koreteam.atlassian.net/secure/useravatar?size=xsmall&ownerId=john.doe&avatarId=11801",
         "24x24":"https://koreteam.atlassian.net/secure/useravatar?size=small&ownerId=john.doe&avatarId=11801",
         "48x48":"https://koreteam.atlassian.net/secure/useravatar?ownerId=john.doe&avatarId=11801"
      },
      "emailAddress":"john.doe@kore.com",
      "key":"john.doe",
      "name":"john.doe",
      "self":"https://koreteam.atlassian.net/rest/api/2/user?username=john.doe"
   },
   "webhookEvent":"jira:issue_updated",
   "timestamp":"1438431826045",
   "user_key":"john.doe",
   "user_id":"john.doe"
}

After you enter the Alert Tasks Path field, click Save.

Next Steps

With the API Request defined for the webhook alert task, you are ready to define the message displayed to the end-user on the Bot Response tab. For more information, see Defining the Bot Response for an Alert Task.

Was this article helpful to you? Yes No 2