Skip to content

Pipeline action ​

Automated pipeline actions

INFO

Каждый ответ приходит в общем конверте — code, message, messages, status_code, time — а полезная нагрузка лежит в data. Таблицы ниже описывают содержимое data.

POST /pipeline-action/create ​

Create a CRM pipeline automation rule. Specify a trigger (event or scheduled), an optional condition tree, and an action to execute (create task, send SMS, change state, etc.).

Тело запроса

ПолеТипОбязательноОписание
organization_idstringДаOrganization ObjectId this action belongs to
state_idstringНетOptional CRM pipeline state (column) ObjectId this action is linked to
trigger_categorystringДаHow the action is triggered: on a business event or on a recurring schedule. Допустимые значения: event, scheduled
event_triggerstringНетRequired when trigger_category=event. Which business event fires this action. Допустимые значения: created_in_stage, moved_to_stage, created_or_moved, responsible_changed, tag_changed, products_changed
scheduled_triggerstringНетRequired when trigger_category=scheduled. Which schedule type. Допустимые значения: relative_to_field, specific_date, daily, weekly, monthly, yearly
trigger_configobjectНетTrigger-specific configuration. Shape varies by trigger type. Examples: {change_type, tag_ids} for tag_changed; {field_name, offset_hours, offset_direction} for relative_to_field; {hour, minute} for daily.
conditionobjectНетOptional condition tree evaluated before executing the action. If absent, the action always fires. Shape: {logic: '$and'|'$or', items: [{type, field_name, ...}]}
action_typestringДаWhich automation to execute when the trigger fires. Допустимые значения: auto_create_task, auto_assign_responsible, auto_change_field, auto_sms_send, webhook, complete_task, auto_change_state, add_tag, remove_tag, divide_leads
action_configobjectДаAction-specific configuration. Shape varies by action_type. Examples: {responsible_ids, mode} for auto_assign_responsible; {template_id, phone_field} for auto_sms_send; {url, method} for webhook; {state_id} for auto_change_state; {tag_ids} for add_tag/remove_tag.
namestringНетOptional display name for this automation rule
ordernumberНетSort order within a pipeline state column
is_activebooleanНетWhether this action is currently enabled (defaults to true)
apply_to_existingbooleanНетIf true, the action is applied to all existing matching sale orders immediately after creation (async, post-commit)
json
{
  "organization_id": "string",
  "state_id": "string",
  "trigger_category": "event",
  "event_trigger": "created_in_stage",
  "scheduled_trigger": "relative_to_field",
  "trigger_config": {
    "hour": 9,
    "minute": 0
  },
  "condition": {
    "logic": "$and",
    "items": [
      {
        "type": "reference",
        "field_name": "responsible_id",
        "ref_ids": [
          "64a1b2c3d4e5f6a7b8c9d0e1"
        ],
        "ref_logic": "$or"
      }
    ]
  },
  "action_type": "auto_create_task",
  "action_config": {
    "state_id": "64a1b2c3d4e5f6a7b8c9d0e2"
  },
  "name": "string",
  "order": 0,
  "is_active": false,
  "apply_to_existing": false
}

Ответ

ПолеТипОписание
_idstringPipeline-action ObjectId
organization_idstring
state_idstring
stateobjectPopulated pipeline state (name, bg_color) — present when state_id is set
state._idstring
state.namestring
state.bg_colorstring
trigger_categorystringДопустимые значения: event, scheduled
event_triggerstring
scheduled_triggerstring
trigger_configobject
conditionobject
action_typestring
action_configobject
namestring
ordernumber
is_activeboolean
apply_to_existingboolean
last_checked_atstring (date-time)
created_atstring (date-time)
updated_atstring (date-time)
json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "_id": "string",
    "organization_id": "string",
    "state_id": "string",
    "state": {
      "_id": "string",
      "name": "string",
      "bg_color": "string"
    },
    "trigger_category": "event",
    "event_trigger": "string",
    "scheduled_trigger": "string",
    "trigger_config": {},
    "condition": {},
    "action_type": "string",
    "action_config": {},
    "name": "string",
    "order": 0,
    "is_active": false,
    "apply_to_existing": false,
    "last_checked_at": "2025-05-01T12:00:00Z",
    "created_at": "2025-05-01T12:00:00Z",
    "updated_at": "2025-05-01T12:00:00Z"
  },
  "time": "2025-05-01T12:00:00Z"
}

GET /pipeline-action/get-by-id/{id} ​

Fetch a single pipeline action by ObjectId, with populated references (state, integration, SMS template, tags, etc.).

Параметры пути

ПараметрТипОбязательноОписание
idstringДаPipeline-action ObjectId

Тело запроса

Тело запроса не требуется.

Ответ

Структура ответа совпадает с POST /pipeline-action/create.

POST /pipeline-action/get-paging ​

Paginated list of pipeline actions. Filterable by organization, state, trigger category, or active status. References are not populated on list rows; use get-by-id for full detail.

Тело запроса

ПолеТипОбязательноОписание
pagenumberДаПо умолчанию: 1
limitnumberДаПо умолчанию: 20
organization_idstringНетFilter by organization ObjectId
state_idstringНетFilter by pipeline state (column) ObjectId
trigger_categorystringНетFilter by trigger category. Допустимые значения: event, scheduled
is_activebooleanНетFilter by active/inactive status
json
{
  "page": 1,
  "limit": 20,
  "organization_id": "string",
  "state_id": "string",
  "trigger_category": "event",
  "is_active": false
}

Ответ

ПолеТипОписание
totalnumber
listobject[]
list[]._idstringPipeline-action ObjectId
list[].organization_idstring
list[].state_idstring
list[].stateobjectPopulated pipeline state (name, bg_color) — present when state_id is set
list[].state._idstring
list[].state.namestring
list[].state.bg_colorstring
list[].trigger_categorystringДопустимые значения: event, scheduled
list[].event_triggerstring
list[].scheduled_triggerstring
list[].trigger_configobject
list[].conditionobject
list[].action_typestring
list[].action_configobject
list[].namestring
list[].ordernumber
list[].is_activeboolean
list[].apply_to_existingboolean
list[].last_checked_atstring (date-time)
list[].created_atstring (date-time)
list[].updated_atstring (date-time)
json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "total": 0,
    "list": [
      {
        "_id": "string",
        "organization_id": "string",
        "state_id": "string",
        "state": {
          "_id": null,
          "name": null,
          "bg_color": null
        },
        "trigger_category": "event",
        "event_trigger": "string",
        "scheduled_trigger": "string",
        "trigger_config": {},
        "condition": {},
        "action_type": "string",
        "action_config": {},
        "name": "string",
        "order": 0,
        "is_active": false,
        "apply_to_existing": false,
        "last_checked_at": "2025-05-01T12:00:00Z",
        "created_at": "2025-05-01T12:00:00Z",
        "updated_at": "2025-05-01T12:00:00Z"
      }
    ]
  },
  "time": "2025-05-01T12:00:00Z"
}

PUT /pipeline-action/update/{id} ​

Update an existing pipeline action. Provide the full payload — partial updates are not supported.

Параметры пути

ПараметрТипОбязательноОписание
idstringДаPipeline-action ObjectId

Тело запроса

ПолеТипОбязательноОписание
organization_idstringДаOrganization ObjectId this action belongs to
state_idstringНетOptional CRM pipeline state (column) ObjectId this action is linked to
trigger_categorystringДаHow the action is triggered: on a business event or on a recurring schedule. Допустимые значения: event, scheduled
event_triggerstringНетRequired when trigger_category=event. Which business event fires this action. Допустимые значения: created_in_stage, moved_to_stage, created_or_moved, responsible_changed, tag_changed, products_changed
scheduled_triggerstringНетRequired when trigger_category=scheduled. Which schedule type. Допустимые значения: relative_to_field, specific_date, daily, weekly, monthly, yearly
trigger_configobjectНетTrigger-specific configuration. Shape varies by trigger type. Examples: {change_type, tag_ids} for tag_changed; {field_name, offset_hours, offset_direction} for relative_to_field; {hour, minute} for daily.
conditionobjectНетOptional condition tree evaluated before executing the action. If absent, the action always fires. Shape: {logic: '$and'|'$or', items: [{type, field_name, ...}]}
action_typestringДаWhich automation to execute when the trigger fires. Допустимые значения: auto_create_task, auto_assign_responsible, auto_change_field, auto_sms_send, webhook, complete_task, auto_change_state, add_tag, remove_tag, divide_leads
action_configobjectДаAction-specific configuration. Shape varies by action_type. Examples: {responsible_ids, mode} for auto_assign_responsible; {template_id, phone_field} for auto_sms_send; {url, method} for webhook; {state_id} for auto_change_state; {tag_ids} for add_tag/remove_tag.
namestringНетOptional display name for this automation rule
ordernumberНетSort order within a pipeline state column
is_activebooleanНетWhether this action is currently enabled (defaults to true)
apply_to_existingbooleanНетIf true, the action is applied to all existing matching sale orders immediately after creation (async, post-commit)
json
{
  "organization_id": "string",
  "state_id": "string",
  "trigger_category": "event",
  "event_trigger": "created_in_stage",
  "scheduled_trigger": "relative_to_field",
  "trigger_config": {
    "hour": 9,
    "minute": 0
  },
  "condition": {
    "logic": "$and",
    "items": [
      {
        "type": "reference",
        "field_name": "responsible_id",
        "ref_ids": [
          "64a1b2c3d4e5f6a7b8c9d0e1"
        ],
        "ref_logic": "$or"
      }
    ]
  },
  "action_type": "auto_create_task",
  "action_config": {
    "state_id": "64a1b2c3d4e5f6a7b8c9d0e2"
  },
  "name": "string",
  "order": 0,
  "is_active": false,
  "apply_to_existing": false
}

Ответ

json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": "string",
  "time": "2025-05-01T12:00:00Z"
}

DELETE /pipeline-action/delete/{id} ​

Soft-delete a pipeline action (sets is_deleted=true). The action is immediately deactivated; any in-flight BullMQ jobs for this action will still complete.

Параметры пути

ПараметрТипОбязательноОписание
idstringДаPipeline-action ObjectId

Тело запроса

Тело запроса не требуется.

Ответ

json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": "ok",
  "time": "2025-05-01T12:00:00Z"
}

PUT /pipeline-action/set-status/{id} ​

Activate or deactivate a pipeline action. When deactivated (is_active=false) the action will not fire for new events or scheduled triggers.

Параметры пути

ПараметрТипОбязательноОписание
idstringДаPipeline-action ObjectId

Тело запроса

ПолеТипОбязательноОписание
is_activebooleanДаSet to true to activate or false to deactivate the pipeline action
json
{
  "is_active": false
}

Ответ

Структура ответа совпадает с PUT /pipeline-action/update/{id}.


Эта страница сгенерирована из спецификации OpenAPI.

Bito 2.0 Integration API