{"id":30396,"date":"2021-08-24T12:03:14","date_gmt":"2021-08-24T11:03:14","guid":{"rendered":"https:\/\/multisite.korebots.com\/v9-0\/uncategorised-ja\/sessions-api\/"},"modified":"2021-08-24T12:10:12","modified_gmt":"2021-08-24T11:10:12","slug":"sessions-api","status":"publish","type":"post","link":"https:\/\/multisite.korebots.com\/v9-0\/uncategorised-ja\/sessions-api\/","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 via_grid cols_1 laptops-cols_inherit tablets-cols_inherit mobiles-cols_1 valign_top type_default stacking_default\"><div class=\"wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><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<\/div><\/div><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 class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><h3><span class=\"ez-toc-section\" id=\"Query_Parameters\"><\/span>Query Parameters<span class=\"ez-toc-section-end\"><\/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<\/div><\/div><div class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><h3><span class=\"ez-toc-section\" id=\"Body_Parameters\"><\/span>Body Parameters<span class=\"ez-toc-section-end\"><\/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<\/div><\/div><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 class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><h3><span class=\"ez-toc-section\" id=\"%E8%AA%8D%E8%A8%BC\"><\/span>\u8a8d\u8a3c<span class=\"ez-toc-section-end\"><\/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<\/div><\/div><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 class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><h3><span class=\"ez-toc-section\" id=\"%E5%BF%9C%E7%AD%94%E3%81%AE%E3%82%B3%E3%83%B3%E3%83%86%E3%83%B3%E3%83%84%E3%82%BF%E3%82%A4%E3%83%97\"><\/span>\u5fdc\u7b54\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u30bf\u30a4\u30d7<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><code>application\/JSON<\/code><\/p>\n<\/div><\/div><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 class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><h3><span class=\"ez-toc-section\" id=\"Sample_Request\"><\/span>Sample Request<span class=\"ez-toc-section-end\"><\/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<\/div><\/div><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 class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><h3><span class=\"ez-toc-section\" id=\"Sample_Response\"><\/span>Sample Response<span class=\"ez-toc-section-end\"><\/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<\/div><\/div><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><\/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":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[79],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/posts\/30396"}],"collection":[{"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/comments?post=30396"}],"version-history":[{"count":3,"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/posts\/30396\/revisions"}],"predecessor-version":[{"id":30608,"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/posts\/30396\/revisions\/30608"}],"wp:attachment":[{"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/media?parent=30396"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/categories?post=30396"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/tags?post=30396"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}