{"id":60388,"date":"2023-11-28T12:53:00","date_gmt":"2023-11-28T12:53:00","guid":{"rendered":"https:\/\/developer.kore.ai\/v10-1\/?p=60388"},"modified":"2023-11-28T13:34:03","modified_gmt":"2023-11-28T13:34:03","slug":"import-bot-functions-api","status":"publish","type":"post","link":"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/api-guide\/import-bot-functions-api\/","title":{"rendered":"Import Bot Functions 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\"><div class=\"ult-spacer spacer-6ae8707d99606\" data-id=\"6ae8707d99606\" data-height=\"10\" data-height-mobile=\"10\" data-height-tab=\"10\" data-height-tab-portrait=\"\" data-height-mobile-landscape=\"\" style=\"clear:both;display:block;\"><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<p><span style=\"font-weight: 400;\">This API allows you to import bot functions from a specified file.<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td><b>Method<\/b><\/td>\n<td>POST<\/td>\n<\/tr>\n<tr>\n<td><b>Endpoint<\/b><\/td>\n<td><span style=\"font-weight: 400;\"><code>https:\/\/{{host}}\/api\/public\/bot\/botId\/import\/botfunctions<\/code><\/span><\/td>\n<\/tr>\n<tr>\n<td><b>Content Type<\/b><\/td>\n<td><code>application\/json<\/code><\/td>\n<\/tr>\n<tr>\n<td><b>Authorization<\/b><\/td>\n<td><code>auth: {{JWT}}<\/code><\/p>\n<p>See <a href=\"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/api-guide\/apis\/#Generating_the_JWT_Token\" target=\"_blank\" rel=\"noopener noreferrer\">How to generate the JWT Token<\/a>.<\/td>\n<\/tr>\n<tr>\n<td><b>API Scope<\/b><\/td>\n<td>\n<ul>\n<li>Bot Builder: Not Applicable<\/li>\n<li>Admin Console: <span style=\"font-weight: 400;\">Bot Definition &gt; Bot Import<\/span><\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"ult-spacer spacer-6ae8707d997df\" data-id=\"6ae8707d997df\" data-height=\"10\" data-height-mobile=\"10\" data-height-tab=\"10\" data-height-tab-portrait=\"\" data-height-mobile-landscape=\"\" style=\"clear:both;display:block;\"><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h2><span class=\"ez-toc-section\" id=\"Query_Parameters\">Query Parameters<\/span><\/h2>\n<table>\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th>Required<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>host<\/td>\n<td>Required<\/td>\n<td>The environment URL. For example, <code>https:\/\/bots.kore.ai<\/code><\/td>\n<\/tr>\n<tr>\n<td>botID<\/td>\n<td>Required<\/td>\n<td>The Bot ID or Stream ID of the bot into which you want to import the functions. You can get it under <strong>General Settings<\/strong> on the Bot Builder.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"ult-spacer spacer-6ae8707d99904\" data-id=\"6ae8707d99904\" data-height=\"10\" data-height-mobile=\"10\" data-height-tab=\"10\" data-height-tab-portrait=\"\" data-height-mobile-landscape=\"\" style=\"clear:both;display:block;\"><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h2><span class=\"ez-toc-section\" id=\"Sample_Request\">Sample Request<\/span><\/h2>\n<pre>curl -X POST \\\r\n'https:\/\/{{host}}\/api\/public\/bot\/botId\/import\/botfunctions' \\\r\n--header 'auth: {{YOUR_JWT_ACCESS_TOKEN}}' \\\r\n--header 'content-type: application\/json' \\\r\n--data '[{\"fileName\":\"BotFunctions.js\",\"fileId\":\"6565d8fea4fa7f2827b225f3\"}]'\r\n<\/pre>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"ult-spacer spacer-6ae8707d9999d\" data-id=\"6ae8707d9999d\" data-height=\"10\" data-height-mobile=\"10\" data-height-tab=\"10\" data-height-tab-portrait=\"\" data-height-mobile-landscape=\"\" style=\"clear:both;display:block;\"><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h2><span class=\"ez-toc-section\" id=\"Body_Parameters\">Body Parameters<\/span><\/h2>\n<table>\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th>Required<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>fileId<\/td>\n<td><span style=\"font-weight: 400;\">Required<\/span><\/td>\n<td><span style=\"font-weight: 400;\">The unique identifier (ID) of the file to be imported. This ID can be retrieved from the response of the <\/span><a href=\"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/api-guide\/upload-file-api\/\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"font-weight: 400;\">Upload File API <\/span><\/a><span style=\"font-weight: 400;\">after uploading the Bot Functions file.<\/span><\/td>\n<\/tr>\n<tr>\n<td>fileName<\/td>\n<td><span style=\"font-weight: 400;\">Required<\/span><\/td>\n<td><span style=\"font-weight: 400;\">The name of the file containing the bot functions to import.<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"ult-spacer spacer-6ae8707d99aeb\" data-id=\"6ae8707d99aeb\" data-height=\"10\" data-height-mobile=\"10\" data-height-tab=\"10\" data-height-tab-portrait=\"\" data-height-mobile-landscape=\"\" style=\"clear:both;display:block;\"><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h2><span class=\"ez-toc-section\" id=\"Sample_Response\">Sample Response<\/span><\/h2>\n<p>Success<\/p>\n<pre>{\r\n    \"requestType\": \"BotImport\",\r\n    \"status\": \"Success\",\r\n    \"createdOn\": \"2023-11-28T12:14:59.215Z\",\r\n    \"_id\": \"6565d9c378438bc41a6cfxxx\",\r\n    \"createdBy\": \"u-37bc3853-76fd-5a25-b307-1af2e8f1bxxx\",\r\n    \"__v\": 0,\r\n    \"fileId\": \"6565d8fea4fa7f2827b225f3\",\r\n    \"fileName\": \"BotFunctions.js\"\r\n}\r\n<\/pre>\n<p>Failure<\/p>\n<pre>{\r\n    \"errors\": [\r\n        {\r\n            \"msg\": \"Invalid file id\",\r\n            \"code\": 400\r\n        }\r\n    ]\r\n}\r\n<\/pre>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"ult-spacer spacer-6ae8707d99b9b\" data-id=\"6ae8707d99b9b\" data-height=\"20\" data-height-mobile=\"20\" data-height-tab=\"20\" data-height-tab-portrait=\"\" data-height-mobile-landscape=\"\" style=\"clear:both;display:block;\"><\/div><\/div><\/div><\/div><\/div><\/div><\/section><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\"><\/div><\/div><\/div><\/div><\/div><\/section>\n","protected":false},"excerpt":{"rendered":"This API allows you to import bot functions from a specified file. Method POST Endpoint https:\/\/{{host}}\/api\/public\/bot\/botId\/import\/botfunctions Content Type application\/json Authorization auth: {{JWT}} See How to generate the JWT Token. API Scope Bot Builder: Not Applicable Admin Console: Bot Definition &gt; Bot Import Query Parameters Parameter Required Description host Required The environment URL. For example, https:\/\/bots.kore.ai...","protected":false},"author":26,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"class_list":["post-60388","post","type-post","status-publish","format-standard","hentry","category-api-guide"],"_links":{"self":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/60388","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/users\/26"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/comments?post=60388"}],"version-history":[{"count":5,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/60388\/revisions"}],"predecessor-version":[{"id":60395,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/60388\/revisions\/60395"}],"wp:attachment":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/media?parent=60388"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/categories?post=60388"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/tags?post=60388"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}