{"id":18060,"date":"2018-08-24T11:55:13","date_gmt":"2018-08-24T11:55:13","guid":{"rendered":"https:\/\/developer.kore.ai\/v8-1\/?post_type=docs&#038;p=15189"},"modified":"2021-03-18T10:38:48","modified_gmt":"2021-03-18T10:38:48","slug":"conversation-history-api-old","status":"publish","type":"post","link":"https:\/\/developer.kore.ai\/v8-1\/docs\/bots\/api-guide\/conversation-history-api-old\/","title":{"rendered":"Conversation History API (old)"},"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>Fetches the conversational messages between the bot and user in reverse chronological order. This API supports pagination. You can provide offset\/skip and limit to get a certain number of messages at a time.<\/p>\n<p><em><strong>Note<\/strong>: This API is currently accessible only if BotKit SDK or Agent Transfer is enabled for a bot.<\/em><\/p>\n<p>This API will soon be <strong><span style=\"text-decoration: underline;\">deprecated<\/span><\/strong>, use this API instead: <a href=\"\/v8-1\/docs\/bots\/api-guide\/conversation-history-api\/\">Conversation History API<\/a>.<\/p>\n<p><b>Get <\/b> <code>\/api\/botsdk\/stream\/{{stream_id}}\/getMessages?userId={{user_id}}&amp;skip={{numberOfMessagesToBeSkipped}}&amp;limit={{numberOfMessagesTobeFetched}}<\/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=\"Parameters\">Parameters<\/span><\/h3>\n<table>\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th>Description<\/th>\n<\/tr>\n<tr>\n<td>stream_id<\/td>\n<td>Bot ID. You can access it from the bot\u2019s General Settings page.<\/td>\n<\/tr>\n<tr>\n<td>user_id<\/td>\n<td>The ID of the user whose conversation history to access.<\/td>\n<\/tr>\n<tr>\n<td>skip<\/td>\n<td>The number of messages to be skipped.<\/td>\n<\/tr>\n<tr>\n<td>limit<\/td>\n<td>The number of messages to be shown on each page.<\/td>\n<\/tr>\n<\/thead>\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:<br \/>\n<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 class=\"\">curl -X GET \\ 'https:\/\/bots.kore.ai\/api\/botsdk\/stream\/{{stream_id}}\/getMessages?userId= u-XXX-XXX' \\\r\n-H 'auth: YOUR_JWT_ACCESS_TOKEN'<\/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   \"total\":1,\r\n   \"moreAvailable\":false,\r\n   \"messages\":[\r\n      {\r\n         \"_id\":\"ms-eb23XXXXX7075f28b\",\r\n         \"type\":\"outgoing\",\r\n         \"status\":\"pending\",\r\n         \"createdBy\":\"u-6dd4XXXXXXXXXf-1f75b054f6dc\",\r\n         \"botId\":\"st-db4c106XXXXXXXXX05-350518802fd6\",\r\n         \"orgId\":\"o-232b5XXXXXXXded-d8d5131aa62c\",\r\n         \"lmodifiedOn\":\"2017-09-28T13:18:04.395Z\",\r\n         \"createdOn\":\"2017-09-28T13:18:04.401Z\",\r\n         \"components\":[\r\n            {\r\n               \"_id\":\"cp-905c82aXXXXXXX360499c39a\",\r\n               \"cT\":\"text\",\r\n               \"data\":{\r\n                  \"text\":\"Thanks! I now have access to your Kore Assistant account. Don\u2019t worry, I never access your account without you asking me to do something for you.\"\r\n               },\r\n               \"thumbnails\":[\r\n               ]\r\n            }\r\n         ],\r\n         \"channels\":[\r\n            {\r\n               \"to\":\"u-6dd4XXXXXXXXX75b054f6dc\",\r\n               \"type\":\"rtm\",\r\n               \"requestId\":\"ms-dfabXXXXXXX7704b79b21\"\r\n            }\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":"Fetches the conversational messages between the bot and user in reverse chronological order. This API supports pagination. You can provide offset\/skip and limit to get a certain number of messages at a time. Note: This API is currently accessible only if BotKit SDK or Agent Transfer is enabled for a bot. This API will soon...","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"class_list":["post-18060","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\/18060","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\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/comments?post=18060"}],"version-history":[{"count":4,"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/posts\/18060\/revisions"}],"predecessor-version":[{"id":21336,"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/posts\/18060\/revisions\/21336"}],"wp:attachment":[{"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/media?parent=18060"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/categories?post=18060"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/tags?post=18060"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}