Skip to content

Bot Variables Import API

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

Query Parameters

PARAMETER REQUIRED DESCRIPTION
host Required The environment URL. For example, https://bots.kore.ai
BotID Required The identifier can be accessed under General Settings on the Bot Builder.

Body Parameters

PARAMETER REQUIRED DESCRIPTION
key Required Name of the variable.
value Required Value for the variable.
hint Required Description of the variable.
variableType Required The type of variable can be as follows:
  • env for global variable or
  • locale for content variable
scope Required The scope of the variable corresponds to the Setup Option at the time of variable declaration and can be one of the following:
  • prePopulated
  • askOnInstall
  • hidden
localeData Required For the variables of type locale, additional language data needs to be passed in the following format for each language:
    {
        "en": {
            "value": "english language prompt",
            "hint": ""
        }
    }
    

Sample Request

curl -X POST 'https://{{host}}/api/1.1/public/builder/bot/{{BotId}}/variables/import' \
  -H 'Content-Type: application/json' \
  -H 'auth: {{YOUR_JWT_ACCESS_TOKEN}}' \
  -d '[
    {
        "key": "Global",
        "value": "Globalkey-prePopulated",
        "hint": "",
        "variableType": "env",
        "scope": "prePopulated"
    },
    {
    "key": "Lang",
    "variableType": "locale",
    "scope": "prePopulated",
    "localeData": {
      "en": {
        "value": "english language prompt",
        "hint": ""
      }
    }
  }
]'

Sample Request when Collections are enabled

curl -X POST \
  https://{{host}}/api/1.1/public/builder/bot/{{BotId}}/variables/import \
--header 'auth: {{YOUR_JWT_ACCESS_TOKEN}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "botVariables": [
        {
            "key": "CVar",
            "value": "Cvar1",
            "hint": "",
            "audioTag": "",
            "variableType": "locale",
            "scope": "prePopulated",
            "localeData": {
                "en": {
                    "value": "Cvar1",
                    "hint": "",
                    "audioTag": ""
                }
            },
            "group": "",
            "propagateValue": false,
            "vNameSpace": [
                {
                    "name": "default",
                    "refId": "10xxxxxx-4xxb-50xx-bxx9-3axxxxxxxxxx"
                }
            ]
        },
        {
            "key": "GKey1",
            "value": "GValue1-C",
            "hint": "GNotes1",
            "audioTag": "",
            "variableType": "env",
            "scope": "prePopulated",
            "group": "",
            "propagateValue": false,
            "vNameSpace": [
                {
                    "name": "default",
                    "refId": "10xxxxxx-4xxb-50xx-bxx9-3axxxxxxxxxx"
                }
            ]
        },
        {
            "key": "GKey2",
            "value": "Gkey2Stag",
            "hint": "GNotes2",
            "audioTag": "",
            "variableType": "env",
            "scope": "prePopulated",
            "group": "",
            "propagateValue": false,
            "vNameSpace": [
                {
                    "name": "default",
                    "refId": "10xxxxxx-4xxb-50xx-bxx9-3axxxxxxxxxx"
                }
            ]
        },
        {
            "key": "GKey55",
            "value": "GKey55-Staging",
            "hint": "GNotes2",
            "audioTag": "",
            "variableType": "env",
            "scope": "prePopulated",
            "propagateValue": false,
            "vNameSpace": [
                {
                    "name": "default",
                    "refId": "10xxxxxx-4xxb-50xx-bxx9-3axxxxxxxxxx"
                }
            ]
        },
        {
            "key": "contentvar",
            "value": "contvarvalue",
            "hint": "This is content variable",
            "audioTag": "",
            "variableType": "locale",
            "scope": "prePopulated",
            "localeData": {
                "en": {
                    "value": "contvarvalue",
                    "hint": "This is content variable",
                    "audioTag": ""
                }
            },
            "group": "",
            "propagateValue": false,
            "vNameSpace": [
                {
                    "name": "default",
                    "refId": "10xxxxxx-4xxb-50xx-bxx9-3axxxxxxxxxx"
                }
            ]
        }
    ],
    "botCollections": [
        {
            "name": "Default",
            "description": "Default Collection",
            "refId": "8xxxxxxa-exxc-5xx1-bxxd-56xxxxxxxxxx"
        },
        {
            "name": "Staging",
            "description": "Staging Environment",
            "refId": "0cxxxxx1-3xx8-52xx-bxxc-02xxxxxxxxxx"
        }
    ],
    "botCollectionVariables": [
        {
            "key": "GKey1",
            "value": "GValue1-C",
            "audioTag": "",
            "refId": "0cxxxxx1-3xx8-52xx-bxxc-02xxxxxxxxxx"
        },
        {
            "key": "GKey1",
            "value": "GValue1-C",
            "audioTag": "",
            "refId": "8xxxxxxa-exxc-5xx1-bxxd-56xxxxxxxxxx"
        },
        {
            "key": "GKey2",
            "value": "Gkey2Stag",
            "audioTag": "",
            "refId": "0cxxxxx1-3xx8-52xx-bxxc-02xxxxxxxxxx"
        },
        {
            "key": "GKey2",
            "value": "Gkey2Diff",
            "audioTag": "",
            "refId": "8xxxxxxa-exxc-5xx1-bxxd-56xxxxxxxxxx"
        },
        {
            "key": "GKey55",
            "value": "GKey55-Staging",
            "audioTag": "",
            "refId": "0cxxxxx1-3xx8-52xx-bxxc-02xxxxxxxxxx"
        },
        {
            "key": "GKey55",
            "value": "GKey55-Default",
            "audioTag": "testaudioTag",
            "refId": "8xxxxxxa-exxc-5xx1-bxxd-56xxxxxxxxxx"
        }
    ]
}'

Body Parameters

No body parameters are passed.

Sample Response

{
  "message": "2 Variables imported/updated successfully."
}