{"id":27048,"date":"2021-03-17T06:08:39","date_gmt":"2021-03-17T06:08:39","guid":{"rendered":"https:\/\/developer.kore.ai\/v9-0\/?p=27048"},"modified":"2021-03-17T06:08:39","modified_gmt":"2021-03-17T06:08:39","slug":"alert-task-webhook-api-request","status":"publish","type":"post","link":"https:\/\/developer.kore.ai\/v9-0\/docs\/bots\/bot-builder-tool\/alert\/alert-task-webhook-api-request\/","title":{"rendered":"Alert Task \u2013 WebHook API Request"},"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>We have seen how an Alert task can be set up in Kore.ai virtual assistant platform\u00a0<a href=\"\/v9-0\/v9-0\/docs\/bots\/bot-builder-tool\/alert\/notification-tasks\/\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>. In this section, we will see how to configure an API Request for a WebHook service.<\/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<p>For a task with the <strong>Connection Type<\/strong>\u00a0specified as <strong>Webhook<\/strong>, you will need to define:<\/p>\n<ul>\n<li><strong>Content Type<\/strong> &#8211; The type of data exchanged between Kore.ai and your web application.<br \/>\n<strong>Defining the Content Type<\/strong><br \/>\nThe\u00a0<strong>Content Type<\/strong>\u00a0describes the type of data exchanged between Kore.ai and your Bot website or application, and the key-value pairs expected in the task\u00a0payload response. To define the Content Type for the API Request, expand the <strong>Content Type<\/strong> tab and select one of these options:<br \/>\n<a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/21\/Content-Type-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-14202\" src=\"\/wp-content\/uploads\/sites\/21\/Content-Type-2.png\" alt=\"\" width=\"1079\" height=\"441\" \/><\/a><\/p>\n<ul>\n<li><strong>JSON<\/strong> &#8211;\u00a0JavaScript Object Notation is an open standard format using\u00a0human-readable text to transmit data objects as\u00a0attribute-value pairs. You can use JSON\u00a0to transmit data between the Kore.ai servers and your Bot\u00a0web application.<\/li>\n<li><strong>RSS<\/strong> &#8211; Rich Site Summary, or Really Simple Syndication, is a family of standardized formats used to publish frequently updated information such as blog entries, news headlines, audio, and video.<\/li>\n<li><strong>XML<\/strong> &#8211; Extensible Markup Language is a markup language that defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. Oftentimes, web services use XML schemas to process the XML data.<\/li>\n<li><strong>URL Encoded JSON<\/strong> &#8211; URLs using JSON encoding for reserved characters.<\/li>\n<li><strong>CSV<\/strong> &#8211; Comma-separated value lists.<\/li>\n<li><strong>Text<\/strong> &#8211; Text-based key-value pairs.<\/li>\n<li><strong>Twitter Encoded JSON<\/strong> &#8211; URLs for Twitter using JSON encoding for reserved characters.<\/li>\n<li><strong>Multipart\/Form-data<\/strong> &#8211; 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<b>.<\/b><\/li>\n<li><strong>Multipart\/Related<\/strong> &#8211; Used when the same information is presented in different body parts in different forms. The body parts are ordered by increasing complexity.<\/li>\n<li><strong>Oracle ADF<\/strong> &#8211; For Oracle Application Development Framework.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Response Sample<\/strong> &#8211;\u00a0Define key-value pairs that you expect to receive in the <span style=\"background-color: #f6d5d9;\">Alert\u00a0<\/span>task payload. The keys that you provide\u00a0are available as drop-down choices for handling the\u00a0data to display to the end-user.<br \/>\n<strong>Adding Response Sample Data<\/strong><br \/>\nIn the <strong>Response Sample<\/strong>\u00a0section, you can enter or paste examples of the key-value pairs that you expect to receive in the task payload.\u00a0When you define the response sample, the keys specified\u00a0in the\u00a0<strong>Response Sample<\/strong>\u00a0section are available as drop-down choices for handling the\u00a0output data.<\/p>\n<h4>Add a Sample Response<\/h4>\n<ol>\n<li>On the <strong>API Request<\/strong> tab, expand the <strong>Sample Response<\/strong> section.<\/li>\n<li>Enter your Response Sample that contains the key-value pairs from your JSON response payload. Do one of the following:\n<ul>\n<li>To format the view of the response as a JSON structure with indentation as shown in the following\u00a0illustration, click the <strong>Formatted<\/strong> <img loading=\"lazy\" decoding=\"async\" class=\"icon alignnone wp-image-9801 size-full\" src=\"\/wp-content\/uploads\/sites\/21\/DIYFormattedIcon.png\" width=\"26\" height=\"26\" \/>\u00a0icon.<a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/21\/Sample-response-indent.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-14126\" src=\"\/wp-content\/uploads\/sites\/21\/Sample-response-indent.png\" alt=\"\" width=\"1051\" height=\"389\" \/><\/a><\/li>\n<li>To format the view of the response in serialized compact form as shown in the following illustration, click the <strong>Unformatted <img loading=\"lazy\" decoding=\"async\" class=\"icon alignnone wp-image-9802 size-full\" src=\"\/wp-content\/uploads\/sites\/21\/DIYUnFormattedIcon.png\" width=\"26\" height=\"26\" \/><\/strong>\u00a0icon.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<\/li>\n<li><strong>Alert Tasks Path<\/strong>\u00a0&#8211; Optionally define a specific path for\u00a0data from the API.<br \/>\n<strong>Defining the Alert Tasks Path<\/strong><br \/>\nThe last section, <strong>Alert\u00a0Tasks Path<\/strong>, is an optional field that you can specify if the <strong>Response Sample<\/strong>\u00a0section contains a hierarchical tree structure of data and you only want a specific hierarchical level submitted for the task request object.<br \/>\nTo define the <strong>Alert\u00a0Tasks Path<\/strong>\u00a0for an alert task using a webhook, on the <strong>API Request<\/strong> tab, click the <strong>Expand<\/strong>\u00a0<img loading=\"lazy\" decoding=\"async\" class=\"icon alignnone wp-image-8284 size-full\" src=\"\/wp-content\/uploads\/sites\/21\/Expand-Icon.png\" width=\"20\" height=\"24\" \/> icon in the <strong>Alert\u00a0Tasks Path<\/strong>\u00a0section as shown in the following\u00a0illustration.<br \/>\n<a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/21\/DIYAlertTaskAPIRequestTabAlertsTaskPath.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9901\" src=\"\/wp-content\/uploads\/sites\/21\/DIYAlertTaskAPIRequestTabAlertsTaskPath.png\" alt=\"Alert Task API Request Tab - Alerts Task Path\" width=\"884\" height=\"253\" \/><\/a><br \/>\nFor example, in the following <strong>Response Sample<\/strong>, you may only want to expose the <span style=\"color: #0000ff;\">user<\/span> data in the alert\u00a0task response by defining the\u00a0<span style=\"color: #0000ff;\">user<\/span>\u00a0in the\u00a0<strong>Alert\u00a0Tasks Path<\/strong>\u00a0field.<\/p>\n<pre>   {\r\n   \"user\":{\r\n      \"timeZone\":\"Asia\/Kolkata\",\r\n      \"active\":\"true\",\r\n      \"displayName\":\"John Doe\",\r\n      \"avatarUrls\":{\r\n         \"32x32\":\"https:\/\/koreteam.atlassian.net\/secure\/useravatar?size=medium&amp;ownerId=john.doe&amp;avatarId=11801\",\r\n         \"16x16\":\"https:\/\/koreteam.atlassian.net\/secure\/useravatar?size=xsmall&amp;ownerId=john.doe&amp;avatarId=11801\",\r\n         \"24x24\":\"https:\/\/koreteam.atlassian.net\/secure\/useravatar?size=small&amp;ownerId=john.doe&amp;avatarId=11801\",\r\n         \"48x48\":\"https:\/\/koreteam.atlassian.net\/secure\/useravatar?ownerId=john.doe&amp;avatarId=11801\"\r\n      },\r\n      \"emailAddress\":\"john.doe@kore.com\",\r\n      \"key\":\"john.doe\",\r\n      \"name\":\"john.doe\",\r\n      \"self\":\"https:\/\/koreteam.atlassian.net\/rest\/api\/2\/user?username=john.doe\"\r\n   },\r\n   \"webhookEvent\":\"jira:issue_updated\",\r\n   \"timestamp\":\"1438431826045\",\r\n   \"user_key\":\"john.doe\",\r\n   \"user_id\":\"john.doe\"\r\n}<\/pre>\n<p>After you enter the <strong>Alert\u00a0Tasks Path<\/strong>\u00a0field, click <strong>Save<\/strong>.<\/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":"We have seen how an Alert task can be set up in Kore.ai virtual assistant platform\u00a0here. In this section, we will see how to configure an API Request for a WebHook service. For a task with the Connection Type\u00a0specified as Webhook, you will need to define: Content Type - The type of data exchanged between...","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-27048","post","type-post","status-publish","format-standard","hentry","category-alert"],"_links":{"self":[{"href":"https:\/\/developer.kore.ai\/v9-0\/wp-json\/wp\/v2\/posts\/27048","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developer.kore.ai\/v9-0\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/developer.kore.ai\/v9-0\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v9-0\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v9-0\/wp-json\/wp\/v2\/comments?post=27048"}],"version-history":[{"count":2,"href":"https:\/\/developer.kore.ai\/v9-0\/wp-json\/wp\/v2\/posts\/27048\/revisions"}],"predecessor-version":[{"id":27413,"href":"https:\/\/developer.kore.ai\/v9-0\/wp-json\/wp\/v2\/posts\/27048\/revisions\/27413"}],"wp:attachment":[{"href":"https:\/\/developer.kore.ai\/v9-0\/wp-json\/wp\/v2\/media?parent=27048"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.kore.ai\/v9-0\/wp-json\/wp\/v2\/categories?post=27048"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.kore.ai\/v9-0\/wp-json\/wp\/v2\/tags?post=27048"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}