@lionchat/mcp-server 0.3.0 → 0.3.1
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.
- package/dist/docs/prompts/inactive_contacts.json +23 -0
- package/dist/docs/prompts/quality_audit.json +28 -0
- package/dist/docs/prompts/team_load_balance.json +18 -0
- package/dist/docs/prompts/whatsapp_template_usage.json +18 -0
- package/dist/docs/resources/best-practices.md +166 -0
- package/dist/docs/resources/conversation-flows.md +208 -0
- package/dist/docs/resources/kanban-deep-dive.md +295 -0
- package/dist/docs/resources/troubleshooting.md +248 -0
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/resources.js +24 -0
- package/dist/resources.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "inactive_contacts",
|
|
3
|
+
"title": "Contatos Inativos pra Reativação",
|
|
4
|
+
"description": "Identifica contatos sem interação há um tempo determinado, com sugestões de abordagem pra reativação.",
|
|
5
|
+
"arguments": [
|
|
6
|
+
{
|
|
7
|
+
"name": "days_inactive",
|
|
8
|
+
"description": "Dias sem interação (padrão: 30)",
|
|
9
|
+
"required": false
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "min_past_conversations",
|
|
13
|
+
"description": "Mínimo de conversas anteriores pra considerar (padrão: 1)",
|
|
14
|
+
"required": false
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"name": "exclude_labels",
|
|
18
|
+
"description": "Labels pra excluir, separadas por vírgula (ex: 'spam,bot')",
|
|
19
|
+
"required": false
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"template": "Identifique contatos da conta que estão inativos há {{days_inactive|30}} dias ou mais.\n\nCritérios:\n- Tiveram pelo menos {{min_past_conversations|1}} conversa(s) anteriormente (mostra que já são leads ativos, não desconhecidos)\n- Última conversa marcada como `resolved` ou sem mensagens novas há {{days_inactive|30}}+ dias\n- Excluir contatos com labels: {{exclude_labels|none}}\n\nPra cada contato encontrado:\n1. Nome, telefone/email\n2. Última conversa (data, motivo do contato anterior se possível inferir)\n3. Canal favorito de contato (WhatsApp, Email, etc)\n4. Sugestão de abordagem personalizada:\n - Se foi cliente: \"como pode ter ido com X que você comprou?\"\n - Se foi lead frio: \"vimos seu interesse em Y, ainda faz sentido?\"\n - Se foi pós-venda: \"vamos renovar?\" / \"feedback?\"\n\nApresentar no formato:\n- Resumo: X contatos identificados\n- Top 10 mais relevantes (priorizar valor histórico, segmento alto, label 'cliente')\n- Sugestão de mensagem template pra reativação em massa (se o usuário quiser, podemos criar campanha)"
|
|
23
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "quality_audit",
|
|
3
|
+
"title": "Auditoria de Qualidade do Atendimento",
|
|
4
|
+
"description": "Audita aleatoriamente conversas resolvidas pra checar qualidade: tempo de resposta, tom, resolução, follow-up.",
|
|
5
|
+
"arguments": [
|
|
6
|
+
{
|
|
7
|
+
"name": "period_days",
|
|
8
|
+
"description": "Quantos dias atrás analisar (padrão: 7)",
|
|
9
|
+
"required": false
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "sample_size",
|
|
13
|
+
"description": "Quantidade de conversas pra amostrar (padrão: 20)",
|
|
14
|
+
"required": false
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"name": "agent_id",
|
|
18
|
+
"description": "Auditar agente específico (opcional)",
|
|
19
|
+
"required": false
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"name": "inbox_id",
|
|
23
|
+
"description": "Auditar inbox específica (opcional)",
|
|
24
|
+
"required": false
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"template": "Faça uma auditoria de qualidade do atendimento nos últimos {{period_days|7}} dias.\n\nFiltros opcionais:\n- Agente: {{agent_id|todos}}\n- Inbox: {{inbox_id|todas}}\n\nAmostrar {{sample_size|20}} conversas RESOLVIDAS aleatoriamente desse período.\n\nPra cada conversa analisar:\n\n### Métricas Quantitativas\n- Tempo da primeira resposta (em minutos)\n- Tempo total de resolução\n- Número de mensagens trocadas\n- CSAT (se houver)\n- Foi reaberta depois? (indicador de problema mal resolvido)\n\n### Análise Qualitativa\n- Tom adequado? (formal/informal alinhado ao canal)\n- Cliente foi cumprimentado adequadamente?\n- Problema foi entendido na primeira interação?\n- Resposta foi clara e resolveu o problema?\n- Houve follow-up ou despedida adequada?\n- Erros gramaticais ou de português?\n\n### Red Flags a destacar\n- Tempo de primeira resposta > 30 min em horário comercial\n- Mais de 10 mensagens pra resolver questão simples\n- Resolução sem confirmação do cliente\n- Mensagens automáticas/copy-paste óbvios sem personalização\n- Tom inadequado (rude, robótico, condescendente)\n\n### Output\n\n## Sumário\n- Conversas auditadas: X\n- Qualidade Geral (1-10): Y\n- Tempo médio de primeira resposta\n- Taxa de reabertura\n\n## Top Problemas Encontrados\n(3-5 padrões recorrentes, com exemplos)\n\n## Top Boas Práticas Identificadas\n(2-3 exemplos pra replicar)\n\n## Recomendações\n- Treinamento focado em: ...\n- Templates de resposta padronizados pra: ...\n- Automações sugeridas: ...\n\nNão expor nomes de agentes em críticas públicas — apenas IDs em report interno."
|
|
28
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "team_load_balance",
|
|
3
|
+
"title": "Carga e Balanceamento da Equipe",
|
|
4
|
+
"description": "Analisa distribuição de conversas entre agentes, identifica sobrecarregados e subutilizados.",
|
|
5
|
+
"arguments": [
|
|
6
|
+
{
|
|
7
|
+
"name": "period",
|
|
8
|
+
"description": "Período de análise: today, week, month (padrão: week)",
|
|
9
|
+
"required": false
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "team_id",
|
|
13
|
+
"description": "ID do time específico (opcional, se omitir analisa todos)",
|
|
14
|
+
"required": false
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"template": "Analise a carga de trabalho da equipe no período: {{period|week}}.\n\n{{team_id|Para todos os times.}}\nFiltrar por team_id={{team_id}} se especificado.\n\nDados a coletar pra cada agente:\n1. Conversas atribuídas (open + pending)\n2. Conversas resolvidas no período\n3. Tempo médio de primeira resposta\n4. Tempo médio de resolução\n5. % de conversas com CSAT (se houver)\n6. Status atual: online / offline / busy\n\nApresentar:\n\n## Visão Geral\n- Total de conversas ativas\n- Agentes online vs offline\n- Conversas sem atribuição (backlog)\n\n## Distribuição por Agente (tabela)\n| Agente | Ativas | Resolvidas | T. Resposta | T. Resolução | Status |\n\n## Identificar:\n- **Sobrecarregados**: > 1.5x média de conversas ativas → risco de queda na qualidade\n- **Subutilizados**: < 0.5x média → podem absorver mais\n- **Agentes offline com conversas pendentes**: redistribuir urgente\n- **Conversas órfãs**: sem assignee há > 1h → atribuir agora\n\n## Recomendações de ação\n- Lista de conversas pra reatribuir (com de → para)\n- Sugestão de revisão de assignment policy se houver desbalanceamento crônico\n- Conversas que talvez devam ser fechadas (sem resposta do cliente há > 7 dias)\n\nFinalizar perguntando se o usuário quer aplicar as redistribuições sugeridas."
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "whatsapp_template_usage",
|
|
3
|
+
"title": "Uso e Performance de Templates WhatsApp",
|
|
4
|
+
"description": "Analisa quais templates WhatsApp estão sendo mais usados, eficácia, e templates aprovados mas sem uso.",
|
|
5
|
+
"arguments": [
|
|
6
|
+
{
|
|
7
|
+
"name": "inbox_id",
|
|
8
|
+
"description": "ID da inbox WhatsApp pra analisar (opcional, padrão: todas)",
|
|
9
|
+
"required": false
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "period_days",
|
|
13
|
+
"description": "Período em dias (padrão: 30)",
|
|
14
|
+
"required": false
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"template": "Analise o uso de templates WhatsApp Business nos últimos {{period_days|30}} dias.\n\nInbox: {{inbox_id|todas as inboxes WhatsApp Cloud}}\n\nDados a levantar:\n\n## 1. Inventário de Templates\n- Total de templates aprovados (status: APPROVED)\n- Pendentes de aprovação (PENDING)\n- Rejeitados (REJECTED) — listar motivos\n- Templates por categoria (UTILITY, MARKETING, AUTHENTICATION)\n- Templates por idioma\n\n## 2. Uso no Período\nPra cada template usado:\n- Nome do template\n- Quantas vezes foi enviado\n- Quantas conversas geraram resposta dentro de 24h\n- Taxa de resposta (% que responderam)\n- Taxa de conversão (se for marketing — virou venda/lead qualificado?)\n\n## 3. Templates Inativos\nListar templates aprovados HÁ MAIS DE 30 DIAS que NÃO foram usados no período.\n- Por quê? Esquecidos? Substituídos por novo?\n- Sugestão: arquivar / atualizar / promover uso\n\n## 4. Performance dos Top Templates\nTop 5 mais enviados — analisar:\n- Texto do template\n- Taxa de resposta\n- Tempo médio até resposta\n- Tem variáveis personalizadas? ({{nome}}, etc)\n- Categoria correta? (errar categoria = risco de banimento)\n\n## 5. Red Flags\n- Templates marketing sendo usados em janela 24h (deveriam ser utility)\n- Templates rejeitados não removidos\n- Templates aprovados há > 90 dias e nunca usados\n- Templates duplicados (mesma intenção, várias versões)\n\n## Recomendações\n- Templates a criar (gap identificado)\n- Templates a remover (desuso ou redundância)\n- Templates a otimizar (baixa conversão)\n- Sugestão de A/B test entre 2 versões de um mesmo template\n\nFinalizar com sugestão de criar nova campanha usando o template com melhor performance."
|
|
18
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# Boas Práticas — Uso Eficiente do MCP
|
|
2
|
+
|
|
3
|
+
Como usar o MCP do LionChat sem desperdiçar tokens, sem cair em rate limits, e com respostas precisas.
|
|
4
|
+
|
|
5
|
+
## Princípio geral: liste resumido, leia detalhado quando precisar
|
|
6
|
+
|
|
7
|
+
Errado: pegar TODAS conversas + TODAS mensagens de cada uma logo de cara.
|
|
8
|
+
|
|
9
|
+
Certo:
|
|
10
|
+
1. `conversations_list` com filtros e `page=1` (paginado) → vê IDs + última mensagem
|
|
11
|
+
2. Identifica candidatas (5-10 conversas)
|
|
12
|
+
3. `conversations_messages_list` SÓ para as relevantes
|
|
13
|
+
|
|
14
|
+
Resultado: 10x menos tokens.
|
|
15
|
+
|
|
16
|
+
## Use filtros sempre que possível
|
|
17
|
+
|
|
18
|
+
A maioria dos endpoints aceita parâmetros pra filtrar antes de retornar:
|
|
19
|
+
|
|
20
|
+
| Endpoint | Filtros úteis |
|
|
21
|
+
|---|---|
|
|
22
|
+
| `conversations_list` | `status` (open/resolved), `assignee_type`, `inbox_id`, `team_id`, `labels`, `q` (busca) |
|
|
23
|
+
| `contacts_list` | `q` (nome/email/telefone), `include_contact_inboxes` |
|
|
24
|
+
| `messages_search` | `q`, `conversation_id`, `before`, `after` |
|
|
25
|
+
| `kanban_items_list` | `funnel_id`, `funnel_stage`, `assigned_agent_id` |
|
|
26
|
+
| `reports_list_*` | `since`, `until`, `metric`, `type` |
|
|
27
|
+
|
|
28
|
+
**Dica:** sempre filtre por período (`since`/`until`) em relatórios — sem isso pode trazer anos de histórico.
|
|
29
|
+
|
|
30
|
+
## Paginação
|
|
31
|
+
|
|
32
|
+
Endpoints listáveis paginam em geral 25 itens. Use `page` parameter:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
page=1 → primeiros 25
|
|
36
|
+
page=2 → próximos 25
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Pra contar total, use `meta.total_count` (vem no response). Não tente "paginar até zerar" se já tem o total — pode ser milhões.
|
|
40
|
+
|
|
41
|
+
## Cache local mental
|
|
42
|
+
|
|
43
|
+
Quando ler dados que provavelmente não mudam na sessão:
|
|
44
|
+
- Lista de inboxes
|
|
45
|
+
- Lista de agentes
|
|
46
|
+
- Lista de times
|
|
47
|
+
- Custom attribute definitions
|
|
48
|
+
- Funnels
|
|
49
|
+
|
|
50
|
+
Faça UMA chamada e use a info por toda a conversa. NÃO refaça `agents_list` 10x.
|
|
51
|
+
|
|
52
|
+
## Use endpoints específicos > endpoints genéricos
|
|
53
|
+
|
|
54
|
+
Quando existir endpoint específico, prefira:
|
|
55
|
+
|
|
56
|
+
| Errado | Certo |
|
|
57
|
+
|---|---|
|
|
58
|
+
| `reports_list` filtrando manualmente | `reports_list_2` (já é "conversations_metrics") |
|
|
59
|
+
| `conversations_list` + filtro de unread no cliente | `conversations_list` com `assignee_type=me&status=open` |
|
|
60
|
+
| `messages_list` percorrendo conversas | `conversations_messages_search` com `q=...` |
|
|
61
|
+
|
|
62
|
+
## Economia em conversas com muitas mensagens
|
|
63
|
+
|
|
64
|
+
Conversa com 200 mensagens? **Não baixe tudo**:
|
|
65
|
+
|
|
66
|
+
1. `conversations_show` (1 chamada) → metadata + última mensagem
|
|
67
|
+
2. Se precisa contexto: pegue só as últimas 20-30 mensagens com `before` ou `page`
|
|
68
|
+
3. Pra análise completa, use `conversations_transcript` (formato condensado)
|
|
69
|
+
|
|
70
|
+
## Operações em massa
|
|
71
|
+
|
|
72
|
+
Pra atribuir labels, mover cards, etc em vários itens:
|
|
73
|
+
- `kanban_bulk_bulk_actions` (cards Kanban)
|
|
74
|
+
- `kanban_items_kanban_agents_create` em massa (passar array)
|
|
75
|
+
- `automation_rules_*` (criar regras em vez de fazer manualmente)
|
|
76
|
+
|
|
77
|
+
NÃO faça 50 PATCH requests individuais — bate rate limit.
|
|
78
|
+
|
|
79
|
+
## Rate limiting
|
|
80
|
+
|
|
81
|
+
LionChat tem rate limit por API token. Limites típicos:
|
|
82
|
+
- ~500 req/min para read
|
|
83
|
+
- ~100 req/min para write
|
|
84
|
+
|
|
85
|
+
Se receber `429 Too Many Requests`:
|
|
86
|
+
- Espere o `Retry-After` header
|
|
87
|
+
- Reduza concorrência
|
|
88
|
+
- Reavalie estratégia (provavelmente está fazendo loop ineficiente)
|
|
89
|
+
|
|
90
|
+
## Quando NÃO usar IA pra escrever mensagens
|
|
91
|
+
|
|
92
|
+
- Mensagens de cobrança / financeiras → use templates aprovados
|
|
93
|
+
- Confirmação de venda → template + variáveis
|
|
94
|
+
- Comunicação legal → revisão humana obrigatória
|
|
95
|
+
|
|
96
|
+
IA é boa pra: triagem, classificação, resumo, sugestão de resposta, análise.
|
|
97
|
+
|
|
98
|
+
## Variáveis de conta (account_variables)
|
|
99
|
+
|
|
100
|
+
Pra dados que se repetem (slogans, endereços, horários):
|
|
101
|
+
- `account_variables_create` UMA vez
|
|
102
|
+
- Use em templates com `{{slogan}}`, `{{endereco}}`
|
|
103
|
+
- Atualiza UMA vez, propaga pra todo lugar
|
|
104
|
+
|
|
105
|
+
Nunca hard-code esses dados em respostas geradas.
|
|
106
|
+
|
|
107
|
+
## Status codes a respeitar
|
|
108
|
+
|
|
109
|
+
| Code | O que fazer |
|
|
110
|
+
|---|---|
|
|
111
|
+
| 200/201 | OK, processar resposta |
|
|
112
|
+
| 204 | OK, sem corpo (típico de DELETE) |
|
|
113
|
+
| 400 | Erro de input — leia mensagem e ajuste |
|
|
114
|
+
| 401 | Token inválido/expirado — NÃO retry |
|
|
115
|
+
| 403 | Sem permissão — não tente bypass |
|
|
116
|
+
| 404 | Recurso não existe — talvez foi deletado |
|
|
117
|
+
| 422 | Validação falhou — leia errors[] |
|
|
118
|
+
| 429 | Rate limited — espere e retry |
|
|
119
|
+
| 500/502/503 | Servidor — retry 1-2x com backoff |
|
|
120
|
+
|
|
121
|
+
## Ordem de operações típicas
|
|
122
|
+
|
|
123
|
+
### "Buscar todas conversas de um cliente específico"
|
|
124
|
+
1. `contacts_search` com `q=email` → pega contact_id
|
|
125
|
+
2. `contacts_show` com `include=conversations` OU
|
|
126
|
+
3. Filter conversations: `conversations_list` com `q=email`
|
|
127
|
+
|
|
128
|
+
### "Criar um card Kanban a partir de uma conversa"
|
|
129
|
+
1. `funnels_list` → pegar funnel_id certo
|
|
130
|
+
2. `kanban_items_create` com `funnel_id`, `funnel_stage` (geralmente primeira etapa), `conversation_display_id`
|
|
131
|
+
3. Opcional: `item_details.value`, `assigned_agents`
|
|
132
|
+
|
|
133
|
+
### "Resumir performance da equipe na semana"
|
|
134
|
+
1. `agents_list` → IDs dos agentes
|
|
135
|
+
2. `reports_list_*` (agent_overview) com `since=7d_ago`, `until=now`
|
|
136
|
+
3. Sintetize: agente X com Y resoluções, tempo médio Z
|
|
137
|
+
|
|
138
|
+
## Cuidados com tools de criação
|
|
139
|
+
|
|
140
|
+
Endpoints `create_*` modificam dados reais. Antes de chamar:
|
|
141
|
+
- Confirme com usuário (se inicialmente pediu "ver", não "fazer")
|
|
142
|
+
- Verifique se o recurso já existe (evite duplicatas)
|
|
143
|
+
- Use `dry_run` quando disponível
|
|
144
|
+
|
|
145
|
+
## Erros comuns a evitar
|
|
146
|
+
|
|
147
|
+
| Erro | Como evitar |
|
|
148
|
+
|---|---|
|
|
149
|
+
| Loop infinito de `page+1` | Sempre cheque `meta.total_count` e pare |
|
|
150
|
+
| Re-listar inboxes 20x | Cache mental |
|
|
151
|
+
| Mandar `conversations_messages_create` sem `message_type` | Sempre setar `incoming`/`outgoing` |
|
|
152
|
+
| Listar TODAS contas de um agente direto | Use filter `q=nome` primeiro |
|
|
153
|
+
| Esquecer de filtrar por `account_id` | Multi-tenant — sempre escopar |
|
|
154
|
+
|
|
155
|
+
## Quando agir vs quando perguntar
|
|
156
|
+
|
|
157
|
+
Aja sem perguntar:
|
|
158
|
+
- Listagem, filtro, busca, leitura
|
|
159
|
+
- Sumarização, classificação
|
|
160
|
+
- Sugestão de próximos passos
|
|
161
|
+
|
|
162
|
+
Pergunte primeiro:
|
|
163
|
+
- Criar / atualizar / deletar dados
|
|
164
|
+
- Enviar mensagem pra cliente
|
|
165
|
+
- Mudar status de várias conversas em massa
|
|
166
|
+
- Alterar configuração de conta/inbox
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
# Fluxos de Conversação
|
|
2
|
+
|
|
3
|
+
Como conversas atravessam o LionChat: criação, auto-assignment, IA, automações, resolução. Use quando precisar entender ou diagnosticar comportamento de conversações.
|
|
4
|
+
|
|
5
|
+
## Ciclo de vida de uma conversa
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
[Cliente envia 1ª msg]
|
|
9
|
+
│
|
|
10
|
+
▼
|
|
11
|
+
┌──────────────────────────┐
|
|
12
|
+
│ ContactInbox criado/ │
|
|
13
|
+
│ encontrado por source_id │
|
|
14
|
+
└─────────┬────────────────┘
|
|
15
|
+
▼
|
|
16
|
+
┌──────────────────────────┐
|
|
17
|
+
│ Conversation.create │
|
|
18
|
+
│ status: 0 (open) │
|
|
19
|
+
└─────────┬────────────────┘
|
|
20
|
+
▼
|
|
21
|
+
┌───────────────────────────┐
|
|
22
|
+
│ Greeting (se ativo) │ → Message outgoing
|
|
23
|
+
└─────────┬─────────────────┘
|
|
24
|
+
▼
|
|
25
|
+
┌───────────────────────────┐
|
|
26
|
+
│ AutomationRule: │
|
|
27
|
+
│ "conversation_created" │
|
|
28
|
+
└─────────┬─────────────────┘
|
|
29
|
+
▼
|
|
30
|
+
┌───────────────────────────┐
|
|
31
|
+
│ Auto-assignment: │
|
|
32
|
+
│ - team OU agent │
|
|
33
|
+
│ - via policy ou simples │
|
|
34
|
+
└─────────┬─────────────────┘
|
|
35
|
+
▼
|
|
36
|
+
┌───────────────────────────┐
|
|
37
|
+
│ Captain (IA) Agent: │
|
|
38
|
+
│ se atribuído │
|
|
39
|
+
│ → debounce → LLM response │
|
|
40
|
+
└─────────┬─────────────────┘
|
|
41
|
+
▼
|
|
42
|
+
┌───────────────────────────┐
|
|
43
|
+
│ Conversa ativa │
|
|
44
|
+
│ (status: open) │
|
|
45
|
+
└─────────┬─────────────────┘
|
|
46
|
+
▼
|
|
47
|
+
[Agente humano ou IA atende ↔ cliente]
|
|
48
|
+
│
|
|
49
|
+
┌───────┴────────┐
|
|
50
|
+
▼ ▼
|
|
51
|
+
[resolvida] [adiada]
|
|
52
|
+
status: 1 status: 3
|
|
53
|
+
│ │
|
|
54
|
+
│ └──→ desnooze automático
|
|
55
|
+
▼
|
|
56
|
+
┌───────────────────────────┐
|
|
57
|
+
│ Pós-resolução: │
|
|
58
|
+
│ - Captain memory + FAQ │
|
|
59
|
+
│ - Reporting events │
|
|
60
|
+
│ - Automation rules │
|
|
61
|
+
│ - CSAT survey send │
|
|
62
|
+
└────────────────────────────┘
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Etapas detalhadas
|
|
66
|
+
|
|
67
|
+
### 1. Criação da conversa
|
|
68
|
+
|
|
69
|
+
Mensagem chega via webhook do canal (WAHA, WhatsApp Cloud, Email, etc) → `Webhook::IncomingMessageJob` ou similar → `IncomingMessageService` → cria/encontra `Contact`, `ContactInbox`, `Conversation`, `Message`.
|
|
70
|
+
|
|
71
|
+
**Pontos importantes:**
|
|
72
|
+
- `Conversation` sempre criada com `status = 0` (open)
|
|
73
|
+
- `inbox_id` setado direto
|
|
74
|
+
- `assignee_id` começa `null` (pendente atribuição)
|
|
75
|
+
- `captain_assistant_id` começa `null` (a menos que automação atribua)
|
|
76
|
+
|
|
77
|
+
### 2. Greeting (mensagem de boas-vindas)
|
|
78
|
+
|
|
79
|
+
Se `inbox.greeting_enabled = true`:
|
|
80
|
+
- Após criar a conversa, envia `inbox.greeting_message`
|
|
81
|
+
- Vira `Message` outgoing automática
|
|
82
|
+
- NÃO substitui resposta humana — só inicia a conversa
|
|
83
|
+
|
|
84
|
+
### 3. AutomationRule: "conversation_created"
|
|
85
|
+
|
|
86
|
+
Cada inbox/conta pode ter regras com `event_name: 'conversation_created'`. Elas rodam **antes** do auto-assignment.
|
|
87
|
+
|
|
88
|
+
Ações comuns:
|
|
89
|
+
- Atribuir agente/time específico
|
|
90
|
+
- Adicionar labels
|
|
91
|
+
- Marcar prioridade
|
|
92
|
+
- Atribuir Captain Assistant (`captain_assistant_id`)
|
|
93
|
+
|
|
94
|
+
Avaliação:
|
|
95
|
+
- Condições combinadas com AND
|
|
96
|
+
- Operadores: `equal_to`, `contains`, `includes`, `is_present`
|
|
97
|
+
- Pode usar `inbox`, `content`, `country_code`, `email`, custom_attributes
|
|
98
|
+
|
|
99
|
+
### 4. Auto-assignment
|
|
100
|
+
|
|
101
|
+
Roda após automation rules. Lógica simplificada:
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
SE inbox.enable_auto_assignment_v2:
|
|
105
|
+
SE inbox.assignment_policy associada:
|
|
106
|
+
→ Política decide (round-robin, balanced, etc)
|
|
107
|
+
SENAO:
|
|
108
|
+
→ assignee_id fica null (manual)
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
V2 (Assignment Policy) é o motor moderno. V1 (campo `auto_assignment` simples) é legado.
|
|
112
|
+
|
|
113
|
+
### 5. Captain (IA Agente)
|
|
114
|
+
|
|
115
|
+
Se `captain_assistant_id` foi setado (manual ou via automação):
|
|
116
|
+
- Mensagem incoming dispara `Captain::ResponseBuilderJob`
|
|
117
|
+
- Job tem **debounce** (~10s) — agrupa mensagens em rajada
|
|
118
|
+
- Chama LLM com prompt do assistant + histórico
|
|
119
|
+
- LLM pode invocar tools (FAQ, update_contact, create_booking, etc)
|
|
120
|
+
- Resposta vira `Message` outgoing com `sender_type: Captain::Assistant`
|
|
121
|
+
|
|
122
|
+
**Quando IA é desativada manualmente:**
|
|
123
|
+
- Agente clica em "Desativar AI" → `captain_assistant_id` vira null
|
|
124
|
+
- `custom_attributes.captain_manually_disabled = true`
|
|
125
|
+
- IA não responde mais nessa conversa (mesmo se nova msg)
|
|
126
|
+
|
|
127
|
+
### 6. Estado "pending" (status 2)
|
|
128
|
+
|
|
129
|
+
Conversa em "pending" significa "aguardando algo":
|
|
130
|
+
- Cliente respondeu mas agente ainda não viu
|
|
131
|
+
- OU agente respondeu e tá aguardando cliente
|
|
132
|
+
- Geralmente movida automaticamente por automação ("se 24h sem resposta → pending")
|
|
133
|
+
|
|
134
|
+
### 7. Resolução (status 1)
|
|
135
|
+
|
|
136
|
+
Agente clica em "Resolver":
|
|
137
|
+
- `status` → 1 (resolved)
|
|
138
|
+
- `resolved_at` setado
|
|
139
|
+
- Dispara `conversation_resolved` event
|
|
140
|
+
- Listeners agem:
|
|
141
|
+
- `CaptainListener`: gera memory + FAQ se IA atendeu
|
|
142
|
+
- `HookListener`: dispara webhooks
|
|
143
|
+
- `AutomationRuleListener`: regras de `conversation_resolved`
|
|
144
|
+
- `ReportingEventListener`: salva métricas
|
|
145
|
+
- `CsatSurveyJob` (se config ativa): envia pesquisa CSAT
|
|
146
|
+
|
|
147
|
+
### 8. Snoozed (status 3)
|
|
148
|
+
|
|
149
|
+
Adia conversa:
|
|
150
|
+
- `status` → 3 (snoozed)
|
|
151
|
+
- `snoozed_until` setado (datetime futuro)
|
|
152
|
+
- Job periódico `ReopenSnoozedConversationsJob` roda e reabre quando passa do `snoozed_until`
|
|
153
|
+
|
|
154
|
+
### 9. Reopen
|
|
155
|
+
|
|
156
|
+
Conversa resolvida que recebe nova mensagem do cliente:
|
|
157
|
+
- Comportamento depende de config `inbox.lock_to_single_conversation`
|
|
158
|
+
- Default: cria NOVA conversa (mantém histórico)
|
|
159
|
+
- Se locked: reabre a mesma conversa (`status` volta a 0)
|
|
160
|
+
|
|
161
|
+
## Estado relacional
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
Conversation
|
|
165
|
+
├─ messages: array em ordem cronológica
|
|
166
|
+
├─ contact: quem é o cliente
|
|
167
|
+
├─ inbox: canal de origem
|
|
168
|
+
├─ assignee: agente humano atual (null OK)
|
|
169
|
+
├─ team: time atribuído (null OK)
|
|
170
|
+
├─ captain_assistant: IA atribuída (null OK)
|
|
171
|
+
├─ kanban_item: card vinculado (null OK)
|
|
172
|
+
└─ labels: tags aplicadas
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Como diagnosticar problemas
|
|
176
|
+
|
|
177
|
+
### "Conversa não atribuiu ninguém"
|
|
178
|
+
|
|
179
|
+
1. `inbox.enable_auto_assignment_v2` está true?
|
|
180
|
+
2. `inbox.assignment_policy` está setado?
|
|
181
|
+
3. Tem `InboxMember` ativos pra essa inbox?
|
|
182
|
+
4. Tem `automation_rule` que poderia ter atribuído antes?
|
|
183
|
+
|
|
184
|
+
### "IA não respondeu"
|
|
185
|
+
|
|
186
|
+
1. `conversation.captain_assistant_id` está setado?
|
|
187
|
+
2. Account tem OpenAI hook configurado?
|
|
188
|
+
3. Captain feature ativa na conta? (`feature_captain_integration`)
|
|
189
|
+
4. Custom attr `captain_manually_disabled = true`?
|
|
190
|
+
5. Sidekiq job `Captain::ResponseBuilderJob` rodou? Tem erro no log?
|
|
191
|
+
|
|
192
|
+
### "Conversa marcada como pending sem motivo"
|
|
193
|
+
|
|
194
|
+
1. Tem automation rule com `event_name: conversation_updated` ou similar?
|
|
195
|
+
2. Tem SLA policy ativando state change?
|
|
196
|
+
3. Veio de external API call?
|
|
197
|
+
|
|
198
|
+
## Eventos importantes (pra automation)
|
|
199
|
+
|
|
200
|
+
| Evento | Quando dispara |
|
|
201
|
+
|---|---|
|
|
202
|
+
| `conversation_created` | Nova conversa |
|
|
203
|
+
| `conversation_opened` | Status volta pra open (reabertura) |
|
|
204
|
+
| `conversation_resolved` | Agente resolve |
|
|
205
|
+
| `conversation_pending` | Status muda pra pending |
|
|
206
|
+
| `conversation_updated` | Qualquer update |
|
|
207
|
+
| `message_created` | Nova mensagem (incoming ou outgoing) |
|
|
208
|
+
| `first_reply_created` | Primeira resposta humana |
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
# Kanban — Guia Profundo
|
|
2
|
+
|
|
3
|
+
Tudo sobre o módulo Kanban/CRM do LionChat: funis, etapas, cards, valor, automações, integrações com conversação.
|
|
4
|
+
|
|
5
|
+
## Estrutura
|
|
6
|
+
|
|
7
|
+
### Funnel (Funil)
|
|
8
|
+
Container de etapas. Conta pode ter vários funis (ex: "Vendas", "Pós-venda", "Renovação").
|
|
9
|
+
|
|
10
|
+
| Campo | Descrição |
|
|
11
|
+
|---|---|
|
|
12
|
+
| `id` | Identificador |
|
|
13
|
+
| `name` | Nome do funil (ex: "Vendas B2B") |
|
|
14
|
+
| `description` | Descrição livre |
|
|
15
|
+
| `stages` | jsonb com etapas (ver abaixo) |
|
|
16
|
+
| `archived` | Boolean — funis arquivados não aparecem na UI ativa |
|
|
17
|
+
| `active` | Boolean — controla se aceita movimentação |
|
|
18
|
+
| `settings` | jsonb — config customizada (ex: cores, automações) |
|
|
19
|
+
|
|
20
|
+
### Stages (Etapas) — dentro de `funnel.stages`
|
|
21
|
+
|
|
22
|
+
Stages NÃO são tabela separada. São armazenadas como jsonb dentro do Funnel:
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"novo_lead": {
|
|
27
|
+
"name": "Novo Lead",
|
|
28
|
+
"color": "#3B82F6",
|
|
29
|
+
"position": 1,
|
|
30
|
+
"description": "Lead ainda não qualificado"
|
|
31
|
+
},
|
|
32
|
+
"qualificado": {
|
|
33
|
+
"name": "Qualificado",
|
|
34
|
+
"color": "#10B981",
|
|
35
|
+
"position": 2,
|
|
36
|
+
"description": "Lead com interesse confirmado"
|
|
37
|
+
},
|
|
38
|
+
"ganho": {
|
|
39
|
+
"name": "Ganho",
|
|
40
|
+
"color": "#22C55E",
|
|
41
|
+
"position": 99
|
|
42
|
+
},
|
|
43
|
+
"perdido": {
|
|
44
|
+
"name": "Perdido",
|
|
45
|
+
"color": "#EF4444",
|
|
46
|
+
"position": 100
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### KanbanItem (Card)
|
|
52
|
+
Um card individual dentro de uma etapa.
|
|
53
|
+
|
|
54
|
+
| Campo | Descrição |
|
|
55
|
+
|---|---|
|
|
56
|
+
| `id` | Identificador |
|
|
57
|
+
| `funnel_id` | Funil ao qual pertence |
|
|
58
|
+
| `funnel_stage` | Chave da etapa (ex: `"novo_lead"`) |
|
|
59
|
+
| `position` | Ordem dentro da etapa |
|
|
60
|
+
| `stage_entered_at` | Quando entrou na etapa atual (pra métrica de tempo) |
|
|
61
|
+
| `conversation_display_id` | Conversa principal vinculada |
|
|
62
|
+
| `linked_conversations` | jsonb array `[{display_id: 123}, {display_id: 456}]` — múltiplas conversas |
|
|
63
|
+
| `item_details` | jsonb (ver abaixo) |
|
|
64
|
+
| `custom_attributes` | jsonb — campos custom (igual contatos) |
|
|
65
|
+
| `assigned_agents` | jsonb array de agentes responsáveis |
|
|
66
|
+
| `activities` | jsonb array — log de atividades |
|
|
67
|
+
| `checklist` | jsonb array de tarefas dentro do card |
|
|
68
|
+
| `timer_started_at`, `timer_duration` | Timer interno do card |
|
|
69
|
+
|
|
70
|
+
### item_details (detalhes do card)
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"title": "Cliente XYZ - Plano Pro",
|
|
75
|
+
"value": 5000.0,
|
|
76
|
+
"priority": "high",
|
|
77
|
+
"description": "Cliente interessado em upgrade",
|
|
78
|
+
"notes": [
|
|
79
|
+
{"text": "Ligou pedindo proposta", "created_at": "2026-05-15T10:00:00Z"}
|
|
80
|
+
],
|
|
81
|
+
"offers": [
|
|
82
|
+
{"id": 12, "title": "Pro 12 meses", "value": 4800}
|
|
83
|
+
],
|
|
84
|
+
"custom_attributes": {
|
|
85
|
+
"origem_lead": "Facebook Ads"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**`value`** é onde fica o valor monetário do negócio (usado em pipelines).
|
|
91
|
+
|
|
92
|
+
### assigned_agents
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
[
|
|
96
|
+
{
|
|
97
|
+
"id": 5,
|
|
98
|
+
"name": "Maria Souza",
|
|
99
|
+
"email": "maria@empresa.com",
|
|
100
|
+
"avatar_url": "https://...",
|
|
101
|
+
"assigned_at": "2026-05-14T09:00:00Z",
|
|
102
|
+
"assigned_by": 1,
|
|
103
|
+
"source": "manual"
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Múltiplos agentes podem ter o mesmo card. `source` pode ser `manual`, `automation`, `inherited_from_conversation`.
|
|
109
|
+
|
|
110
|
+
### linked_conversations — IMPORTANTE
|
|
111
|
+
|
|
112
|
+
```json
|
|
113
|
+
[{"display_id": 123}, {"display_id": 456}]
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**NUNCA gravar inteiros direto** — sempre objetos com `{display_id: ...}`. Inteiros diretos causam TypeError no `as_json`.
|
|
117
|
+
|
|
118
|
+
## Posição (ordering)
|
|
119
|
+
|
|
120
|
+
Cada KanbanItem tem `position` (integer). Cards ordenados ASC dentro da etapa.
|
|
121
|
+
|
|
122
|
+
Reordenação:
|
|
123
|
+
- API endpoint: `POST /api/v2/kanban/items/reorder`
|
|
124
|
+
- Recebe array com nova ordem `[{id: 5, position: 1}, {id: 8, position: 2}]`
|
|
125
|
+
- Recalcula `position` em todas as etapas afetadas
|
|
126
|
+
|
|
127
|
+
Mover entre etapas:
|
|
128
|
+
- API endpoint: `POST /api/v2/kanban/items/{id}/move`
|
|
129
|
+
- Body: `{funnel_stage: "qualificado", position: 1}`
|
|
130
|
+
- Atualiza `funnel_stage`, `stage_entered_at`, e `position`
|
|
131
|
+
|
|
132
|
+
## Atividades (activities)
|
|
133
|
+
|
|
134
|
+
Log automático de eventos do card:
|
|
135
|
+
|
|
136
|
+
```json
|
|
137
|
+
[
|
|
138
|
+
{
|
|
139
|
+
"type": "stage_changed",
|
|
140
|
+
"from": "novo_lead",
|
|
141
|
+
"to": "qualificado",
|
|
142
|
+
"by_user_id": 1,
|
|
143
|
+
"at": "2026-05-15T10:00:00Z"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"type": "agent_assigned",
|
|
147
|
+
"agent_id": 5,
|
|
148
|
+
"by_user_id": 1,
|
|
149
|
+
"at": "2026-05-15T10:01:00Z"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"type": "note_added",
|
|
153
|
+
"note_id": 42,
|
|
154
|
+
"by_user_id": 5,
|
|
155
|
+
"at": "2026-05-15T10:05:00Z"
|
|
156
|
+
}
|
|
157
|
+
]
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Tipos comuns: `created`, `stage_changed`, `agent_assigned`, `agent_removed`, `note_added`, `value_changed`, `priority_changed`, `archived`.
|
|
161
|
+
|
|
162
|
+
## Checklist (tarefas dentro do card)
|
|
163
|
+
|
|
164
|
+
```json
|
|
165
|
+
[
|
|
166
|
+
{
|
|
167
|
+
"id": "abc-123",
|
|
168
|
+
"title": "Enviar proposta por email",
|
|
169
|
+
"checked": true,
|
|
170
|
+
"completed_at": "2026-05-15T10:00:00Z",
|
|
171
|
+
"completed_by": 5
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"id": "abc-124",
|
|
175
|
+
"title": "Agendar follow-up",
|
|
176
|
+
"checked": false
|
|
177
|
+
}
|
|
178
|
+
]
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Útil pra workflows internos. Não confundir com `tasks` (que é módulo separado de tarefas globais).
|
|
182
|
+
|
|
183
|
+
## Pipeline (visão por valor)
|
|
184
|
+
|
|
185
|
+
Pipeline = soma de `item_details.value` agrupado por etapa.
|
|
186
|
+
|
|
187
|
+
Exemplo:
|
|
188
|
+
```
|
|
189
|
+
Funil "Vendas"
|
|
190
|
+
├── Novo Lead: 12 cards | R$ 47.000
|
|
191
|
+
├── Qualificado: 8 cards | R$ 38.000
|
|
192
|
+
├── Negociação: 3 cards | R$ 22.000
|
|
193
|
+
├── Ganho: 5 cards | R$ 28.000 (fechados no mês)
|
|
194
|
+
└── Perdido: 2 cards | R$ 4.000
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Endpoint: `GET /api/v2/kanban/items/counts` retorna contagem + soma por etapa.
|
|
198
|
+
|
|
199
|
+
## Funil arquivado vs ativo
|
|
200
|
+
|
|
201
|
+
- `archived = true`: funil escondido da UI principal. Cards ainda existem mas não aparecem nas listas
|
|
202
|
+
- `active = false`: bloqueia movimentação (modo "somente leitura")
|
|
203
|
+
|
|
204
|
+
Use cases:
|
|
205
|
+
- Arquivar funis antigos no fim do ano
|
|
206
|
+
- Pausar funil em manutenção sem deletar cards
|
|
207
|
+
|
|
208
|
+
## Integração com Conversation
|
|
209
|
+
|
|
210
|
+
### Quando uma conversa vincula a um card
|
|
211
|
+
- Manual via UI ("vincular ao Kanban")
|
|
212
|
+
- Automação via `automation_rule.actions` com action `add_to_kanban`
|
|
213
|
+
- API call em `POST /api/v2/kanban/items` com `conversation_display_id`
|
|
214
|
+
|
|
215
|
+
### Como o card "sabe" sobre o cliente
|
|
216
|
+
|
|
217
|
+
```
|
|
218
|
+
KanbanItem
|
|
219
|
+
└─ conversation_display_id → Conversation
|
|
220
|
+
└─ contact → Contact (nome, telefone, email)
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
NÃO existe `contact_id` direto no KanbanItem. Sempre via conversation_display_id.
|
|
224
|
+
|
|
225
|
+
### Múltiplas conversas no mesmo card
|
|
226
|
+
|
|
227
|
+
`linked_conversations` permite agrupar várias conversas (ex: cliente que falou em WhatsApp e Email):
|
|
228
|
+
|
|
229
|
+
```json
|
|
230
|
+
[
|
|
231
|
+
{"display_id": 100},
|
|
232
|
+
{"display_id": 101},
|
|
233
|
+
{"display_id": 105}
|
|
234
|
+
]
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
A `conversation_display_id` (singular) ainda é a "principal" — mas todas as `linked_conversations` aparecem na sidebar do card.
|
|
238
|
+
|
|
239
|
+
## Automações relacionadas a Kanban
|
|
240
|
+
|
|
241
|
+
AutomationRule com evento `kanban_item_created`, `kanban_item_moved`, `kanban_item_stage_changed`:
|
|
242
|
+
|
|
243
|
+
```json
|
|
244
|
+
{
|
|
245
|
+
"event_name": "kanban_item_moved",
|
|
246
|
+
"conditions": [
|
|
247
|
+
{"attribute_key": "funnel_stage", "operator": "equal_to", "value": "ganho"}
|
|
248
|
+
],
|
|
249
|
+
"actions": [
|
|
250
|
+
{"action_name": "send_message", "params": ["Parabéns pelo fechamento!"]},
|
|
251
|
+
{"action_name": "add_label", "params": ["cliente-pagante"]}
|
|
252
|
+
]
|
|
253
|
+
}
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
## Bulk operations
|
|
257
|
+
|
|
258
|
+
- `POST /api/v2/kanban/items/bulk_actions` — operações em massa (mover, atribuir, arquivar)
|
|
259
|
+
- `POST /api/v2/kanban/items/import` — importar CSV de cards
|
|
260
|
+
- `GET /api/v2/kanban/items/export` — exportar funil completo
|
|
261
|
+
|
|
262
|
+
## Custom attributes em cards
|
|
263
|
+
|
|
264
|
+
Igual contatos, cards têm `custom_attributes` (jsonb):
|
|
265
|
+
|
|
266
|
+
```json
|
|
267
|
+
{
|
|
268
|
+
"origem_lead": "Google Ads",
|
|
269
|
+
"campanha": "Black Friday 2026",
|
|
270
|
+
"score": 85,
|
|
271
|
+
"produto_interesse": "Plano Pro"
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
Configurar atributos no Super Admin ou via API `/api/v1/custom_attribute_definitions`.
|
|
276
|
+
|
|
277
|
+
## Métricas úteis (via GET /api/v2/kanban/items)
|
|
278
|
+
|
|
279
|
+
- Tempo médio em cada etapa: `stage_entered_at` vs agora
|
|
280
|
+
- Taxa de conversão: cards em "ganho" vs total criado no período
|
|
281
|
+
- Pipeline ativo: soma de `value` em etapas != ganho/perdido
|
|
282
|
+
- Velocity: cards movidos pra "ganho" por mês
|
|
283
|
+
|
|
284
|
+
## Diagnóstico: "Card sumiu do funil"
|
|
285
|
+
|
|
286
|
+
1. Está arquivado? `archived = true` em algum nível?
|
|
287
|
+
2. Etapa atual existe ainda? (etapa removida do funil deixa card "órfão")
|
|
288
|
+
3. `position` está faltando? (cards sem position vão pro fim)
|
|
289
|
+
4. Está em outro funil? (mover entre funis muda `funnel_id`)
|
|
290
|
+
|
|
291
|
+
## Diagnóstico: "Valor do pipeline errado"
|
|
292
|
+
|
|
293
|
+
1. Algum card sem `item_details.value`?
|
|
294
|
+
2. Cards arquivados estão sendo contados?
|
|
295
|
+
3. Etapas "ganho"/"perdido" estão incluídas no cálculo?
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
# Troubleshooting — Códigos de Erro Comuns
|
|
2
|
+
|
|
3
|
+
Como interpretar e responder a erros do MCP do LionChat.
|
|
4
|
+
|
|
5
|
+
## HTTP Status Codes
|
|
6
|
+
|
|
7
|
+
### 200 OK / 201 Created
|
|
8
|
+
Tudo certo. Use o body.
|
|
9
|
+
|
|
10
|
+
### 204 No Content
|
|
11
|
+
Sucesso, mas sem corpo. Comum em DELETE e algumas updates. NÃO espere JSON de volta.
|
|
12
|
+
|
|
13
|
+
### 400 Bad Request
|
|
14
|
+
Input malformado. Causas comuns:
|
|
15
|
+
- JSON inválido
|
|
16
|
+
- Campo obrigatório faltando
|
|
17
|
+
- Tipo errado (passou string onde esperava number)
|
|
18
|
+
|
|
19
|
+
**Ação:** Releia a mensagem de erro. Corrija o payload. NÃO retry sem mudar nada.
|
|
20
|
+
|
|
21
|
+
### 401 Unauthorized
|
|
22
|
+
Token de API inválido ou expirado.
|
|
23
|
+
|
|
24
|
+
**Ação:** Parar. Reportar pro usuário que precisa renovar credenciais. NÃO retry — vai falhar igual.
|
|
25
|
+
|
|
26
|
+
### 403 Forbidden
|
|
27
|
+
Token válido, mas SEM permissão pra essa ação.
|
|
28
|
+
|
|
29
|
+
Causas:
|
|
30
|
+
- Agente tentando ação de admin
|
|
31
|
+
- Conta diferente do escopo do token
|
|
32
|
+
- Feature flag desativada na conta
|
|
33
|
+
- Recurso pertence a outra conta (multi-tenant)
|
|
34
|
+
|
|
35
|
+
**Ação:** NÃO bypass. Informar limitação ao usuário.
|
|
36
|
+
|
|
37
|
+
### 404 Not Found
|
|
38
|
+
Recurso não existe.
|
|
39
|
+
|
|
40
|
+
Causas comuns:
|
|
41
|
+
- ID errado
|
|
42
|
+
- Recurso foi deletado
|
|
43
|
+
- Está em outra conta
|
|
44
|
+
- Endpoint URL errado
|
|
45
|
+
|
|
46
|
+
**Ação:** Verificar se ID está correto. Se foi deletado, informar.
|
|
47
|
+
|
|
48
|
+
### 422 Unprocessable Entity
|
|
49
|
+
Dados passaram na sintaxe mas falharam validação.
|
|
50
|
+
|
|
51
|
+
Exemplo de response:
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"errors": {
|
|
55
|
+
"email": ["já está em uso"],
|
|
56
|
+
"phone_number": ["formato inválido"]
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Ação:** Ler `errors`, ajustar dados, reenviar.
|
|
62
|
+
|
|
63
|
+
### 429 Too Many Requests
|
|
64
|
+
Rate limit estourado.
|
|
65
|
+
|
|
66
|
+
Response inclui header `Retry-After: 60` (segundos).
|
|
67
|
+
|
|
68
|
+
**Ação:**
|
|
69
|
+
- Esperar o tempo indicado
|
|
70
|
+
- Reduzir concorrência
|
|
71
|
+
- Avaliar se está fazendo loop ineficiente
|
|
72
|
+
|
|
73
|
+
NÃO retry imediato — só piora.
|
|
74
|
+
|
|
75
|
+
### 500 Internal Server Error
|
|
76
|
+
Erro do servidor LionChat.
|
|
77
|
+
|
|
78
|
+
**Ação:**
|
|
79
|
+
- Retry 1x após 2-5 segundos
|
|
80
|
+
- Se persiste, reportar pro usuário com timestamp/request ID
|
|
81
|
+
|
|
82
|
+
### 502 Bad Gateway / 503 Service Unavailable
|
|
83
|
+
Indisponibilidade temporária (deploy, manutenção, sobrecarga).
|
|
84
|
+
|
|
85
|
+
**Ação:** Retry com backoff exponencial (2s, 4s, 8s). Máx 3 tentativas.
|
|
86
|
+
|
|
87
|
+
### 504 Gateway Timeout
|
|
88
|
+
Operação demorou demais.
|
|
89
|
+
|
|
90
|
+
Causas:
|
|
91
|
+
- Query muito pesada (sem filtro)
|
|
92
|
+
- Export grande (use exports assíncronos)
|
|
93
|
+
|
|
94
|
+
**Ação:** Reformular a chamada com filtros mais agressivos.
|
|
95
|
+
|
|
96
|
+
## Erros específicos do MCP
|
|
97
|
+
|
|
98
|
+
### "mcp_not_enabled"
|
|
99
|
+
Status: 403
|
|
100
|
+
|
|
101
|
+
A conta não tem a feature MCP habilitada.
|
|
102
|
+
|
|
103
|
+
**Ação:** Pedir admin pra ativar no plano ou via Super Admin.
|
|
104
|
+
|
|
105
|
+
### "admin_required"
|
|
106
|
+
Status: 403
|
|
107
|
+
|
|
108
|
+
Só administradores podem usar essa funcionalidade.
|
|
109
|
+
|
|
110
|
+
**Ação:** Usuário com role `agent` precisa pedir pro admin.
|
|
111
|
+
|
|
112
|
+
### "invalid_account"
|
|
113
|
+
Status: 400 ou 404
|
|
114
|
+
|
|
115
|
+
`account_id` não pertence ao usuário autenticado.
|
|
116
|
+
|
|
117
|
+
**Ação:** Listar contas do user (`list_my_accounts`) e usar uma válida.
|
|
118
|
+
|
|
119
|
+
### "feature_disabled"
|
|
120
|
+
Status: 403
|
|
121
|
+
|
|
122
|
+
Feature flag específica (ex: `feature_kanban`, `feature_captain`) está OFF.
|
|
123
|
+
|
|
124
|
+
**Ação:** Reportar qual feature precisa ser ativada.
|
|
125
|
+
|
|
126
|
+
## Erros de validação comuns
|
|
127
|
+
|
|
128
|
+
### Conversation
|
|
129
|
+
- `"contact must exist"` — passou `contact_id` inválido
|
|
130
|
+
- `"inbox must exist"` — `inbox_id` errado
|
|
131
|
+
- `"status invalid"` — use 0, 1, 2 ou 3 (open/resolved/pending/snoozed)
|
|
132
|
+
|
|
133
|
+
### Contact
|
|
134
|
+
- `"email has already been taken"` — duplicado na conta
|
|
135
|
+
- `"phone_number has already been taken"` — mesmo problema
|
|
136
|
+
- `"phone_number must be a valid number with country code"` — formato E.164: `+5511999999999`
|
|
137
|
+
|
|
138
|
+
### Message
|
|
139
|
+
- `"content can't be blank"` — mensagem vazia (use template se for attachment-only)
|
|
140
|
+
- `"private must be boolean"` — true/false, não string
|
|
141
|
+
|
|
142
|
+
### KanbanItem
|
|
143
|
+
- `"funnel_stage does not exist in funnel"` — etapa inválida pro funil
|
|
144
|
+
- `"conversation_display_id must exist"` — conversa não existe ou foi deletada
|
|
145
|
+
- `"position must be a positive integer"` — não pode ser negativo
|
|
146
|
+
|
|
147
|
+
## Cenários problemáticos
|
|
148
|
+
|
|
149
|
+
### "Estou recebendo 401 mesmo com token correto"
|
|
150
|
+
Possíveis causas:
|
|
151
|
+
- Token foi revogado
|
|
152
|
+
- Conta foi suspensa (`feature_account_suspended`)
|
|
153
|
+
- Token de outra conta
|
|
154
|
+
|
|
155
|
+
Verificar: `GET /api/v1/profile` (se 401 aqui, token tá inválido)
|
|
156
|
+
|
|
157
|
+
### "GET retorna 200 mas POST/PATCH retorna 403"
|
|
158
|
+
Token tem `scope: read` apenas. Precisa de token com scope completo pra escritas.
|
|
159
|
+
|
|
160
|
+
### "Operação foi pelo MCP mas não aparece na UI"
|
|
161
|
+
- Frontend pode estar com cache (refresh)
|
|
162
|
+
- WebSocket pode estar caído
|
|
163
|
+
- Pode ter sido criado em outra conta (verificar `account_id`)
|
|
164
|
+
|
|
165
|
+
### "Timer/job rodou mas dados estão errados"
|
|
166
|
+
Sidekiq pode estar retry-ando. Verificar:
|
|
167
|
+
- Job tem `discard_on` apropriado?
|
|
168
|
+
- Status final no banco vs UI
|
|
169
|
+
|
|
170
|
+
### "Tool não está disponível"
|
|
171
|
+
Possíveis razões:
|
|
172
|
+
- MCP server não foi atualizado (`npm install -g @lionchat/mcp-server@latest`)
|
|
173
|
+
- Feature flag bloqueando endpoint
|
|
174
|
+
- Plano do cliente não inclui a feature
|
|
175
|
+
|
|
176
|
+
### "Rate limit constante"
|
|
177
|
+
Padrões que causam:
|
|
178
|
+
- Polling agressivo (use webhooks)
|
|
179
|
+
- Listar tudo sem paginar
|
|
180
|
+
- Não cache de dados estáticos
|
|
181
|
+
- Loop sem `break` apropriado
|
|
182
|
+
|
|
183
|
+
## Webhooks como alternativa a polling
|
|
184
|
+
|
|
185
|
+
Se você precisa monitorar mudanças em conversas/mensagens, NÃO faça polling:
|
|
186
|
+
|
|
187
|
+
```
|
|
188
|
+
Polling errado:
|
|
189
|
+
while True: GET /conversations every 5s → MUITO ruim
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Use webhooks (config na conta):
|
|
193
|
+
- `conversation_created`
|
|
194
|
+
- `message_created`
|
|
195
|
+
- `conversation_resolved`
|
|
196
|
+
- Etc
|
|
197
|
+
|
|
198
|
+
LionChat envia POST pro seu endpoint quando o evento dispara.
|
|
199
|
+
|
|
200
|
+
## OAuth (apenas MCP Remote)
|
|
201
|
+
|
|
202
|
+
### "invalid_client_metadata"
|
|
203
|
+
Cliente OAuth registrado errado. Verifique:
|
|
204
|
+
- `token_endpoint_auth_method` = `none` (pra Claude/ChatGPT)
|
|
205
|
+
- `redirect_uris` exato (https, sem trailing slash extra)
|
|
206
|
+
|
|
207
|
+
### "invalid_grant"
|
|
208
|
+
Auth code expirou (vida curta — segundos). Refazer login.
|
|
209
|
+
|
|
210
|
+
### "Conector desconectou sozinho"
|
|
211
|
+
Geralmente: refresh_token expirou (TTL passou).
|
|
212
|
+
|
|
213
|
+
Hoje no LionChat: TTL é ~100 anos. Se desconectar, provavelmente:
|
|
214
|
+
- Token revogado manualmente
|
|
215
|
+
- Conta suspensa
|
|
216
|
+
- Restart do serviço MCP Remote
|
|
217
|
+
|
|
218
|
+
### "Consent loop infinito"
|
|
219
|
+
Bug conhecido: `Grant` não criado explicitamente. Atualizar MCP Remote pra versão >= 0.3.0.
|
|
220
|
+
|
|
221
|
+
## Logs e debugging
|
|
222
|
+
|
|
223
|
+
### Como pegar request ID
|
|
224
|
+
Toda resposta da API tem header `X-Request-ID`. Inclua no relatório se algo falhar.
|
|
225
|
+
|
|
226
|
+
### Como ver logs do MCP Server local
|
|
227
|
+
```bash
|
|
228
|
+
# Stdio MCP imprime em stderr — capture no Claude Desktop logs:
|
|
229
|
+
~/Library/Logs/Claude/mcp*.log
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Como ver logs do MCP Remote (servidor produção)
|
|
233
|
+
- Painel Portainer → serviço `mcp_remote` → logs
|
|
234
|
+
- Cloudflare Worker logs (se proxy)
|
|
235
|
+
- Sentry pra exceptions
|
|
236
|
+
|
|
237
|
+
## Quando reportar pro suporte
|
|
238
|
+
|
|
239
|
+
Reporte se:
|
|
240
|
+
- 500/502/503 persistente após 3 retries
|
|
241
|
+
- 401 com token recém-gerado
|
|
242
|
+
- Dados sumindo sem ação clara
|
|
243
|
+
- Comportamento inconsistente entre contas
|
|
244
|
+
|
|
245
|
+
NÃO precisa reportar:
|
|
246
|
+
- 4xx (você fez algo errado)
|
|
247
|
+
- Rate limit (esperado)
|
|
248
|
+
- 404 de recurso deletado
|
package/dist/index.js
CHANGED
|
@@ -49,8 +49,8 @@ async function main() {
|
|
|
49
49
|
console.error(`Base URL: ${config.baseUrl}`);
|
|
50
50
|
console.error(`Account: ${config.accountId}`);
|
|
51
51
|
console.error(`Tools registered: ${toolCount}`);
|
|
52
|
-
console.error(`Resources registered:
|
|
53
|
-
console.error(`Prompts registered:
|
|
52
|
+
console.error(`Resources registered: 8 (glossary, data-model, reports-guide, api-conventions, conversation-flows, kanban-deep-dive, best-practices, troubleshooting)`);
|
|
53
|
+
console.error(`Prompts registered: 8 (productivity_report, stuck_leads, weekly_recap, customer_health, inactive_contacts, team_load_balance, quality_audit, whatsapp_template_usage)`);
|
|
54
54
|
if (config.categories) {
|
|
55
55
|
console.error(`Categories filter: ${config.categories.join(', ')}`);
|
|
56
56
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAA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a,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAExD,6EAA6E;QAC7E,iBAAiB,CAAC,MAAM,CAAC,CAAC;QAC1B,eAAe,CAAC,MAAM,CAAC,CAAC;QAExB,iFAAiF;QACjF,OAAO,CAAC,KAAK,CAAC,wBAAwB,OAAO,EAAE,CAAC,CAAC;QACjD,OAAO,CAAC,KAAK,CAAC,aAAa,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;QAC7C,OAAO,CAAC,KAAK,CAAC,YAAY,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;QAC9C,OAAO,CAAC,KAAK,CAAC,qBAAqB,SAAS,EAAE,CAAC,CAAC;QAChD,OAAO,CAAC,KAAK,CAAC,uJAAuJ,CAAC,CAAC;QACvK,OAAO,CAAC,KAAK,CAAC,uKAAuK,CAAC,CAAC;QACvL,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;YACtB,OAAO,CAAC,KAAK,CAAC,sBAAsB,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACtE,CAAC;QAED,kEAAkE;QAClE,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;QAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAClC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACtE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC"}
|
package/dist/resources.js
CHANGED
|
@@ -29,6 +29,30 @@ export const RESOURCES = [
|
|
|
29
29
|
description: 'Auth, paginacao, filtros, datas, codigos HTTP, rate limits. Use quando tiver duvida sobre como chamar endpoint.',
|
|
30
30
|
filename: 'api-conventions.md',
|
|
31
31
|
},
|
|
32
|
+
{
|
|
33
|
+
name: 'Fluxos de Conversacao',
|
|
34
|
+
uri: 'lionchat://docs/conversation-flows',
|
|
35
|
+
description: 'Ciclo de vida de uma conversa: criacao, greeting, auto-assignment, Captain IA, resolucao, snooze. Use pra diagnosticar comportamento de conversas.',
|
|
36
|
+
filename: 'conversation-flows.md',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'Kanban Detalhado',
|
|
40
|
+
uri: 'lionchat://docs/kanban-deep-dive',
|
|
41
|
+
description: 'Estrutura completa do Kanban: Funnel, stages, KanbanItem, item_details, pipeline, activities. Use ao trabalhar com cards ou funis.',
|
|
42
|
+
filename: 'kanban-deep-dive.md',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: 'Boas Praticas',
|
|
46
|
+
uri: 'lionchat://docs/best-practices',
|
|
47
|
+
description: 'Como economizar tokens, evitar rate limits, usar filtros, paginar. Consulte antes de workflows pesados ou loops em massa.',
|
|
48
|
+
filename: 'best-practices.md',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'Troubleshooting',
|
|
52
|
+
uri: 'lionchat://docs/troubleshooting',
|
|
53
|
+
description: 'Codigos HTTP, erros comuns (401/403/422/429), erros MCP, debugging, quando reportar suporte. Use pra interpretar erros.',
|
|
54
|
+
filename: 'troubleshooting.md',
|
|
55
|
+
},
|
|
32
56
|
];
|
|
33
57
|
function findDocsPath(filename) {
|
|
34
58
|
const candidates = [
|
package/dist/resources.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../src/resources.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,iEAAiE;AAEjE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,a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,CAAC;YAC5C,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,MAAM,IAAI,KAAK,CAAC,0BAA0B,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;YAC5D,CAAC;YACD,OAAO;gBACL,QAAQ,EAAE;oBACR;wBACE,GAAG,EAAE,GAAG,CAAC,IAAI;wBACb,QAAQ,EAAE,eAAe;wBACzB,IAAI,EAAE,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC;qBACtC;iBACF;aACF,CAAC;QACJ,CAAC,CACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lionchat/mcp-server",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"description": "MCP server for LionChat API — 547 tools +
|
|
3
|
+
"version": "0.3.1",
|
|
4
|
+
"description": "MCP server for LionChat API — 547 tools + 8 resources + 8 prompts for AI agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"bin": {
|