{"id":29433,"date":"2021-08-25T10:13:29","date_gmt":"2021-08-25T09:13:29","guid":{"rendered":"https:\/\/developer.kore.ai\/v8-1\/?p=29433"},"modified":"2021-08-25T10:13:51","modified_gmt":"2021-08-25T09:13:51","slug":"sessions-api","status":"publish","type":"post","link":"https:\/\/developer.kore.ai\/v8-1\/docs\/bots\/api-guide\/sessions-api\/?lang=ja","title":{"rendered":"\u30bb\u30c3\u30b7\u30e7\u30f3\u5c65\u6b74API"},"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>This API retrieves the conversation sessions created. This API is available in BT and BAC app scopes.<\/p>\n<p class=\"note\">To use this API, app needs the Bot Builder API scope of <em>Bot sessions<\/em>.<br \/>\nOR the Admin API Scope of <em>Bot sessions<\/em> under <em>Bot Analytics<\/em>.<\/p>\n<p><strong>POST<\/strong>\u00a0<code>https:\/\/{{host}}\/api\/public\/bot\/{{BotID}}\/getSessions?containmentType={{containmentType}}<\/code><br \/>\nand <code>https:\/\/{{host}}\/api\/public\/getSessions?containmentType={{containmentType}}<\/code> for Bot Admin Console<\/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=\"Query_Parameters\">Query Parameters<\/span><\/h3>\n<table>\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th>Description<\/th>\n<\/tr>\n<tr>\n<td>containmentType<\/td>\n<td>Use to filter the results based on the type of the session i.e Self-service vs. Drop-off vs. Agent Transfer<br \/>\nValid values:<\/p>\n<ul>\n<li>dropOff,<\/li>\n<li>Selfservice,<\/li>\n<li>agent.<\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<\/thead>\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<thead>\n<tr>\n<th>Parameter<\/th>\n<th>Description<\/th>\n<\/tr>\n<tr>\n<td>userId (optional)<\/td>\n<td>The ID of the user whose conversation history to access. Can be a user email id or enterprise assigned unique id.<\/td>\n<\/tr>\n<tr>\n<td>skip\/offset (optional)<\/td>\n<td>The number of messages to be skipped.<\/td>\n<\/tr>\n<tr>\n<td>limit (optional)<\/td>\n<td>The number of messages to be shown on each page.<\/td>\n<\/tr>\n<tr>\n<td>dateFrom (optional)<\/td>\n<td>Takes the date format yyyy-mm-dd<br \/>\n(or) yyyy-mm-ddThh:mm:ss.msZ<br \/>\neg:2019-04-01 (or) 2019-04-01T13:25:58.515ZIf not provided, calculated as 7 days behind <em>dataTo<\/em>.<\/td>\n<\/tr>\n<tr>\n<td>dateTo (optional)<\/td>\n<td>Takes the date format yyyy-mm-dd<br \/>\n(or) yyyy-mm-ddThh:mm:ss.msZ<br \/>\neg:2019-04-01 (or) 2019-04-01 T13:26:05.598ZIf not provided, calculated as 7 days from <em>dateFrom<\/em>. If <em>dateFrom<\/em> is also not provided then set to <strong>Today<\/strong>.<\/td>\n<\/tr>\n<tr>\n<td>tags (optional)<\/td>\n<td>Meta tags to filter the conversations.<\/td>\n<\/tr>\n<tr>\n<td>sessionType (optional)<br \/>\n(introduced in ver8.0)<\/td>\n<td>Type to filter the conversations &#8211; can be:<\/p>\n<ul>\n<li>non-interactive &#8211; sessions that have bot messages presented without any message from the user<\/li>\n<li>interactive &#8211; sessions that include one or more messages from the user<\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<\/thead>\n<\/table>\n<p><strong>Note<\/strong>: The duration between <em>dateTo<\/em> and <em>dateFrom<\/em> should be less than 7 days, else an error will be thrown.<\/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=\"i\">\u8a8d\u8a3c<\/span><\/h3>\n<p>\u4ee5\u4e0b\u306e\u69cb\u6587\u3092\u4f7f\u7528\u3057\u3066\u3001JWT\u3092\u30d8\u30c3\u30c0\u30fc\u306b\u542b\u3080API\u3092\u547c\u3073\u51fa\u3057\u307e\u3059\u3002 <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=\"i-2\">\u5fdc\u7b54\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u30bf\u30a4\u30d7<\/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<ul>\n<li>Without a body\n<pre class=\"\">curl --location --request POST '{{host}}\/api\/public\/getSessions?containmentType={{containmentType}}' \\\r\n     --header 'auth: {{YOUR_JWT_ACCESS_TOKEN}}' \\\r\n     --header 'Content-Type: application\/json' \\\r\n     --data-raw ''<\/pre>\n<\/li>\n<li>With a body\n<pre class=\"\">curl --location --request POST '{{host}}\/api\/public\/getSessions?containmentType={{containmentType}}' \\\r\n     --header 'auth: {{YOUR_JWT_ACCESS_TOKEN}}' \\\r\n     --header 'Content-Type: application\/json' \\\r\n     --data-raw '{\r\n        \"skip\" : 0,                          \r\n        \"limit\" : 100,                      \r\n        \"dateFrom\" : \"2020-02-11\",\r\n        \"dateTo\" : \"2020-02-12\"\r\n }'<\/pre>\n<\/li>\n<li>For Specific Bot\n<pre class=\"\">curl --location --request POST '{{host}}\/api\/public\/bot\/{{BotId}}\/getSessions?containmentType={{containmentType}}' \\\r\n     --header 'auth: {{YOUR_JWT_ACCESS_TOKEN}}' \\\r\n     --header 'Content-Type: application\/json' \\\r\n     --data-raw '{\r\n        \"skip\" : 0,                          \r\n        \"limit\" : 100,                      \r\n        \"dateFrom\" : \"2020-02-11\",\r\n        \"dateTo\" : \"2020-02-12\"\r\n }'<\/pre>\n<\/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>\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<ul>\n<li><strong>for <em>dropOff<\/em> sessions<\/strong>\n<pre>{\r\n  \"total\": 1,\r\n  \"moreAvailable\": false,\r\n  \"sessions\": [\r\n   {\r\n     \"sessionId\": \"xxxxaxxexxxaxexdxxxdxxxe\",\r\n     \"botId\": \"st-ffeffxxx-xxxc-xexa-axxx-cxxabxxxxcxx\",\r\n     \"channel\": \"rtm\",\r\n     \"userId\": \"u-xxfexxxd-xxex-xdxe-xaec-xeaxbxxxxfxx\",\r\n     \"start_time\": \"2021-04-26T11:27:25.977Z\",\r\n     \"end_time\": \"2021-04-26T11:27:26.145Z\",\r\n     \"session_lang\": [\r\n       \"en\"\r\n      ],\r\n     \"sessionType\": \"dropOff\",\r\n     \"isDeveloper\": false,\r\n     \"tags\": {\r\n       \"userTags\": [\r\n        {\r\n         \"value\": \"newuser\",\r\n         \"name\": \"regular\"\r\n        }\r\n      ],\r\n      \"sessionTags\": []\r\n     },\r\n     \"noOfMessagesExchanged\": 1,\r\n     \"noOfTasksExecuted\": 0\r\n   }\r\n  ]\r\n}<\/pre>\n<\/li>\n<li><strong>for <em>Selfservice<\/em> sessions<\/strong>\n<pre>{\r\n  \"total\": 2,\r\n  \"moreAvailable\": false,\r\n  \"sessions\": [\r\n   {\r\n     \"sessionId\": \"xxxxaxxexxxaxexdxxxdxxxe\",\r\n     \"botId\": \"st-ffeffxxx-xxxc-xexa-axxx-cxxabxxxxcxx\",\r\n     \"channel\": \"rtm\",\r\n     \"userId\": \"u-xxfexxxd-xxex-xdxe-xaec-xeaxbxxxxfxx\",\r\n     \"start_time\": \"2021-04-26T11:27:25.977Z\",\r\n     \"end_time\": \"2021-04-26T11:27:26.145Z\",\r\n     \"session_lang\": [\r\n       \"en\"\r\n      ],\r\n     \"sessionType\": \"selfService\",\r\n     \"isDeveloper\": false,\r\n     \"tags\": {\r\n       \"userTags\": [\r\n        {\r\n         \"value\": \"newuser\",\r\n         \"name\": \"regular\"\r\n        }\r\n       ],\r\n       \"sessionTags\": []\r\n     },\r\n     \"noOfMessagesExchanged\": 6,\r\n     \"noOfTasksExecuted\": 0\r\n    },\r\n   {\r\n     \"sessionId\": \"xxxxaxxexxxaxexdxxxdxxxe\",\r\n     \"botId\": \"st-ffeffxxx-xxxc-xexa-axxx-cxxabxxxxcxx\",\r\n     \"channel\": \"rtm\",\r\n     \"userId\": \"u-xxfexxxd-xxex-xdxe-xaec-xeaxbxxxxfxx\",\r\n     \"start_time\": \"2021-04-26T11:27:25.977Z\",\r\n     \"end_time\": \"2021-04-26T11:27:26.145Z\",\r\n     \"session_lang\": [\r\n       \"en\"\r\n      ],\r\n     \"sessionType\": \"selfService\",\r\n     \"isDeveloper\": false,\r\n     \"tags\": {\r\n       \"userTags\": [\r\n         {\r\n          \"value\": \"newuser\",\r\n          \"name\": \"regular\"\r\n        }\r\n      ],\r\n     \"sessionTags\": []\r\n     },\r\n     \"noOfMessagesExchanged\": 8,\r\n     \"noOfTasksExecuted\": 0\r\n    }\r\n  ]\r\n}<\/pre>\n<\/li>\n<li><strong>for <em>agent<\/em> sessions<\/strong>\n<pre>{\r\n  \"total\": 1,\r\n  \"moreAvailable\": false,\r\n  \"sessions\": [\r\n   {\r\n     \"sessionId\": \"xxxxaxxexxxaxexdxxxdxxxe\",\r\n     \"botId\": \"st-ffeffxxx-xxxc-xexa-axxx-cxxabxxxxcxx\",\r\n     \"channel\": \"rtm\",\r\n     \"userId\": \"u-xxfexxxd-xxex-xdxe-xaec-xeaxbxxxxfxx\",\r\n     \"start_time\": \"2021-04-26T11:27:25.977Z\",\r\n     \"end_time\": \"2021-04-26T11:27:26.145Z\",\r\n     \"session_lang\": [\r\n       \"en\"\r\n      ],\r\n\t \"sessionType\": \"agent\",\r\n\t \"isDeveloper\": false,\r\n\t \"tags\": {\r\n\t\t\"userTags\": [],\r\n\t\t\"sessionTags\": []\r\n\t },\r\n\t \"noOfMessagesExchanged\": 7,\r\n\t \"noOfTasksExecuted\": 2\r\n\t}\r\n  ]\r\n}<\/pre>\n<\/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":"This API retrieves the conversation sessions created. This API is available in BT and BAC app scopes. To use this API, app needs the Bot Builder API scope of Bot sessions. OR the Admin API Scope of Bot sessions under Bot Analytics. POST\u00a0https:\/\/{{host}}\/api\/public\/bot\/{{BotID}}\/getSessions?containmentType={{containmentType}} and https:\/\/{{host}}\/api\/public\/getSessions?containmentType={{containmentType}} for Bot Admin Console Query Parameters Parameter Description containmentType Use...","protected":false},"author":14,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"class_list":["post-29433","post","type-post","status-publish","format-standard","hentry","category-api-guide"],"_links":{"self":[{"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/posts\/29433","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/users\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/comments?post=29433"}],"version-history":[{"count":1,"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/posts\/29433\/revisions"}],"predecessor-version":[{"id":29434,"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/posts\/29433\/revisions\/29434"}],"wp:attachment":[{"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/media?parent=29433"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/categories?post=29433"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/tags?post=29433"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}