{"id":24916,"date":"2020-10-31T08:40:26","date_gmt":"2020-10-31T08:40:26","guid":{"rendered":"https:\/\/developer.kore.ai\/v8-0\/?p=24916"},"modified":"2021-03-25T16:20:25","modified_gmt":"2021-03-25T16:20:25","slug":"get-analytics-api","status":"publish","type":"post","link":"https:\/\/developer.kore.ai\/v8-0\/docs\/bots\/api-guide\/get-analytics-api\/","title":{"rendered":"Get Analytics API"},"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>To extract the metrics data related to the intent detection and task performance using API. It can be used to retrieve metrics information related to Intents Found, Intents not Found, Failed Tasks, Successful Tasks, and Performance Logs<\/p>\n<p class=\"note\">To use this API, the app needs the Bot Scope of <em>Metrics<\/em>.<\/p>\n<p><b>POST <\/b><code>https:\/\/{{host}}\/api\/public\/bot\/{{BotID}}\/getAnalytics<\/code><\/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><span class=\"ez-toc-section\" id=\"Path_Parameters\">Path Parameters<\/span><\/h3>\n<table>\n<tbody>\n<tr>\n<th><b>Parameter<\/b><\/th>\n<th><b>Required\/Optional<\/b><\/th>\n<th><b>Description<\/b><\/th>\n<\/tr>\n<tr>\n<td>host<\/td>\n<td>Required<\/td>\n<td>Environment URL, for example, https:\/\/bots.kore.ai<\/td>\n<\/tr>\n<tr>\n<td>BotID<\/td>\n<td>Required<\/td>\n<td>Bot ID or Stream ID. You can access it from the General Settings page of the bot.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3><span class=\"ez-toc-section\" id=\"Body_Parameters\">Body Parameters<\/span><\/h3>\n<table>\n<tbody>\n<tr>\n<th><b>Parameter<\/b><\/th>\n<th><b>Required\/Optional<\/b><\/th>\n<th><b>Description<\/b><\/th>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">type<\/span><\/td>\n<td>Required<\/td>\n<td>\n<p>The type of metrics requested can be:<\/p>\n<ul>\n<li>successintent<\/li>\n<li>failintent<\/li>\n<li>successtask<\/li>\n<li>failtask<\/li>\n<li>performance<\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">filters<\/span><\/td>\n<td>Required<\/td>\n<td>Object with the following details to filter the result set<\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">from<\/span><\/td>\n<td>Required<\/td>\n<td>The start timestamp from which the records need to be considered.<\/td>\n<\/tr>\n<tr>\n<td>to<\/td>\n<td>Required<\/td>\n<td>The end timestamp from which the records need to be considered.<\/td>\n<\/tr>\n<tr>\n<td>limit<\/td>\n<td>Required<\/td>\n<td>Number of records to be fetched.<\/td>\n<\/tr>\n<tr>\n<td>channel<\/td>\n<td>Optional<\/td>\n<td>The channels to be considered for the metrics.<\/td>\n<\/tr>\n<tr>\n<td>channelUIds<\/td>\n<td>Optional<\/td>\n<td>The user ids (channel specified) to be included in the metrics.<\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">isAmbiguous<\/span><\/td>\n<td>Optional<\/td>\n<td>whether to include ambiguous intents or not &#8211; set to true or false<\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">isDeveloper<\/span><\/td>\n<td>Optional<\/td>\n<td>whether to include developer metrics &#8211; set to true or false.<\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">trained<\/span><\/td>\n<td>Optional<\/td>\n<td>whether to include trained intents or not &#8211; set to true or false.<\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">taskId<\/span><\/td>\n<td>Optional<\/td>\n<td>To filter based on the task ids.<\/td>\n<\/tr>\n<tr>\n<td>userId<\/td>\n<td>Optional<\/td>\n<td>To filter based on user id.<\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">tags<\/span><\/td>\n<td>Optional<\/td>\n<td>To filter based on custom tags.<br \/>\nUsage:<\/p>\n<pre>\"tags\": {\r\n         \"and\": [\r\n                 {\r\n                  \"name\": \"user\",\r\n                  \"values\": [\"uservalue\"],\r\n                  \"type\": \"user\"\r\n                  },\r\n                  {\r\n                   \"name\": \"message\",\r\n                   \"values\": [\"mvalue\"],\r\n                   \"type\": \"message\"\r\n                   }\r\n                ]\r\n           }<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td>sort<\/td>\n<td>Optional<\/td>\n<td>To sort the results.<br \/>\nUsage:<\/p>\n<pre>\"sort\": \r\n       { \"order\": \"&lt;desc\/asc&gt;\", \r\n          \"by\": \"&lt;column name&gt;\" }<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td>skip<\/td>\n<td>Optional<\/td>\n<td>Number of records to be skipped from the result set.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\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><span class=\"ez-toc-section\" id=\"Authorization\">Authorization<\/span><\/h3>\n<p>Invoke the API with JWT in the header with the following syntax:<\/p>\n<p><code>auth: {{JWT}}<\/code><\/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><span class=\"ez-toc-section\" id=\"Response_Content_Type\">Response Content Type<\/span><\/h3>\n<p><code>application\/json<\/code><\/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><span class=\"ez-toc-section\" id=\"Sample_Request\">Sample Request<\/span><\/h3>\n<pre>curl -X POST \\\r\n  https:\/\/{{host}}\/api\/public\/bot\/{{bot_id}}\/getAnalytics \\\r\n  -H 'auth: {{YOUR_JWT_ACCESS_TOKEN}}' \\\r\n  -H 'content-type: application\/json' \\\r\n  -d '{\r\n       \"type\": \"successintent\",\r\n       \"filters\": {\r\n           \"from\": \"2020-08-11T17:25:09.698Z\",\r\n           \"to\": \"2020-08-21T17:25:09.698Z\",\r\n           \"tags\": {\r\n                    \"and\": [\r\n                     {\r\n                      \"name\": \"us2\",\r\n                      \"values\": [\r\n                             \"ss\"\r\n                             ],\r\n                       \"type\": \"user\"\r\n                       }\r\n                      ]\r\n                 },\r\n        \"channel\": [\r\n            \"rtm\"\r\n        ],\r\n        \"channelUIds\": [\r\n            \"test@kore.xyz\"\r\n        ],\r\n        \"isAmbiguous\": false,\r\n        \"isDeveloper\": true,\r\n        \"trained\": false,\r\n        \"taskId\": [\r\n            \"dg-xxxx\"\r\n        ],\r\n        \"userId\": [\r\n            \"u-5e4xxx85-f12e-53e2-929e-01xx7156xxx8\"\r\n        ]\r\n    },\r\n    \"limit\": 50\r\n}'<\/pre>\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><span class=\"ez-toc-section\" id=\"Sample_Response\">Sample Response<\/span><\/h3>\n<pre>{\r\n    \"moreAvailable\": true,\r\n    \"totalCount\": 49,\r\n    \"result\": [\r\n        {\r\n            \"messageId\": \"ms-439aa365-5240-52bf-ad10-bb0ef7b0d3c2\",\r\n            \"utterance\": \"newTask\",\r\n            \"intent\": \"newTask\",\r\n            \"userId\": \"u-5e4xxx85-f12e-53e2-929e-01xx7156xxx8\",\r\n            \"channelUId\": \"test@kore.xyz\",\r\n            \"language\": \"en\",\r\n            \"timestamp\": \"2020-08-20T18:49:19.877Z\",\r\n            \"pinned\": false,\r\n            \"channel\": \"rtm\",\r\n            \"taskName\": \"newTask\",\r\n            \"customTags\": {\r\n                \"userTags\": {\r\n                    \"name\": \"us2\",\r\n                    \"value\": \"ss\"\r\n                },\r\n                \"sessionTags\": [],\r\n                \"messageTags\": []\r\n            },\r\n            \"NLAnalysis\": {}\r\n        },\r\n        {\r\n            \"messageId\": \"ms-2cc0b4aa-2f95-5524-8b7b-2442929b3cf5\",\r\n            \"utterance\": \"newTask\",\r\n            \"intent\": \"newTask\",\r\n            \"userId\": \"u-5e4xxx85-f12e-53e2-929e-01xx7156xxx8\",\r\n            \"channelUId\": \"test@kore.xyz\",\r\n            \"language\": \"en\",\r\n            \"timestamp\": \"2020-08-20T18:49:14.237Z\",\r\n            \"pinned\": false,\r\n            \"channel\": \"rtm\",\r\n            \"taskName\": \"newTask\",\r\n            \"customTags\": {\r\n                \"userTags\": {\r\n                    \"name\": \"us2\",\r\n                    \"value\": \"ss\"\r\n                },\r\n                \"sessionTags\": [],\r\n                \"messageTags\": []\r\n            },\r\n            \"NLAnalysis\": {}\r\n        }\r\n    ]\r\n}\r\n<\/pre>\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":"To extract the metrics data related to the intent detection and task performance using API. It can be used to retrieve metrics information related to Intents Found, Intents not Found, Failed Tasks, Successful Tasks, and Performance Logs To use this API, the app needs the Bot Scope of Metrics. POST https:\/\/{{host}}\/api\/public\/bot\/{{BotID}}\/getAnalytics Path Parameters Parameter Required\/Optional...","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"class_list":["post-24916","post","type-post","status-publish","format-standard","hentry","category-api-guide"],"_links":{"self":[{"href":"https:\/\/developer.kore.ai\/v8-0\/wp-json\/wp\/v2\/posts\/24916","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developer.kore.ai\/v8-0\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/developer.kore.ai\/v8-0\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v8-0\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v8-0\/wp-json\/wp\/v2\/comments?post=24916"}],"version-history":[{"count":1,"href":"https:\/\/developer.kore.ai\/v8-0\/wp-json\/wp\/v2\/posts\/24916\/revisions"}],"predecessor-version":[{"id":24917,"href":"https:\/\/developer.kore.ai\/v8-0\/wp-json\/wp\/v2\/posts\/24916\/revisions\/24917"}],"wp:attachment":[{"href":"https:\/\/developer.kore.ai\/v8-0\/wp-json\/wp\/v2\/media?parent=24916"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.kore.ai\/v8-0\/wp-json\/wp\/v2\/categories?post=24916"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.kore.ai\/v8-0\/wp-json\/wp\/v2\/tags?post=24916"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}