@lionchat/mcp-server 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,378 @@
1
+ # Modelo de Dados LionChat (Detalhado)
2
+
3
+ Mapa completo de entidades, relacionamentos e foreign keys. Use quando precisar entender como dados conectam ou como navegar entre recursos.
4
+
5
+ ## Multi-tenancy: Account
6
+
7
+ `Account` é a raiz. **TODA** entidade tem `account_id` direta ou indiretamente. Nunca há "vazamento" entre contas.
8
+
9
+ ```
10
+ Account
11
+ ├── id (PK)
12
+ ├── name
13
+ ├── plan_id (FK → Plan)
14
+ ├── feature_flags (bigint bitfield)
15
+ ├── feature_flags_2 (bigint bitfield, features 64+)
16
+ ├── usage_limits (jsonb)
17
+ ├── custom_attributes (jsonb)
18
+ ├── domain
19
+ ├── support_email
20
+ └── locale (string, ex: 'pt_BR')
21
+ ```
22
+
23
+ ## Usuários e Permissões
24
+
25
+ ```
26
+ User AccountUser (junction)
27
+ ├── id (PK) ├── id (PK)
28
+ ├── name ├── user_id (FK → User)
29
+ ├── email ├── account_id (FK → Account)
30
+ ├── pubsub_token ├── role (enum: 'agent' | 'administrator')
31
+ ├── ui_settings (jsonb) ├── custom_role_id (FK opcional)
32
+ ├── access_token (has_one) ├── auto_offline (bool)
33
+ └── account_users (has_many) ├── availability (enum)
34
+ ├── active_at
35
+ └── permissions (string[])
36
+ ```
37
+
38
+ **Importante:** o `role` no `AccountUser` é por conta. Mesmo `User` pode ser admin numa conta e agent em outra.
39
+
40
+ ## Canal de Comunicação
41
+
42
+ ```
43
+ Inbox
44
+ ├── id (PK)
45
+ ├── account_id (FK)
46
+ ├── name
47
+ ├── channel_type (string, ex: 'Channel::Waha')
48
+ ├── channel_id (FK polimórfico)
49
+ ├── enable_auto_assignment (bool)
50
+ ├── working_hours_enabled (bool)
51
+ └── greeting_enabled (bool)
52
+
53
+ Channel::Waha / Channel::Whatsapp / Channel::WebWidget / ...
54
+ ├── id (PK, table específica)
55
+ ├── account_id (FK)
56
+ ├── (campos específicos por canal)
57
+ └── has_one :inbox (via Channelable concern)
58
+
59
+ InboxMember (junction Inbox ↔ User)
60
+ ├── inbox_id
61
+ └── user_id
62
+ ```
63
+
64
+ ## Conversação e Mensagens
65
+
66
+ ```
67
+ Conversation
68
+ ├── id (PK, global)
69
+ ├── account_id (FK)
70
+ ├── display_id (visível pra humanos, único por conta)
71
+ ├── inbox_id (FK, optional: pode ser NULL se inbox deletada)
72
+ ├── contact_id (FK → Contact)
73
+ ├── contact_inbox_id (FK → ContactInbox)
74
+ ├── assignee_id (FK → User, optional)
75
+ ├── team_id (FK → Team, optional)
76
+ ├── captain_assistant_id (FK → Captain::Assistant, optional)
77
+ ├── status (int: 0/1/2/3)
78
+ ├── priority (string)
79
+ ├── snoozed_until (datetime, se status=3)
80
+ ├── waiting_since (datetime)
81
+ ├── first_reply_created_at (datetime)
82
+ ├── last_activity_at (datetime)
83
+ ├── custom_attributes (jsonb)
84
+ ├── additional_attributes (jsonb)
85
+ └── labels (via taggings)
86
+
87
+ Message
88
+ ├── id (PK)
89
+ ├── account_id (FK)
90
+ ├── conversation_id (FK)
91
+ ├── inbox_id (FK)
92
+ ├── content (text, nullable)
93
+ ├── message_type (int: 0/1/2/3)
94
+ ├── content_type (string)
95
+ ├── content_attributes (jsonb)
96
+ ├── status (enum: sent/delivered/read/failed/progress)
97
+ ├── source_id (string, ID externo do canal)
98
+ ├── sender_type / sender_id (polimórfico)
99
+ ├── private (bool: nota privada)
100
+ ├── sentiment (jsonb)
101
+ ├── attachments (has_many)
102
+ └── created_at
103
+
104
+ Attachment
105
+ ├── id (PK)
106
+ ├── message_id (FK)
107
+ ├── account_id (FK)
108
+ ├── file_type (string ou int)
109
+ ├── extension
110
+ ├── file (ActiveStorage attached)
111
+ ├── transcribed_text (string, áudio/PDF)
112
+ ├── meta (jsonb, ex: image_description)
113
+ ├── width / height (pixels)
114
+ └── file_size (bytes)
115
+ ```
116
+
117
+ ## Contatos
118
+
119
+ ```
120
+ Contact
121
+ ├── id (PK)
122
+ ├── account_id (FK)
123
+ ├── name
124
+ ├── email
125
+ ├── phone_number (E.164, ex: +5511999999999)
126
+ ├── identifier (ID externo opcional)
127
+ ├── additional_attributes (jsonb)
128
+ ├── custom_attributes (jsonb)
129
+ ├── pubsub_token
130
+ ├── blocked (bool)
131
+ ├── last_activity_at
132
+ └── company_id (FK → Company, optional)
133
+
134
+ ContactInbox (junction Contact ↔ Inbox)
135
+ ├── id (PK)
136
+ ├── contact_id (FK)
137
+ ├── inbox_id (FK)
138
+ ├── source_id (string, ID do contato no canal)
139
+ └── additional_attributes (jsonb, ex: not_on_whatsapp)
140
+
141
+ Company
142
+ ├── id (PK)
143
+ ├── account_id (FK)
144
+ ├── name
145
+ └── domain
146
+ ```
147
+
148
+ **Padrões de `source_id` por canal:**
149
+ - Waha: `5511999999999@c.us` (1-on-1) ou `120363xxx@g.us` (grupo) ou `XXXX@lid` (LID)
150
+ - WhatsApp Cloud: `5511999999999` (E.164 sem prefixo)
151
+ - Email: o email mesmo
152
+ - WebWidget: UUID gerado
153
+
154
+ ## Kanban / CRM
155
+
156
+ ```
157
+ Funnel
158
+ ├── id (PK)
159
+ ├── account_id (FK)
160
+ ├── name
161
+ ├── stages (jsonb: array de { name, color, position })
162
+ ├── archived (bool)
163
+ └── created_at
164
+
165
+ KanbanItem
166
+ ├── id (PK)
167
+ ├── account_id (FK)
168
+ ├── funnel_id (FK)
169
+ ├── funnel_stage (string, nome da etapa atual)
170
+ ├── stage_entered_at (datetime)
171
+ ├── position (int, ordem dentro da etapa)
172
+ ├── conversation_display_id (FK opcional → Conversation.display_id)
173
+ ├── item_details (jsonb)
174
+ ├── custom_attributes (jsonb)
175
+ ├── assigned_agents (jsonb array)
176
+ ├── linked_conversations (jsonb array de { display_id })
177
+ ├── checklist (jsonb)
178
+ ├── activities (jsonb)
179
+ ├── timer_started_at / timer_duration
180
+ └── created_at
181
+
182
+ KanbanChecklist
183
+ ├── kanban_item_id (FK)
184
+ ├── title
185
+ ├── completed (bool)
186
+ └── position
187
+
188
+ KanbanNote
189
+ ├── kanban_item_id (FK)
190
+ ├── content (text)
191
+ └── created_at
192
+ ```
193
+
194
+ ## IA / Captain
195
+
196
+ ```
197
+ Captain::Assistant
198
+ ├── id (PK)
199
+ ├── account_id (FK)
200
+ ├── name
201
+ ├── description
202
+ ├── config (jsonb: model, temperature, instructions, feature_memory, feature_faq, ...)
203
+ ├── guardrails (string[])
204
+ ├── response_guidelines (string[])
205
+ └── active_conversations_count
206
+
207
+ Captain::AssistantResponse (FAQ)
208
+ ├── assistant_id (FK)
209
+ ├── question
210
+ ├── answer
211
+ ├── status (pending/approved/rejected)
212
+ ├── embedding (vector, pgvector)
213
+ └── documentable (polymorphic: Conversation que gerou)
214
+
215
+ Captain::Document (Base de conhecimento)
216
+ ├── assistant_id (FK)
217
+ ├── content (text)
218
+ └── name
219
+
220
+ Captain::CopilotPrompt (Prompts salvos)
221
+ ├── account_id (FK)
222
+ ├── title
223
+ └── prompt (text)
224
+ ```
225
+
226
+ ## Automações
227
+
228
+ ```
229
+ AutomationRule
230
+ ├── id (PK)
231
+ ├── account_id (FK)
232
+ ├── name
233
+ ├── event_name (conversation_created, conversation_resolved, message_created, conversation_opened, conversation_updated)
234
+ ├── conditions (jsonb array)
235
+ ├── actions (jsonb array)
236
+ └── active (bool)
237
+
238
+ Macro
239
+ ├── id (PK)
240
+ ├── account_id (FK)
241
+ ├── name
242
+ ├── actions (jsonb array)
243
+ └── visibility (personal/global)
244
+ ```
245
+
246
+ ## Agenda / Tarefas / Booking
247
+
248
+ ```
249
+ AccountTask (agenda interna)
250
+ ├── id (PK)
251
+ ├── account_id (FK)
252
+ ├── user_id (FK → User, assignee)
253
+ ├── title
254
+ ├── description
255
+ ├── due_at (datetime)
256
+ ├── completed_at (datetime, nullable)
257
+ └── color (string)
258
+
259
+ BookingEventType (template de agendamento)
260
+ ├── id (PK)
261
+ ├── account_id (FK)
262
+ ├── name (ex: "Demo 30min")
263
+ ├── duration_minutes
264
+ ├── availability_rules (jsonb)
265
+ └── description
266
+
267
+ Booking (agendamento confirmado)
268
+ ├── id (PK)
269
+ ├── account_id (FK)
270
+ ├── booking_event_type_id (FK)
271
+ ├── user_id (FK, agente que vai atender)
272
+ ├── attendee_name / attendee_email / attendee_phone
273
+ ├── start_time / end_time (ISO 8601)
274
+ ├── status (scheduled/cancelled/completed)
275
+ └── meeting_url (Google Calendar / Zoom / etc)
276
+ ```
277
+
278
+ ## Relatórios e Métricas
279
+
280
+ ```
281
+ ReportingEvent
282
+ ├── account_id (FK)
283
+ ├── name (conversation_created, conversation_resolved, csat_score, ...)
284
+ ├── value (numeric)
285
+ ├── value_in_business_hours (numeric)
286
+ ├── conversation_id (FK opcional)
287
+ ├── user_id (FK opcional)
288
+ ├── inbox_id (FK opcional)
289
+ └── created_at
290
+
291
+ CsatSurveyResponse
292
+ ├── conversation_id (FK)
293
+ ├── contact_id (FK)
294
+ ├── score (1-5)
295
+ ├── feedback_message
296
+ └── created_at
297
+
298
+ SLA::Policy (políticas de SLA)
299
+ ├── account_id (FK)
300
+ ├── first_response_time_threshold (int, seconds)
301
+ ├── next_response_time_threshold
302
+ ├── resolution_time_threshold
303
+ └── conditions (jsonb)
304
+ ```
305
+
306
+ ## Webhooks / Integrações
307
+
308
+ ```
309
+ Webhook (saída)
310
+ ├── account_id (FK)
311
+ ├── url
312
+ ├── subscriptions (string[]: eventos a notificar)
313
+ └── inbox_id (FK opcional, scope)
314
+
315
+ Integrations::Hook (integrações: OpenAI, Groq, Slack, etc)
316
+ ├── account_id (FK)
317
+ ├── app_id (string: 'openai', 'groq', 'slack', 'dialogflow', ...)
318
+ ├── settings (jsonb: api_key, model, ...)
319
+ ├── status (boolean: ligado/desligado)
320
+ └── reference_id (string opcional)
321
+
322
+ MetaLeadIntegration (Facebook Lead Ads)
323
+ ├── account_id (FK)
324
+ ├── page_id
325
+ ├── page_name
326
+ ├── facebook_page_id (FK polimórfico)
327
+ ├── status (active/token_expired/paused)
328
+ └── meta_lead_forms (has_many)
329
+ ```
330
+
331
+ ## Cardinalidades importantes
332
+
333
+ - `Account` 1—N `User` (via AccountUser)
334
+ - `Account` 1—N `Inbox`
335
+ - `Account` 1—N `Contact`
336
+ - `Account` 1—N `Conversation`
337
+ - `Conversation` 1—N `Message`
338
+ - `Message` 1—N `Attachment`
339
+ - `Contact` 1—N `ContactInbox` (um por canal)
340
+ - `Funnel` 1—N `KanbanItem`
341
+ - `Conversation` 0..1—1 `KanbanItem` (opcional)
342
+ - `Conversation` 0..1—1 `Captain::Assistant` (opcional, via captain_assistant_id)
343
+
344
+ ## Como navegar (queries comuns)
345
+
346
+ ### Conversa → Cliente
347
+ ```
348
+ Conversation → contact_id → Contact
349
+ ```
350
+
351
+ ### Cliente → Todas as conversas
352
+ ```
353
+ Contact → has_many :conversations
354
+ ```
355
+
356
+ ### Mensagem → Conta
357
+ ```
358
+ Message → account_id (direto) OU Message → conversation → account_id
359
+ ```
360
+
361
+ ### Card Kanban → Conversa vinculada
362
+ ```
363
+ KanbanItem → conversation_display_id → Conversation (where display_id = X)
364
+ ```
365
+
366
+ ### Conta → Plano e features
367
+ ```
368
+ Account → plan_id → Plan
369
+ Account.feature_enabled?('captain_v2') # checa bitfield
370
+ ```
371
+
372
+ ## Soft-delete e statuses
373
+
374
+ - Conversation NUNCA é deletada — só muda `status` (snoozed, resolved)
375
+ - Inbox quando deletada → conversations ficam com `inbox_id = NULL` (dependent: :nullify)
376
+ - Contact pode ser deletado (raro) — destroi conversations em cascata (cuidado)
377
+ - KanbanItem pode ser deletado livremente
378
+ - Funnel `archived = true` → não aparece na UI mas dados permanecem
@@ -0,0 +1,242 @@
1
+ # Glossário LionChat
2
+
3
+ Glossário completo de termos, status codes, enums e conceitos da plataforma. Use como referência sempre que encontrar um campo numérico ou enum desconhecido na resposta de qualquer endpoint.
4
+
5
+ ## Conversation (Conversa)
6
+
7
+ ### `status` — Estado da conversa
8
+ | Valor | Nome | Significado |
9
+ |---|---|---|
10
+ | `0` | `open` | Aberta — em atendimento ativo |
11
+ | `1` | `resolved` | Resolvida — encerrada como sucesso |
12
+ | `2` | `pending` | Pendente — aguardando alguém (cliente ou agente) |
13
+ | `3` | `snoozed` | Adiada — voltará a aparecer em data futura (`snoozed_until`) |
14
+
15
+ ### `priority` — Prioridade
16
+ | Valor | Significado |
17
+ |---|---|
18
+ | `urgent` | Urgente — atender o quanto antes |
19
+ | `high` | Alta |
20
+ | `medium` | Média |
21
+ | `low` | Baixa |
22
+ | `null` | Sem prioridade definida |
23
+
24
+ ### `assignee_type` (parâmetro de listagem)
25
+ | Valor | Filtro aplicado |
26
+ |---|---|
27
+ | `me` | Conversas atribuídas ao usuário autenticado |
28
+ | `assigned` | Conversas com qualquer agente atribuído |
29
+ | `unassigned` | Conversas sem agente |
30
+ | `all` | Todas (sem filtro) |
31
+
32
+ ### Campos importantes
33
+ - `display_id`: número visível na UI (use ao falar com humanos: "conversa #245")
34
+ - `id`: ID interno (use em parâmetros de outras chamadas)
35
+ - `last_activity_at`: Unix timestamp (segundos) da última atividade
36
+ - `waiting_since`: Unix timestamp (segundos) — desde quando aguarda resposta
37
+ - `first_reply_created_at`: Unix timestamp da primeira resposta humana (`null` se nunca respondida)
38
+ - `captain_assistant_id`: FK pro AI Agente (`null` = atendimento humano)
39
+ - `custom_attributes.captain_manually_disabled`: `true` se admin desativou a IA explicitamente
40
+
41
+ ## Message (Mensagem)
42
+
43
+ ### `message_type`
44
+ | Valor | Nome | Significado |
45
+ |---|---|---|
46
+ | `0` | `incoming` | Cliente → empresa (recebida) |
47
+ | `1` | `outgoing` | Empresa → cliente (enviada) |
48
+ | `2` | `activity` | Evento de sistema (atribuições, ativações IA, mudanças de status) |
49
+ | `3` | `template` | Template aprovado WhatsApp Cloud API |
50
+
51
+ ### `status` (mensagens outgoing)
52
+ | Valor | Significado |
53
+ |---|---|
54
+ | `sent` | Enviada com sucesso |
55
+ | `delivered` | Entregue ao destinatário |
56
+ | `read` | Lida pelo destinatário |
57
+ | `failed` | Falha no envio |
58
+ | `progress` | Em processamento |
59
+
60
+ ### `content_type`
61
+ - `text`: texto puro
62
+ - `input_select`: pergunta com opções (formulários do widget)
63
+ - `cards`: cards interativos
64
+ - `form`: formulário
65
+ - `article`: artigo da central de ajuda
66
+
67
+ ### Campos importantes
68
+ - `content`: texto da mensagem (pode ser `null` se for só anexo)
69
+ - `attachments[]`: array de anexos (image, audio, video, file, location, contact)
70
+ - `private`: `true` = nota privada (só visível pra equipe, não pro cliente)
71
+ - `sender_type`: `User`, `Contact`, `Captain::Assistant`, `AgentBot`
72
+ - `processed_message_content`: texto após processamento (com markdown removido, links resolvidos)
73
+
74
+ ## Attachment (Anexo)
75
+
76
+ ### `file_type`
77
+ | Valor | Conteúdo |
78
+ |---|---|
79
+ | `image` | Foto / imagem (JPG, PNG, etc) |
80
+ | `audio` | Áudio (geralmente vem com `transcribed_text` preenchido) |
81
+ | `video` | Vídeo |
82
+ | `file` | PDF, DOCX, qualquer outro (pode vir com `extracted_text` se for processado) |
83
+ | `location` | Coordenadas GPS |
84
+ | `contact` | vCard |
85
+ | `share` | Link compartilhado |
86
+ | `story_mention` | Menção em story (Instagram) |
87
+ | `fallback` | Fallback de tipo não-reconhecido |
88
+
89
+ ### Campos importantes
90
+ - `data_url`: URL pra baixar o arquivo (válida por tempo limitado)
91
+ - `transcribed_text`: transcrição (áudio) ou texto extraído (PDF/imagem com OCR)
92
+ - `meta.image_description`: descrição gerada pela IA (cache, se disponível)
93
+ - `file_size`: bytes
94
+ - `width`/`height`: pixels (imagens/vídeos)
95
+
96
+ ## Contact (Contato)
97
+
98
+ ### Campos importantes
99
+ - `id`: ID interno
100
+ - `identifier`: ID externo configurado pelo cliente (ex: ID interno do CRM dele)
101
+ - `phone_number`: E.164 obrigatoriamente (`+5511999999999`)
102
+ - `email`: opcional
103
+ - `name`: nome completo
104
+ - `additional_attributes`: hash de campos do sistema (não-editáveis)
105
+ - `custom_attributes`: hash de campos custom (editáveis, definidos pela conta)
106
+
107
+ ### ContactInbox (vínculo Contato ↔ Inbox)
108
+ - `source_id`: ID do contato no canal (ex: `5511999999999@c.us` no WhatsApp WAHA)
109
+ - Um contato pode ter vários ContactInboxes (um por canal)
110
+
111
+ ## Inbox (Caixa de Entrada / Canal)
112
+
113
+ ### `channel_type`
114
+ - `Channel::Waha` — WhatsApp via WAHA (não-oficial, QR code)
115
+ - `Channel::Whatsapp` — WhatsApp Cloud API (oficial)
116
+ - `Channel::WebWidget` — chat ao vivo no site
117
+ - `Channel::Email` — email
118
+ - `Channel::FacebookPage` — Messenger
119
+ - `Channel::Instagram` — Instagram DM
120
+ - `Channel::Telegram` — Telegram
121
+ - `Channel::Api` — webhook custom
122
+ - `Channel::Voice` — VoIP / chamadas
123
+
124
+ ### Campos importantes
125
+ - `id`: ID interno
126
+ - `name`: nome configurado pelo admin
127
+ - `channel_id`: FK pro canal polimórfico
128
+ - `enable_auto_assignment`: se está atribuindo automaticamente
129
+ - `working_hours_enabled`: se respeita horário de atendimento
130
+ - `greeting_enabled` / `greeting_message`: mensagem de boas-vindas
131
+
132
+ ## KanbanItem (Card do CRM)
133
+
134
+ ### Estrutura
135
+ - `id`: ID interno
136
+ - `conversation_display_id`: vinculação opcional com Conversa
137
+ - `funnel_id`: FK pro Funnel (funil)
138
+ - `funnel_stage`: nome da etapa atual (string)
139
+ - `position`: ordem dentro da etapa (inteiro)
140
+ - `stage_entered_at`: timestamp de quando entrou na etapa atual
141
+
142
+ ### `item_details` (jsonb)
143
+ ```json
144
+ {
145
+ "title": "Negociação Empresa X",
146
+ "value": 5000.0,
147
+ "priority": "high",
148
+ "description": "...",
149
+ "notes": [{ "text": "..." }],
150
+ "offers": [{ "offer_id": 3 }],
151
+ "custom_attributes": { ... }
152
+ }
153
+ ```
154
+
155
+ ### `assigned_agents` (jsonb array)
156
+ ```json
157
+ [{ "id": 6, "name": "Elvis", "email": "...", "assigned_at": "..." }]
158
+ ```
159
+
160
+ ## Funnel (Funil do Kanban)
161
+
162
+ - `name`: nome do funil
163
+ - `stages`: array de etapas — cada uma com `name`, `color`, `position`
164
+ - `archived`: `true` = não aparece na UI principal
165
+
166
+ ## Captain::Assistant (AI Agente / IA de atendimento)
167
+
168
+ - `id`: ID interno
169
+ - `name`: nome do agente (ex: "Luna", "Diogo")
170
+ - `config.feature_memory`: gera notas no contato ao resolver conversas
171
+ - `config.feature_faq`: gera FAQs sugeridas ao resolver conversas
172
+ - `config.model`: modelo OpenAI usado (gpt-4o, gpt-4o-mini)
173
+ - `config.temperature`: 0.0-1.0
174
+ - `config.instructions`: prompt sistema (Liquid template)
175
+
176
+ ## Account (Conta)
177
+
178
+ - `id`: ID interno (NÃO é o ID da empresa cliente — é o ID interno do LionChat)
179
+ - `name`: nome da empresa
180
+ - `plan_id`: FK pro Plan (qual plano assinou)
181
+ - `feature_flags`: bigint bitfield com features ativas
182
+ - `usage_limits`: hash de limites do plano + uso atual
183
+ - `custom_attributes`: dados livres da conta
184
+
185
+ ## AccountUser (User dentro de uma Account)
186
+
187
+ - `user_id` + `account_id`: chave composta
188
+ - `role`: `agent` (atendente) ou `administrator` (admin/dono)
189
+ - `availability`: `online`, `busy`, `offline`
190
+ - `permissions`: array de strings com permissões granulares
191
+
192
+ ## AutomationRule (Regra de automação)
193
+
194
+ - `event_name`: `conversation_created`, `conversation_resolved`, `message_created`, etc
195
+ - `conditions`: jsonb array de condições
196
+ - `actions`: jsonb array de ações
197
+ - `active`: `true` = rodando
198
+
199
+ ## Booking (Agendamento)
200
+
201
+ - `event_type_id`: FK pro tipo de evento (ex: "Demo 30min")
202
+ - `attendee_email`, `attendee_name`, `attendee_phone`
203
+ - `start_time`, `end_time`: ISO 8601
204
+ - `status`: `scheduled`, `cancelled`, `completed`
205
+
206
+ ## Métricas (Reports)
207
+
208
+ ### Endpoints `lionchat_reports_*` retornam métricas em SEGUNDOS por padrão
209
+
210
+ - `avg_first_response_time`: tempo médio em segundos até primeira resposta humana
211
+ - `avg_resolution_time`: tempo médio em segundos até resolução
212
+ - `conversations_count`: contagem absoluta
213
+ - `incoming_messages_count`: contagem absoluta
214
+ - `outgoing_messages_count`: contagem absoluta
215
+ - `resolutions_count`: contagem absoluta
216
+
217
+ ### CSAT
218
+ - `score`: 1 a 5 (estrelas) ou `csat_survey_response_at` (Unix ts)
219
+ - `feedback_message`: texto opcional
220
+
221
+ ### SLA
222
+ - `breach_count`: quantas SLAs estouraram
223
+ - `hit_count`: quantas foram cumpridas
224
+ - `due_at`: timestamp da SLA aplicada
225
+
226
+ ## Resumo de unidades
227
+
228
+ | Métrica | Unidade |
229
+ |---|---|
230
+ | Tempo (avg_*_time) | **segundos** (converta pra min/h ao exibir) |
231
+ | Datas | ISO 8601 ou Unix timestamp (segundos) |
232
+ | Valores (KanbanItem.value) | Reais (BRL) por padrão, mas `value` é só numeric |
233
+ | Coordenadas (location) | latitude/longitude decimais |
234
+ | File size | bytes |
235
+ | Pixels | inteiros |
236
+
237
+ ## Diferença entre `id` e `display_id`
238
+
239
+ - `id`: **sempre use** ao passar pra outras chamadas API
240
+ - `display_id`: **sempre use** ao falar com humanos ("conversa #245", "card #12")
241
+ - Pra Conversation: `id` global, `display_id` por conta (mais amigável)
242
+ - Pra Contact, Inbox, etc: só `id` (não tem display_id separado)