{"id":18061,"date":"2018-08-24T12:08:39","date_gmt":"2018-08-24T12:08:39","guid":{"rendered":"https:\/\/developer.kore.ai\/v10-1\/?post_type=docs&#038;p=15194"},"modified":"2023-07-25T11:47:50","modified_gmt":"2023-07-25T10:47:50","slug":"bot-variables-import","status":"publish","type":"post","link":"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/api-guide\/bot-variables-import\/","title":{"rendered":"Bot Variables Import 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-6ae86fecbe620\" data-id=\"6ae86fecbe620\" 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>To import global and content variables into the bot.<\/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><code>https:\/\/{{host}}\/api\/{{version}}\/public\/builder\/bot\/{{BotID}}\/variables\/import<\/code><\/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: Import Variables<\/li>\n<li>Admin Console: Not Applicable<\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<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 identifier can be accessed under <b>General Settings<\/b> on the Bot Builder.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<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>key<\/td>\n<td>Required<\/td>\n<td>Name of the variable.<\/td>\n<\/tr>\n<tr>\n<td>value<\/td>\n<td>Required<\/td>\n<td>Value for the variable.<\/td>\n<\/tr>\n<tr>\n<td>hint<\/td>\n<td>Required<\/td>\n<td>Description of the variable.<\/td>\n<\/tr>\n<tr>\n<td>variableType<\/td>\n<td>Required<\/td>\n<td>The type of variable can be as follows:<\/p>\n<ul>\n<li><strong>env<\/strong> for global variable or<\/li>\n<li><strong>locale<\/strong> for content variable<\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<tr>\n<td>scope<\/td>\n<td>Required<\/td>\n<td>The scope of the variable corresponds to the <b>Setup<\/b> Option at the time of variable declaration and can be one of the following:<\/p>\n<ul>\n<li>prePopulated<\/li>\n<li>askOnInstall<\/li>\n<li>hidden<\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<tr>\n<td>localeData<\/td>\n<td>Required<\/td>\n<td>For the variables of type locale, additional language data needs to be passed in the following format for each language:<\/p>\n<pre>{\r\n      \"en\": {\r\n        \"value\": \"english language prompt\",\r\n        \"hint\": \"\"\r\n      }\r\n    }<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Sample_Request\">Sample Request<\/span><\/h2>\n<pre class=\"code-limit-400px\">curl -X POST \\\r\n  https:\/\/{{host}}\/api\/1.1\/public\/builder\/bot\/{{BotId}}\/variables\/import \\\r\n  -H 'Content-Type: application\/json' \\\r\n  -H 'auth: {{YOUR_JWT_ACCESS_TOKEN}}' \\\r\n  -d '[\r\n  {\r\n    \"key\": \"Global\",\r\n    \"value\": \"Globalkey-prePopulated\",\r\n    \"hint\": \"\",\r\n    \"variableType\": \"env\",\r\n    \"scope\": \"prePopulated\"\r\n  },\r\n\t{\r\n    \"key\": \"Lang\",\r\n    \"variableType\": \"locale\",\r\n    \"scope\": \"prePopulated\",\r\n    \"localeData\": {\r\n      \"en\": {\r\n        \"value\": \"english language prompt\",\r\n        \"hint\": \"\"\r\n      }\r\n    }\r\n  }\r\n]'<\/pre>\n<p>&nbsp;<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Sample_Request_when_Collections_are_enabled\">Sample Request when Collections are enabled<\/span><\/h2>\n<pre class=\"code-limit-400px\">curl -X POST \\\r\n  https:\/\/{{host}}\/api\/1.1\/public\/builder\/bot\/{{BotId}}\/variables\/import \\\r\n--header 'auth: {{YOUR_JWT_ACCESS_TOKEN}}' \\\r\n--header 'Content-Type: application\/json' \\\r\n--data-raw '{\r\n    \"botVariables\": [\r\n        {\r\n            \"key\": \"CVar\",\r\n            \"value\": \"Cvar1\",\r\n            \"hint\": \"\",\r\n            \"audioTag\": \"\",\r\n            \"variableType\": \"locale\",\r\n            \"scope\": \"prePopulated\",\r\n            \"localeData\": {\r\n                \"en\": {\r\n                    \"value\": \"Cvar1\",\r\n                    \"hint\": \"\",\r\n                    \"audioTag\": \"\"\r\n                }\r\n            },\r\n            \"group\": \"\",\r\n            \"propagateValue\": false,\r\n            \"vNameSpace\": [\r\n                {\r\n                    \"name\": \"default\",\r\n                    \"refId\": \"10xxxxxx-4xxb-50xx-bxx9-3axxxxxxxxxx\"\r\n                }\r\n            ]\r\n        },\r\n        {\r\n            \"key\": \"GKey1\",\r\n            \"value\": \"GValue1-C\",\r\n            \"hint\": \"GNotes1\",\r\n            \"audioTag\": \"\",\r\n            \"variableType\": \"env\",\r\n            \"scope\": \"prePopulated\",\r\n            \"group\": \"\",\r\n            \"propagateValue\": false,\r\n            \"vNameSpace\": [\r\n                {\r\n                    \"name\": \"default\",\r\n                    \"refId\": \"10xxxxxx-4xxb-50xx-bxx9-3axxxxxxxxxx\"\r\n                }\r\n            ]\r\n        },\r\n        {\r\n            \"key\": \"GKey2\",\r\n            \"value\": \"Gkey2Stag\",\r\n            \"hint\": \"GNotes2\",\r\n            \"audioTag\": \"\",\r\n            \"variableType\": \"env\",\r\n            \"scope\": \"prePopulated\",\r\n            \"group\": \"\",\r\n            \"propagateValue\": false,\r\n            \"vNameSpace\": [\r\n                {\r\n                    \"name\": \"default\",\r\n                    \"refId\": \"10xxxxxx-4xxb-50xx-bxx9-3axxxxxxxxxx\"\r\n                }\r\n            ]\r\n        },\r\n        {\r\n            \"key\": \"GKey55\",\r\n            \"value\": \"GKey55-Staging\",\r\n            \"hint\": \"GNotes2\",\r\n            \"audioTag\": \"\",\r\n            \"variableType\": \"env\",\r\n            \"scope\": \"prePopulated\",\r\n            \"propagateValue\": false,\r\n            \"vNameSpace\": [\r\n                {\r\n                    \"name\": \"default\",\r\n                    \"refId\": \"10xxxxxx-4xxb-50xx-bxx9-3axxxxxxxxxx\"\r\n                }\r\n            ]\r\n        },\r\n        {\r\n            \"key\": \"contentvar\",\r\n            \"value\": \"contvarvalue\",\r\n            \"hint\": \"This is content variable\",\r\n            \"audioTag\": \"\",\r\n            \"variableType\": \"locale\",\r\n            \"scope\": \"prePopulated\",\r\n            \"localeData\": {\r\n                \"en\": {\r\n                    \"value\": \"contvarvalue\",\r\n                    \"hint\": \"This is content variable\",\r\n                    \"audioTag\": \"\"\r\n                }\r\n            },\r\n            \"group\": \"\",\r\n            \"propagateValue\": false,\r\n            \"vNameSpace\": [\r\n                {\r\n                    \"name\": \"default\",\r\n                    \"refId\": \"10xxxxxx-4xxb-50xx-bxx9-3axxxxxxxxxx\"\r\n                }\r\n            ]\r\n        }\r\n    ],\r\n    \"botCollections\": [\r\n        {\r\n            \"name\": \"Default\",\r\n            \"description\": \"Default Collection\",\r\n            \"refId\": \"8xxxxxxa-exxc-5xx1-bxxd-56xxxxxxxxxx\"\r\n        },\r\n        {\r\n            \"name\": \"Staging\",\r\n            \"description\": \"Staging Environment\",\r\n            \"refId\": \"0cxxxxx1-3xx8-52xx-bxxc-02xxxxxxxxxx\"\r\n        }\r\n    ],\r\n    \"botCollectionVariables\": [\r\n        {\r\n            \"key\": \"GKey1\",\r\n            \"value\": \"GValue1-C\",\r\n            \"audioTag\": \"\",\r\n            \"refId\": \"0cxxxxx1-3xx8-52xx-bxxc-02xxxxxxxxxx\"\r\n        },\r\n        {\r\n            \"key\": \"GKey1\",\r\n            \"value\": \"GValue1-C\",\r\n            \"audioTag\": \"\",\r\n            \"refId\": \"8xxxxxxa-exxc-5xx1-bxxd-56xxxxxxxxxx\"\r\n        },\r\n        {\r\n            \"key\": \"GKey2\",\r\n            \"value\": \"Gkey2Stag\",\r\n            \"audioTag\": \"\",\r\n            \"refId\": \"0cxxxxx1-3xx8-52xx-bxxc-02xxxxxxxxxx\"\r\n        },\r\n        {\r\n            \"key\": \"GKey2\",\r\n            \"value\": \"Gkey2Diff\",\r\n            \"audioTag\": \"\",\r\n            \"refId\": \"8xxxxxxa-exxc-5xx1-bxxd-56xxxxxxxxxx\"\r\n        },\r\n        {\r\n            \"key\": \"GKey55\",\r\n            \"value\": \"GKey55-Staging\",\r\n            \"audioTag\": \"\",\r\n            \"refId\": \"0cxxxxx1-3xx8-52xx-bxxc-02xxxxxxxxxx\"\r\n        },\r\n        {\r\n            \"key\": \"GKey55\",\r\n            \"value\": \"GKey55-Default\",\r\n            \"audioTag\": \"testaudioTag\",\r\n            \"refId\": \"8xxxxxxa-exxc-5xx1-bxxd-56xxxxxxxxxx\"\r\n        }\r\n    ]\r\n}'<\/pre>\n<p>&nbsp;<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Body_Parameters-2\">Body Parameters<\/span><\/h2>\n<p>No body parameters are passed.<\/p>\n<p>&nbsp;<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Sample_Response\">Sample Response<\/span><\/h2>\n<pre>{\r\n  \"message\": \"2 Variables imported\/updated successfully.\"\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 import global and content variables into the bot. Method POST Endpoint https:\/\/{{host}}\/api\/{{version}}\/public\/builder\/bot\/{{BotID}}\/variables\/import Content Type application\/json Authorization auth: {{JWT}} See How to generate the JWT Token. API Scope Bot Builder: Import Variables Admin Console: Not Applicable &nbsp; Query Parameters Parameter Required Description host Required The environment URL. For example, https:\/\/bots.kore.ai BotID Required The identifier can...","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-18061","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\/18061","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\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/comments?post=18061"}],"version-history":[{"count":19,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/18061\/revisions"}],"predecessor-version":[{"id":58360,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/18061\/revisions\/58360"}],"wp:attachment":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/media?parent=18061"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/categories?post=18061"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/tags?post=18061"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}