VitrinaAPI

Triggers

Automatizaciones evento → condición → acción: asignar, etiquetar, mover de etapa o avisar sin que nadie lo haga a mano.

Beta
Puede cambiar en cualquier momento, con una entrada en el changelog y aviso a quienes la llamaron recientemente — ver versionado.

Descarga la proyección completa de la API pública: openapi.json.

Fijar SLAs y automatizar acciones explica este recurso en prosa, con ejemplos ejecutables.

MétodoRutaQué hace
GET/triggersList automation triggers
POST/triggersCreate an automation trigger
DELETE/triggers/{id}Delete an automation trigger
GET/triggers/{id}Fetch one automation trigger
PUT/triggers/{id}Update an automation trigger

GET /triggers

List automation triggers

Every trigger in the workspace, enabled and disabled alike, with its run_count and last_run_at.

curl https://api.vitrinadev.com/api/v1/triggers \
  -H "Authorization: Bearer $VITRINA_KEY"

Ejemplo de respuesta (200)

{
  "data": [
    {
      "id": "d8d8d8d8-0000-4000-8000-000000000001",
      "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
      "name": "Avisar si nadie responde en 2 horas",
      "description": "Asigna al equipo de guardia cuando una conversación queda inactiva.",
      "event": "conversation_idle",
      "conditions": {
        "logic": "all",
        "items": [
          {
            "id": "c1",
            "field": "channel",
            "op": "eq",
            "value": "whatsapp"
          }
        ]
      },
      "actions": [
        {
          "id": "a1",
          "type": "assign_team",
          "value": "cccccccc-0000-4000-8000-000000000001"
        }
      ],
      "enabled": true,
      "fire_once_per_conversation": true,
      "stop_after_run": false,
      "duration_hours": 2,
      "run_count": 18,
      "last_run_at": "2026-09-15T18:20:00.000Z",
      "created_at": "2026-01-10T13:00:00.000Z",
      "updated_at": "2026-09-10T13:00:00.000Z"
    }
  ],
  "meta": {
    "total": 1
  }
}

Responde: 200 · 400 · 401 · 403 · 404 · 409 · 429

POST /triggers

Create an automation trigger

Each condition’s op must fit its field’s type — an operator that does not belong to that field is a 400 naming it. event: "conversation_idle" requires duration_hours (1–720); every other event ignores it. enabled defaults to true.

Cuerpo

CampoTipoObligatorioRestricciones
namestringmín. 1, máx. 200
descriptionstring | nullmáx. 2000
eventconversation_created \message_from_customer \conversation_resolved \
conditionsobject
actionsobject[]
enabledboolean
fire_once_per_conversationboolean
stop_after_runboolean
duration_hoursinteger | null≥ 1, ≤ 720
curl -X POST https://api.vitrinadev.com/api/v1/triggers \
  -H "Authorization: Bearer $VITRINA_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Avisar si nadie responde en 2 horas",
    "event": "conversation_idle",
    "duration_hours": 2,
    "actions": [
      {
        "id": "a1",
        "type": "assign_team",
        "value": "cccccccc-0000-4000-8000-000000000001"
      }
    ]
  }'

Ejemplo de respuesta (201)

{
  "data": {
    "id": "d8d8d8d8-0000-4000-8000-000000000001",
    "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
    "name": "Avisar si nadie responde en 2 horas",
    "description": "Asigna al equipo de guardia cuando una conversación queda inactiva.",
    "event": "conversation_idle",
    "conditions": {
      "logic": "all",
      "items": [
        {
          "id": "c1",
          "field": "channel",
          "op": "eq",
          "value": "whatsapp"
        }
      ]
    },
    "actions": [
      {
        "id": "a1",
        "type": "assign_team",
        "value": "cccccccc-0000-4000-8000-000000000001"
      }
    ],
    "enabled": true,
    "fire_once_per_conversation": true,
    "stop_after_run": false,
    "duration_hours": 2,
    "run_count": 18,
    "last_run_at": "2026-09-15T18:20:00.000Z",
    "created_at": "2026-01-10T13:00:00.000Z",
    "updated_at": "2026-09-10T13:00:00.000Z"
  }
}

Responde: 201 · 400 · 401 · 403 · 404 · 409 · 429

DELETE /triggers/{id}

Delete an automation trigger

Stops it from firing again; past runs are not undone.

ParámetroEnTipoObligatorioRestricciones
idpathuuid
curl -X DELETE https://api.vitrinadev.com/api/v1/triggers/<id> \
  -H "Authorization: Bearer $VITRINA_KEY"

Responde: 204 · 400 · 401 · 403 · 404 · 409 · 429

GET /triggers/{id}

Fetch one automation trigger

The full trigger, including its conditions tree and ordered actions list, plus run_count and last_run_at.

ParámetroEnTipoObligatorioRestricciones
idpathuuid
curl https://api.vitrinadev.com/api/v1/triggers/<id> \
  -H "Authorization: Bearer $VITRINA_KEY"

Ejemplo de respuesta (200)

{
  "data": {
    "id": "d8d8d8d8-0000-4000-8000-000000000001",
    "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
    "name": "Avisar si nadie responde en 2 horas",
    "description": "Asigna al equipo de guardia cuando una conversación queda inactiva.",
    "event": "conversation_idle",
    "conditions": {
      "logic": "all",
      "items": [
        {
          "id": "c1",
          "field": "channel",
          "op": "eq",
          "value": "whatsapp"
        }
      ]
    },
    "actions": [
      {
        "id": "a1",
        "type": "assign_team",
        "value": "cccccccc-0000-4000-8000-000000000001"
      }
    ],
    "enabled": true,
    "fire_once_per_conversation": true,
    "stop_after_run": false,
    "duration_hours": 2,
    "run_count": 18,
    "last_run_at": "2026-09-15T18:20:00.000Z",
    "created_at": "2026-01-10T13:00:00.000Z",
    "updated_at": "2026-09-10T13:00:00.000Z"
  }
}

Responde: 200 · 400 · 401 · 403 · 404 · 409 · 429

PUT /triggers/{id}

Update an automation trigger

A PUT that behaves as a PATCH: only the fields present are applied and at least one is required. conditions and actions are each replaced wholesale when sent.

ParámetroEnTipoObligatorioRestricciones
idpathuuid

Cuerpo

CampoTipoObligatorioRestricciones
namestringmín. 1, máx. 200
descriptionstring | nullmáx. 2000
eventconversation_created \message_from_customer \conversation_resolved \
conditionsobject
actionsobject[]
enabledboolean
fire_once_per_conversationboolean
stop_after_runboolean
duration_hoursinteger | null≥ 1, ≤ 720
curl -X PUT https://api.vitrinadev.com/api/v1/triggers/<id> \
  -H "Authorization: Bearer $VITRINA_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "enabled": false
  }'

Ejemplo de respuesta (200)

{
  "data": {
    "id": "d8d8d8d8-0000-4000-8000-000000000001",
    "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
    "name": "Avisar si nadie responde en 2 horas",
    "description": "Asigna al equipo de guardia cuando una conversación queda inactiva.",
    "event": "conversation_idle",
    "conditions": {
      "logic": "all",
      "items": [
        {
          "id": "c1",
          "field": "channel",
          "op": "eq",
          "value": "whatsapp"
        }
      ]
    },
    "actions": [
      {
        "id": "a1",
        "type": "assign_team",
        "value": "cccccccc-0000-4000-8000-000000000001"
      }
    ],
    "enabled": false,
    "fire_once_per_conversation": true,
    "stop_after_run": false,
    "duration_hours": 2,
    "run_count": 18,
    "last_run_at": "2026-09-15T18:20:00.000Z",
    "created_at": "2026-01-10T13:00:00.000Z",
    "updated_at": "2026-09-10T13:00:00.000Z"
  }
}

Responde: 200 · 400 · 401 · 403 · 404 · 409 · 429

En esta página