> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cordialy.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Eventos & Payloads

> JSON completo de cada tipo de evento enviado pelos webhooks da Cordialy

Os exemplos abaixo mostram o corpo completo recebido no seu endpoint (envelope + payload).

***

## `lead.created`

Disparado quando um novo lead entra no sistema via WhatsApp ou API.

```json theme={null}
{
  "event_type": "lead.created",
  "store_id": "uuid-da-loja",
  "occurred_at": "2026-06-20T09:00:00.000Z",
  "payload": {
    "id": "uuid-do-lead",
    "name": "João Silva",
    "customer_phone": "5511999998888",
    "status": "pending",
    "created_at": "2026-06-20T09:00:00.000Z"
  }
}
```

***

## `lead.status_changed`

Disparado quando o status do lead muda.

```json theme={null}
{
  "event_type": "lead.status_changed",
  "store_id": "uuid-da-loja",
  "occurred_at": "2026-06-20T10:30:00.000Z",
  "payload": {
    "id": "uuid-do-lead",
    "status": "converted",
    "previous_status": "in_progress",
    "changed_at": "2026-06-20T10:30:00.000Z"
  }
}
```

| Valores possíveis de `status` / `previous_status` |
| ------------------------------------------------- |
| `pending` · `in_progress` · `converted` · `lost`  |

***

## `message.received`

Disparado quando o lead envia uma mensagem via WhatsApp.

```json theme={null}
{
  "event_type": "message.received",
  "store_id": "uuid-da-loja",
  "occurred_at": "2026-06-20T09:05:00.000Z",
  "payload": {
    "lead_id": "uuid-do-lead",
    "session_id": "uuid-da-sessao",
    "content": "Olá, quero saber o preço",
    "media_type": null,
    "received_at": "2026-06-20T09:05:00.000Z"
  }
}
```

| Campo        | Valores possíveis de `media_type`                         |
| ------------ | --------------------------------------------------------- |
| `media_type` | `null` (texto) · `image` · `audio` · `video` · `document` |

***

## `message.sent`

Disparado quando a IA ou um consultor envia uma mensagem ao lead.

```json theme={null}
{
  "event_type": "message.sent",
  "store_id": "uuid-da-loja",
  "occurred_at": "2026-06-20T09:05:03.000Z",
  "payload": {
    "lead_id": "uuid-do-lead",
    "session_id": "uuid-da-sessao",
    "content": "Olá! O valor é R$ 99/mês.",
    "sent_at": "2026-06-20T09:05:03.000Z"
  }
}
```

***

## `session.started`

Disparado quando uma nova sessão de atendimento é aberta para o lead.

```json theme={null}
{
  "event_type": "session.started",
  "store_id": "uuid-da-loja",
  "occurred_at": "2026-06-20T09:00:00.000Z",
  "payload": {
    "id": "uuid-da-sessao",
    "lead_id": "uuid-do-lead",
    "session_number": 1,
    "channel": "whatsapp_zapi",
    "trigger": "inbound",
    "started_at": "2026-06-20T09:00:00.000Z"
  }
}
```

| Campo     | Valores possíveis                                                 |
| --------- | ----------------------------------------------------------------- |
| `channel` | `whatsapp_zapi` · `whatsapp_meta` · `voice_elevenlabs` · `manual` |
| `trigger` | `inbound` · `followup` · `manual_reopen`                          |

***

## `session.ended`

Disparado quando uma sessão de atendimento é encerrada.

```json theme={null}
{
  "event_type": "session.ended",
  "store_id": "uuid-da-loja",
  "occurred_at": "2026-06-20T14:30:00.000Z",
  "payload": {
    "id": "uuid-da-sessao",
    "lead_id": "uuid-do-lead",
    "session_number": 1,
    "status": "converted",
    "ended_at": "2026-06-20T14:30:00.000Z"
  }
}
```

| Valores possíveis de `status`      |
| ---------------------------------- |
| `converted` · `lost` · `abandoned` |

<Note>
  `abandoned` significa que o lead parou de responder e a sessão foi encerrada por inatividade ou após um follow-up sem retorno.
</Note>

***

## `followup.sent`

Disparado quando um follow-up automático é enviado ao lead.

```json theme={null}
{
  "event_type": "followup.sent",
  "store_id": "uuid-da-loja",
  "occurred_at": "2026-06-21T10:00:00.000Z",
  "payload": {
    "followup_id": "uuid-do-followup",
    "lead_id": "uuid-do-lead",
    "session_id": "uuid-da-sessao",
    "message": "Oi! Ainda tem interesse?",
    "sent_at": "2026-06-21T10:00:00.000Z"
  }
}
```

***

## `appointment.created`

Disparado quando um agendamento é criado para um lead.

```json theme={null}
{
  "event_type": "appointment.created",
  "store_id": "uuid-da-loja",
  "occurred_at": "2026-06-20T11:00:00.000Z",
  "payload": {
    "id": "uuid-do-agendamento",
    "lead_id": "uuid-do-lead",
    "title": "Consulta inicial",
    "scheduled_at": "2026-06-25T15:00:00.000Z",
    "duration_minutes": 60,
    "status": "scheduled"
  }
}
```
