{
  "$kind": "ELMA.Assistant.Bot",
  "version": "2.4.0",
  "name": "Выполнение скрипта",
  "scenarios": [
    {
      "$kind": "ELMA.Assistant.DefaultScenario",
      "triggerGroup": {
        "$kind": "ELMA.Assistant.DefaultTriggerGroup",
        "triggers": [
          {
            "$kind": "ELMA.Assistant.StartTrigger",
            "outputBindingId": "BND_nnGN_vx_zP",
            "id": "TRR_v9_X1ggiwr",
            "$designer": null
          }
        ],
        "name": null,
        "id": "TRG001000",
        "$designer": null
      },
      "actionGroups": [
        {
          "$kind": "ELMA.Assistant.DefaultActionGroup",
          "actions": [
            {
              "$kind": "ELMA.Assistant.TextOutput",
              "messages": [
                {
                  "$kind": "ELMA.Assistant.Message",
                  "content": "Привет! Бот отправит запрос на получение данных с внешнего ресурса с помощью скрипта.",
                  "attachments": [],
                  "id": "MSG_1g0pqvzp8T",
                  "$designer": null
                }
              ],
              "id": "ACT_ixi10kgnd8",
              "$designer": null
            },
            {
              "$kind": "ELMA.Assistant.ChoiceTransit",
              "buttons": [
                {
                  "$kind": "ELMA.Assistant.Button",
                  "value": "Да",
                  "synonyms": [],
                  "outputBindingId": "BND_Vju5PuzVUP",
                  "type": "Transit",
                  "url": null,
                  "id": "BTN_nRsGZS_yfH",
                  "$designer": null
                },
                {
                  "$kind": "ELMA.Assistant.Button",
                  "value": "Нет",
                  "synonyms": [],
                  "outputBindingId": "BND_X_LOgeBBHL",
                  "type": "Transit",
                  "url": null,
                  "id": "BTN_e36huDRR12",
                  "$designer": null
                }
              ],
              "messages": [
                {
                  "$kind": "ELMA.Assistant.Message",
                  "content": "Выполнить скрипт?",
                  "attachments": [],
                  "id": "MSG_g14ZaAJ7hy",
                  "$designer": null
                }
              ],
              "variableId": null,
              "validators": [],
              "required": true,
              "cancellable": false,
              "unrecognizedPromptMessages": [],
              "defaultValueResponseMessages": [],
              "customValidationErrorMessages": [],
              "maxTurnCount": 3,
              "defaultValue": null,
              "canShowHelp": false,
              "helpMessages": [],
              "canTransferToOperator": false,
              "alwaysPrompt": true,
              "id": "ACT_29yqw_rLfm",
              "$designer": null
            }
          ],
          "inputBindingIds": [
            "BND_nnGN_vx_zP"
          ],
          "outputBindingId": null,
          "name": "",
          "id": "ACG_LtqEyfcnx6",
          "$designer": {
            "id": "ACG_LtqEyfcnx6",
            "name": "",
            "description": null,
            "positionX": 424.0,
            "positionY": 70.0
          }
        },
        {
          "$kind": "ELMA.Assistant.DefaultActionGroup",
          "actions": [
            {
              "$kind": "ELMA.Assistant.ScriptAction",
              "content": "//Импортируем модуль для работы с HTTP запросами\nconst axios = require('axios');\n\nconst response = await axios.get('https://jsonplaceholder.typicode.com/posts/1');\ncontext.output.logger.log('Статус', response.status);\ncontext.output.logger.log('Данные', response.data);\n\nif (response.status === 200) {\n    context.output.variables.zagolovok_stati = response.data.title;\n    context.output.variables.tekst_stati = response.data.body;\n}",
              "executionTimeout": 60,
              "retryCount": 0,
              "retryDelay": 1,
              "outputBindingId": "BND_rPKq4TT_rt",
              "id": "ACT_tOjQw8paIG",
              "$designer": null
            },
            {
              "$kind": "ELMA.Assistant.TextOutput",
              "messages": [
                {
                  "$kind": "ELMA.Assistant.Message",
                  "content": "Заголовок: {VAR_TdSMBDSR1J} \nТекст: {VAR_zaiOUpKPTc} ",
                  "attachments": [],
                  "id": "MSG_P9akefpQan",
                  "$designer": null
                }
              ],
              "id": "ACT_mKfE7SDE55",
              "$designer": null
            }
          ],
          "inputBindingIds": [
            "BND_Vju5PuzVUP"
          ],
          "outputBindingId": null,
          "name": "",
          "id": "ACG_C3wEXZ3716",
          "$designer": {
            "id": "ACG_C3wEXZ3716",
            "name": "",
            "description": null,
            "positionX": 853.6667,
            "positionY": 64.28125
          }
        },
        {
          "$kind": "ELMA.Assistant.DefaultActionGroup",
          "actions": [
            {
              "$kind": "ELMA.Assistant.CloseConversation",
              "closingMessage": "",
              "id": "ACT_81wDVuX1mk",
              "$designer": null
            }
          ],
          "inputBindingIds": [
            "BND_X_LOgeBBHL"
          ],
          "outputBindingId": null,
          "name": "",
          "id": "ACG_H8ERRsG2y5",
          "$designer": {
            "id": "ACG_H8ERRsG2y5",
            "name": "",
            "description": null,
            "positionX": 845.3333,
            "positionY": 536.47394
          }
        },
        {
          "$kind": "ELMA.Assistant.DefaultActionGroup",
          "actions": [
            {
              "$kind": "ELMA.Assistant.TextOutput",
              "messages": [
                {
                  "$kind": "ELMA.Assistant.Message",
                  "content": "При выполнении скрипта, произошла ошибка.",
                  "attachments": [],
                  "id": "MSG_Hhqx_JJ6w7",
                  "$designer": null
                }
              ],
              "id": "ACT_B5ax4UKTmy",
              "$designer": null
            }
          ],
          "inputBindingIds": [
            "BND_rPKq4TT_rt"
          ],
          "outputBindingId": null,
          "name": "",
          "id": "ACG_oA3K8PkYee",
          "$designer": {
            "id": "ACG_oA3K8PkYee",
            "name": "",
            "description": null,
            "positionX": 1266.3334,
            "positionY": 64.28125
          }
        }
      ],
      "intents": [],
      "bindings": [
        {
          "$kind": "ELMA.Assistant.Binding",
          "sourceEntityId": "TRR_v9_X1ggiwr",
          "targetEntityId": "ACG_LtqEyfcnx6",
          "id": "BND_nnGN_vx_zP",
          "$designer": null
        },
        {
          "$kind": "ELMA.Assistant.Binding",
          "sourceEntityId": "BTN_e36huDRR12",
          "targetEntityId": "ACG_H8ERRsG2y5",
          "id": "BND_X_LOgeBBHL",
          "$designer": null
        },
        {
          "$kind": "ELMA.Assistant.Binding",
          "sourceEntityId": "BTN_nRsGZS_yfH",
          "targetEntityId": "ACG_C3wEXZ3716",
          "id": "BND_Vju5PuzVUP",
          "$designer": null
        },
        {
          "$kind": "ELMA.Assistant.Binding",
          "sourceEntityId": "ACT_tOjQw8paIG",
          "targetEntityId": "ACG_oA3K8PkYee",
          "id": "BND_rPKq4TT_rt",
          "$designer": null
        }
      ],
      "version": "1.1.0",
      "name": "Старт бота",
      "enabled": true,
      "interruption": "Disabled",
      "cancellation": "Disabled",
      "variables": [],
      "id": "SCN_RNqowoMpw5",
      "$designer": null
    }
  ],
  "variables": [
    {
      "$kind": "ELMA.Assistant.Variable",
      "name": "Название",
      "code": "nazvanie",
      "type": "String",
      "scope": "Bot",
      "owner": "User",
      "validators": [],
      "id": "VAR_qR60LicYkZ",
      "$designer": null
    },
    {
      "$kind": "ELMA.Assistant.Variable",
      "name": "Заголовок статьи",
      "code": "zagolovok_stati",
      "type": "String",
      "scope": "Bot",
      "owner": "User",
      "validators": [],
      "id": "VAR_TdSMBDSR1J",
      "$designer": null
    },
    {
      "$kind": "ELMA.Assistant.Variable",
      "name": "Текст статьи",
      "code": "tekst_stati",
      "type": "String",
      "scope": "Bot",
      "owner": "User",
      "validators": [],
      "id": "VAR_zaiOUpKPTc",
      "$designer": null
    }
  ],
  "settings": {
    "$kind": "ELMA.Assistant.BotSettings",
    "script": {
      "content": "// Примеры работы с событиями бота\n// 1. Событие распознанного интента\n// onIntentRecognized(\"pokupka_prodazha__chasy_raboty_magazinov\", async (botEvent) => {\n//   код интента\n//   console.log(botEvent.intentKey);\n//   результаты распознавания\n//   console.log(botEvent.recognizerResult);\n//   ввод пользователя\n//   console.log(botEvent.userInputText);\n//});\n\n// 2. Событие начала работы элемента ввода данных\n// onInputDialogBegin(\"store_name\", async (botEvent) => {\n//   тип распознавателя\n//   console.log(botEvent.recognizerKind);\n//   сообщение бота\n//   context.output.result.promptText = \"Введите название магазина\";\n//   сообщение при нераспознанном вводе\n//   context.output.result.unrecognizedPromptText = \"Не удалось распознать название магазина\";\n//   подсказки бота\n//   context.output.result.suggestedActions = [\"Мебель\", \"Одежда\", \"Обувь\"];\n// });\n\n// 3. Событие прерывания ввода\n// onInputDialogBeforeInterruption(\"store_name\", async (botEvent) => {\n//   ввод пользователя\n//   console.log(botEvent.userInputText);\n//   распознанное значение\n//   console.log(botEvent.recognizedValue);\n//   тип распознавателя\n//   console.log(botEvent.recognizerKind);\n//   нужно ли разрешать прерывать работу элемента\n//   context.output.result.allowInterruptions = false;\n// });\n\n// 4. Событие распознавания ввода пользователя\n// onInputDialogValueRecognized(\"store_name\", async (botEvent) => {\n//   ввод пользователя\n//   console.log(botEvent.userInputText);\n//   распознанное значение\n//   console.log(botEvent.recognizedValue);\n//   тип распознавателя\n//   console.log(botEvent.recognizerKind);\n//   объект диалоговой активности пользователя\n//   console.log(botEvent.activity);\n//   распознано ли значение\n//   context.output.result.recognized = true;\n//   распознанное значение\n//   context.output.result.outputValue = \"Магазин Мебель\";\n// });\n",
      "executionTimeout": 15,
      "retryCount": 0,
      "retryDelay": 1
    },
    "integrations": [
      {
        "$kind": "ELMA.Assistant.ELMA365IntegrationSettings",
        "apiUrl": "https://auktcnqyuhxku.s-elma365.ru",
        "integrationId": "",
        "organizationId": "",
        "xToken": "d7e54997-e099-439e-b63d-d5cf3e7cc2ba",
        "name": "ELMA365",
        "code": "elma365",
        "id": "EIS_w5TdDGm0Ro",
        "$designer": null
      }
    ],
    "localization": {
      "locale": "ru-ru"
    },
    "smtp": {
      "host": "",
      "name": "",
      "username": "",
      "password": "",
      "port": 465,
      "useSsl": true
    },
    "recognition": {
      "intentThreshold": 0.6,
      "nlp": {
        "useCustomTrainingModel": false,
        "customTrainingModel": null
      },
      "kb": {
        "enabled": null,
        "threshold": 0.8,
        "searchParentsOnlyIfNoContext": null
      },
      "resultSelectionPriority": "Score"
    },
    "conversationClosing": {
      "closingEnabled": false,
      "closingTimeoutSeconds": 1800,
      "closingMessage": ""
    },
    "id": "SET_o33gdSUSRL",
    "$designer": null
  },
  "id": "BOT_kyMEOSb4ix",
  "$designer": null
}