Skip to main content

Отправка уведомлений в VK по сценарию

Метод POST organization/script/add

В массиве "condition_items" необходимо добавить объект с параметрами

"key": "vk_exists"
"operator": "exists"

В массиве "action_items" объект с параметрами
"key": "vk"
"value": ""
"template_id": ""

где
  template_id - идентификатор шаблона,
  value - подготовленный текст сообщения для отправки.

Параметр value имеет больший приоритет, чем template_id.

Пример:
{
  "id": "script_vk",
  "name": "Сценарий script_vk",
  "active": true,
  "start_date": 1599067313594,
  "end_date": 1698427313594,
  "event": "sale",
  "items": [
    {
      "id": "id_node0",
      "type": "main",
      "name": "Вход",
      "event": "sale",
      "next_item_id": "id_condition_1"
    },
    {
      "id": "id_condition_1",
      "type": "condition",
      "name": "Проверка наличия VK",
      "condition_type": "and",
      "yes_item_id": "id_action1",
      "no_item_id": "id_exit",
      "condition_items": [
        {
          "key": "vk_exists",
          "name": "Есть VK",
          "operator": "exists"
        }
      ]
    },
    {
      "id": "id_action1",
      "type": "action",
      "name": "Отправка в VK",
      "next_item_id": null,
      "action_items": [
        {
         "name": "Отправка в VK",
         "key": "vk",
         "value": "Спасибо за покупку!",
         "template_id": ""
        }
      ]
    },
    {
      "id": "id_exit",
      "type": "exit",
      "name": "Выход с отменой"
    }
  ]
}