전역 및 콘텐츠 변수를 봇으로 가져옵니다.

이 API를 사용하려면 앱에 변수 가져오기의 봇 빌더 API 범위가 필요합니다.

POST https://{{host}}/api/{{version}}/public/builder/bot/{{BotID}}/variables/import

쿼리 매개 변수

매개 변수 설명
host 환경 URL(예: https://bots.kore.ai)
BotID 봇 ID입니다. 봇의 일반 설정 페이지에서 이를 액세스할 수 있습니다.

본문 매개 변수

매개 변수 설명
key 변수의 이름
value 변수에 대한 값
hint 변수 설명
variableType

변수 유형은 다음과 같을 수 있습니다

  • 전역 변수의 경우 env 또는
  • 콘텐츠 변수의 경우 locale입니다.
scope

변수의 범위는 변수 선언 시점의 설정 옵션에 해당하며, 다음과 같을 수 있습니다.

  • prePopulated,
  • askOnInstall, 또는
  • hidden
localeData

locale 형식의 변수인 경우 각 언어에 대해 다음 형식으로 추가 언어 데이터를 전달해야 합니다.

{
      "en": {
        "value": "english language prompt",
        "hint": ""
      }
    }

권한 부여

다음 구문을 포함한 헤더에 JWT를 포함한 API를 호출합니다: auth: {{JWT}}

콘텐츠 유형 응답

application/JSON

샘플 요청

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": ""
      }
    }
  }
]'

컬렉션이 활성화된 경우 샘플 요청

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": "10e5fcd0-4f9b-5092-b249-3aebeb01c017"
                }
            ]
        },
        {
            "key": "GKey1",
            "value": "GValue1-C",
            "hint": "GNotes1",
            "audioTag": "",
            "variableType": "env",
            "scope": "prePopulated",
            "group": "",
            "propagateValue": false,
            "vNameSpace": [
                {
                    "name": "default",
                    "refId": "10e5fcd0-4f9b-5092-b249-3aebeb01c017"
                }
            ]
        },
        {
            "key": "GKey2",
            "value": "Gkey2Stag",
            "hint": "GNotes2",
            "audioTag": "",
            "variableType": "env",
            "scope": "prePopulated",
            "group": "",
            "propagateValue": false,
            "vNameSpace": [
                {
                    "name": "default",
                    "refId": "10e5fcd0-4f9b-5092-b249-3aebeb01c017"
                }
            ]
        },
        {
            "key": "GKey55",
            "value": "GKey55-Staging",
            "hint": "GNotes2",
            "audioTag": "",
            "variableType": "env",
            "scope": "prePopulated",
            "propagateValue": false,
            "vNameSpace": [
                {
                    "name": "default",
                    "refId": "10e5fcd0-4f9b-5092-b249-3aebeb01c017"
                }
            ]
        },
        {
            "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": "10e5fcd0-4f9b-5092-b249-3aebeb01c017"
                }
            ]
        }
    ],
    "botCollections": [
        {
            "name": "Default",
            "description": "Default Collection",
            "refId": "8e65ff0a-edac-5641-b27d-5614a4e94c0c"
        },
        {
            "name": "Staging",
            "description": "Staging Environment",
            "refId": "0c033a41-3988-52a5-bc1c-02a4a10863b3"
        }
    ],
    "botCollectionVariables": [
        {
            "key": "GKey1",
            "value": "GValue1-C",
            "audioTag": "",
            "refId": "0c033a41-3988-52a5-bc1c-02a4a10863b3"
        },
        {
            "key": "GKey1",
            "value": "GValue1-C",
            "audioTag": "",
            "refId": "8e65ff0a-edac-5641-b27d-5614a4e94c0c"
        },
        {
            "key": "GKey2",
            "value": "Gkey2Stag",
            "audioTag": "",
            "refId": "0c033a41-3988-52a5-bc1c-02a4a10863b3"
        },
        {
            "key": "GKey2",
            "value": "Gkey2Diff",
            "audioTag": "",
            "refId": "8e65ff0a-edac-5641-b27d-5614a4e94c0c"
        },
        {
            "key": "GKey55",
            "value": "GKey55-Staging",
            "audioTag": "",
            "refId": "0c033a41-3988-52a5-bc1c-02a4a10863b3"
        },
        {
            "key": "GKey55",
            "value": "GKey55-Default",
            "audioTag": "testaudioTag",
            "refId": "8e65ff0a-edac-5641-b27d-5614a4e94c0c"
        }
    ]
}'

샘플 응답

{
  "message": "2개의 변수를 성공적으로 가져오기/업데이트했습니다."
}

グローバル変数とコンテンツ変数をボットにインポートします。

このAPIを使用するためには、アプリに変数のインポートのボットビルダーAPIスコープが必要となります。

POST https://{{host}}/api/{{version}}/public/builder/bot/{{BotID}}/variables/import

クエリパラメータ

パラメータ 説明
host 環境URL、例: https://bots.kore.ai
BotID ボットID。ボットの「一般設定」ページからアクセスできます。

本文パラメータ

パラメータ 説明
key 変数の名前
value 変数の値
hint 変数の説明
variableType

変数のタイプは以下のとおりです

  • グローバル変数を表すenvまたは
  • コンテンツ変数のロケール
scope

変数のスコープは、変数宣言時のセットアップオプションに合わせて、以下のとおりです

  • prePopulated
  • askOnInstall
  • hidden
localeData

ロケールタイプの変数の場合、追加の言語データは言語ごとに以下の形式で渡す必要があります。

{
      "en": {
        "value": "english language prompt",
        "hint": ""
      }
    }

認証

ヘッダー内のJWTを含むAPIを、以下の構文で呼び出します。 auth: {{JWT}}

応答コンテンツタイプ

application/JSON

サンプルのリクエスト

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": ""
      }
    }
  }
]'

コレクションが有効な場合のサンプルリクエスト

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": "10e5fcd0-4f9b-5092-b249-3aebeb01c017"
                }
            ]
        },
        {
            "key": "GKey1",
            "value": "GValue1-C",
            "hint": "GNotes1",
            "audioTag": "",
            "variableType": "env",
            "scope": "prePopulated",
            "group": "",
            "propagateValue": false,
            "vNameSpace": [
                {
                    "name": "default",
                    "refId": "10e5fcd0-4f9b-5092-b249-3aebeb01c017"
                }
            ]
        },
        {
            "key": "GKey2",
            "value": "Gkey2Stag",
            "hint": "GNotes2",
            "audioTag": "",
            "variableType": "env",
            "scope": "prePopulated",
            "group": "",
            "propagateValue": false,
            "vNameSpace": [
                {
                    "name": "default",
                    "refId": "10e5fcd0-4f9b-5092-b249-3aebeb01c017"
                }
            ]
        },
        {
            "key": "GKey55",
            "value": "GKey55-Staging",
            "hint": "GNotes2",
            "audioTag": "",
            "variableType": "env",
            "scope": "prePopulated",
            "propagateValue": false,
            "vNameSpace": [
                {
                    "name": "default",
                    "refId": "10e5fcd0-4f9b-5092-b249-3aebeb01c017"
                }
            ]
        },
        {
            "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": "10e5fcd0-4f9b-5092-b249-3aebeb01c017"
                }
            ]
        }
    ],
    "botCollections": [
        {
            "name": "Default",
            "description": "Default Collection",
            "refId": "8e65ff0a-edac-5641-b27d-5614a4e94c0c"
        },
        {
            "name": "Staging",
            "description": "Staging Environment",
            "refId": "0c033a41-3988-52a5-bc1c-02a4a10863b3"
        }
    ],
    "botCollectionVariables": [
        {
            "key": "GKey1",
            "value": "GValue1-C",
            "audioTag": "",
            "refId": "0c033a41-3988-52a5-bc1c-02a4a10863b3"
        },
        {
            "key": "GKey1",
            "value": "GValue1-C",
            "audioTag": "",
            "refId": "8e65ff0a-edac-5641-b27d-5614a4e94c0c"
        },
        {
            "key": "GKey2",
            "value": "Gkey2Stag",
            "audioTag": "",
            "refId": "0c033a41-3988-52a5-bc1c-02a4a10863b3"
        },
        {
            "key": "GKey2",
            "value": "Gkey2Diff",
            "audioTag": "",
            "refId": "8e65ff0a-edac-5641-b27d-5614a4e94c0c"
        },
        {
            "key": "GKey55",
            "value": "GKey55-Staging",
            "audioTag": "",
            "refId": "0c033a41-3988-52a5-bc1c-02a4a10863b3"
        },
        {
            "key": "GKey55",
            "value": "GKey55-Default",
            "audioTag": "testaudioTag",
            "refId": "8e65ff0a-edac-5641-b27d-5614a4e94c0c"
        }
    ]
}'

サンプルのレスポンス

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

Imports global and content variables into the bot.

To use this API, app needs the Bot Builder API scope of Import Variables.

POST https://{{host}}/api/{{version}}/public/builder/bot/{{BotID}}/variables/import

Query Parameters

Parameter Description
host Environment URL, for example, https://bots.kore.ai
BotID Bot ID. You can access it from the General Settings page of the bot.

Body Parameters

Parameter Description
key Name of the Variable
value Value for the variable
hint Description of the variable
variableType Type of variable can be

  • env for global variable or
  • locale for content variable
scope Scope of the variable corresponds to the Setup Option at the time of variable declaration and can be

  • prePopulated,
  • askOnInstall, or
  • hidden
localeData For variables of type locale, additional language data needs to be passed in the following format for each language:

{
      "en": {
        "value": "english language prompt",
        "hint": ""
      }
    }

Authorization

Invoke the API with JWT in the header with the following syntax:

auth: {{JWT}}

Response content type

application/JSON

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": "10e5fcd0-4f9b-5092-b249-3aebeb01c017"
                }
            ]
        },
        {
            "key": "GKey1",
            "value": "GValue1-C",
            "hint": "GNotes1",
            "audioTag": "",
            "variableType": "env",
            "scope": "prePopulated",
            "group": "",
            "propagateValue": false,
            "vNameSpace": [
                {
                    "name": "default",
                    "refId": "10e5fcd0-4f9b-5092-b249-3aebeb01c017"
                }
            ]
        },
        {
            "key": "GKey2",
            "value": "Gkey2Stag",
            "hint": "GNotes2",
            "audioTag": "",
            "variableType": "env",
            "scope": "prePopulated",
            "group": "",
            "propagateValue": false,
            "vNameSpace": [
                {
                    "name": "default",
                    "refId": "10e5fcd0-4f9b-5092-b249-3aebeb01c017"
                }
            ]
        },
        {
            "key": "GKey55",
            "value": "GKey55-Staging",
            "hint": "GNotes2",
            "audioTag": "",
            "variableType": "env",
            "scope": "prePopulated",
            "propagateValue": false,
            "vNameSpace": [
                {
                    "name": "default",
                    "refId": "10e5fcd0-4f9b-5092-b249-3aebeb01c017"
                }
            ]
        },
        {
            "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": "10e5fcd0-4f9b-5092-b249-3aebeb01c017"
                }
            ]
        }
    ],
    "botCollections": [
        {
            "name": "Default",
            "description": "Default Collection",
            "refId": "8e65ff0a-edac-5641-b27d-5614a4e94c0c"
        },
        {
            "name": "Staging",
            "description": "Staging Environment",
            "refId": "0c033a41-3988-52a5-bc1c-02a4a10863b3"
        }
    ],
    "botCollectionVariables": [
        {
            "key": "GKey1",
            "value": "GValue1-C",
            "audioTag": "",
            "refId": "0c033a41-3988-52a5-bc1c-02a4a10863b3"
        },
        {
            "key": "GKey1",
            "value": "GValue1-C",
            "audioTag": "",
            "refId": "8e65ff0a-edac-5641-b27d-5614a4e94c0c"
        },
        {
            "key": "GKey2",
            "value": "Gkey2Stag",
            "audioTag": "",
            "refId": "0c033a41-3988-52a5-bc1c-02a4a10863b3"
        },
        {
            "key": "GKey2",
            "value": "Gkey2Diff",
            "audioTag": "",
            "refId": "8e65ff0a-edac-5641-b27d-5614a4e94c0c"
        },
        {
            "key": "GKey55",
            "value": "GKey55-Staging",
            "audioTag": "",
            "refId": "0c033a41-3988-52a5-bc1c-02a4a10863b3"
        },
        {
            "key": "GKey55",
            "value": "GKey55-Default",
            "audioTag": "testaudioTag",
            "refId": "8e65ff0a-edac-5641-b27d-5614a4e94c0c"
        }
    ]
}'

Sample Response

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