VitrinaAPI

Resumen semanal

La configuración del resumen de los lunes: día y hora de envío, canales (correo y WhatsApp, que se activa por separado), destinatarios y el estado de las plantillas de WhatsApp.

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.

MétodoRutaQué hace
GET/digest/configGet the Monday-digest configuration
PUT/digest/configUpdate the Monday-digest configuration

GET /digest/config

Get the Monday-digest configuration

The tenant's digest config (created with its defaults — enabled, Monday 08:00 America/Santiago, email on, WhatsApp OFF — on first read if no row exists yet; WhatsApp sends cost money, so an admin opts in with whatsapp_enabled: true, which submits the summary templates to Meta) alongside the RESOLVED recipient list: one entry per active workspace member, with their effective variant(s) (owner/seller), per-channel eligibility, opt-out state and normalized phone (or a skip reason when none is usable). A member with no explicit override shows the role-derived default (source: "role_default"); one who has been customized shows source: "explicit". whatsapp_templates reports the WhatsApp templates: status is off | no_whatsapp | pending | ready | attention | unknown, with one templates[] row per (entry owner|seller, number) carrying state (missing|pending|approved|rejected|blocked) and rejection_reason.

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

Ejemplo de respuesta (200)

{
  "data": {
    "config": {
      "id": "d1d1d1d1-0000-4000-8000-000000000001",
      "tenant_id": "20000000-0000-4000-8000-000000000002",
      "enabled": true,
      "send_weekday": 1,
      "send_hour": 8,
      "send_minute": 0,
      "timezone": "America/Santiago",
      "whatsapp_enabled": false,
      "email_enabled": true,
      "enabled_at": "2026-10-15T12:00:00.000Z",
      "created_at": "2026-10-15T12:00:00.000Z",
      "updated_at": "2026-10-15T12:00:00.000Z"
    },
    "recipients": [
      {
        "user_id": "20000000-0000-4000-8000-000000000001",
        "variants": [
          "owner"
        ],
        "whatsapp_enabled": true,
        "email_enabled": true,
        "opted_out": false,
        "phone_e164": "+56911111111",
        "phone_skip_reason": null,
        "source": "role_default"
      }
    ],
    "whatsapp_templates": {
      "status": "off",
      "templates": []
    }
  }
}

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

PUT /digest/config

Update the Monday-digest configuration

A PUT that behaves as a PATCH: only the fields present are applied. recipients, if present, is a batch of per-user overrides applied in the SAME request — each entry upserts the explicit digest_recipient row for that user_id (creating it on first customization), so a settings page can save the schedule and the roster edits together. opted_out: true opts a recipient out (same effect as them clicking the signed email link); opted_out: false clears a prior opt-out. Returns the same shape as the GET.

Cuerpo

CampoTipoObligatorioRestricciones
enabledboolean—
send_weekdayinteger—≥ 1, ≤ 7
send_hourinteger—≥ 0, ≤ 23
send_minuteinteger—≥ 0, ≤ 59
timezonestring—mín. 1, máx. 64
whatsapp_enabledboolean—
email_enabledboolean—
recipientsobject[]—
curl -X PUT https://api.vitrinadev.com/api/v1/digest/config \
  -H "Authorization: Bearer $VITRINA_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "whatsapp_enabled": true
  }'

Ejemplo de respuesta (200)

{
  "data": {
    "config": {
      "id": "d1d1d1d1-0000-4000-8000-000000000001",
      "tenant_id": "20000000-0000-4000-8000-000000000002",
      "enabled": true,
      "send_weekday": 1,
      "send_hour": 8,
      "send_minute": 0,
      "timezone": "America/Santiago",
      "whatsapp_enabled": true,
      "email_enabled": true,
      "enabled_at": "2026-10-15T12:00:00.000Z",
      "created_at": "2026-10-15T12:00:00.000Z",
      "updated_at": "2026-10-15T12:00:00.000Z"
    },
    "recipients": [
      {
        "user_id": "20000000-0000-4000-8000-000000000001",
        "variants": [
          "owner"
        ],
        "whatsapp_enabled": true,
        "email_enabled": true,
        "opted_out": false,
        "phone_e164": "+56911111111",
        "phone_skip_reason": null,
        "source": "role_default"
      }
    ],
    "whatsapp_templates": {
      "status": "pending",
      "templates": [
        {
          "entry": "owner",
          "messaging_account_id": "a1a1a1a1-0000-4000-8000-000000000001",
          "name": "resumen_semanal_v2",
          "state": "pending",
          "rejection_reason": null
        },
        {
          "entry": "seller",
          "messaging_account_id": "a1a1a1a1-0000-4000-8000-000000000001",
          "name": "resumen_vendedor_v2",
          "state": "pending",
          "rejection_reason": null
        }
      ]
    }
  }
}

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

En esta página