n8n-nodes-aib 0.3.1 → 0.4.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.
|
@@ -23,6 +23,7 @@ function contaQs(ctx, i) {
|
|
|
23
23
|
class AibDigital {
|
|
24
24
|
description = {
|
|
25
25
|
displayName: "AIB Digital",
|
|
26
|
+
icon: "file:aibdigital.svg",
|
|
26
27
|
name: "aibDigital",
|
|
27
28
|
group: ["output"],
|
|
28
29
|
version: 1,
|
|
@@ -44,22 +45,79 @@ class AibDigital {
|
|
|
44
45
|
default: "",
|
|
45
46
|
description: "O cliente. Com chave de agência, escolha aqui; com chave de conta, deixe vazio.",
|
|
46
47
|
},
|
|
48
|
+
// ── Recurso → Operação, como no nó do Chatwoot ──────────────
|
|
49
|
+
{
|
|
50
|
+
displayName: "Recurso",
|
|
51
|
+
name: "recurso",
|
|
52
|
+
type: "options",
|
|
53
|
+
noDataExpression: true,
|
|
54
|
+
default: "conversa",
|
|
55
|
+
options: [
|
|
56
|
+
{ name: "Conta", value: "conta" },
|
|
57
|
+
{ name: "Conversa", value: "conversa" },
|
|
58
|
+
{ name: "Mensagem", value: "mensagem" },
|
|
59
|
+
{ name: "Contato", value: "contato" },
|
|
60
|
+
{ name: "Funil (Kanban)", value: "funil" },
|
|
61
|
+
],
|
|
62
|
+
},
|
|
47
63
|
{
|
|
48
64
|
displayName: "Operação",
|
|
49
65
|
name: "operation",
|
|
50
66
|
type: "options",
|
|
51
67
|
noDataExpression: true,
|
|
52
|
-
default: "
|
|
68
|
+
default: "selecionarConta",
|
|
69
|
+
displayOptions: { show: { recurso: ["conta"] } },
|
|
70
|
+
options: [
|
|
71
|
+
{ name: "Selecionar conta", value: "selecionarConta", action: "Selecionar a conta (âncora do fluxo)" },
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
displayName: "Operação",
|
|
76
|
+
name: "operation",
|
|
77
|
+
type: "options",
|
|
78
|
+
noDataExpression: true,
|
|
79
|
+
default: "listarConversas",
|
|
80
|
+
displayOptions: { show: { recurso: ["conversa"] } },
|
|
53
81
|
options: [
|
|
54
|
-
{ name: "Enviar mensagem", value: "enviarMensagem", action: "Enviar mensagem de texto" },
|
|
55
82
|
{ name: "Listar conversas", value: "listarConversas", action: "Listar conversas" },
|
|
56
83
|
{ name: "Buscar conversa", value: "buscarConversa", action: "Buscar uma conversa" },
|
|
57
|
-
{ name: "Listar mensagens", value: "listarMensagens", action: "Listar mensagens da conversa" },
|
|
58
84
|
{ name: "Mover etapa (Kanban)", value: "moverEtapa", action: "Mover card no funil" },
|
|
59
85
|
{ name: "Pausar/religar IA", value: "mudarIa", action: "Pausar ou religar a IA na conversa" },
|
|
60
86
|
{ name: "Atribuir atendente", value: "atribuirAtendente", action: "Atribuir a conversa a uma pessoa" },
|
|
61
|
-
{ name: "Atualizar contato", value: "atualizarContato", action: "Atualizar dados do contato" },
|
|
62
87
|
{ name: "Etiquetas da conversa", value: "mudarEtiquetas", action: "Adicionar/remover etiquetas na conversa" },
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
displayName: "Operação",
|
|
92
|
+
name: "operation",
|
|
93
|
+
type: "options",
|
|
94
|
+
noDataExpression: true,
|
|
95
|
+
default: "enviarMensagem",
|
|
96
|
+
displayOptions: { show: { recurso: ["mensagem"] } },
|
|
97
|
+
options: [
|
|
98
|
+
{ name: "Enviar mensagem", value: "enviarMensagem", action: "Enviar mensagem de texto" },
|
|
99
|
+
{ name: "Listar mensagens", value: "listarMensagens", action: "Listar mensagens da conversa" },
|
|
100
|
+
],
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
displayName: "Operação",
|
|
104
|
+
name: "operation",
|
|
105
|
+
type: "options",
|
|
106
|
+
noDataExpression: true,
|
|
107
|
+
default: "atualizarContato",
|
|
108
|
+
displayOptions: { show: { recurso: ["contato"] } },
|
|
109
|
+
options: [
|
|
110
|
+
{ name: "Atualizar contato", value: "atualizarContato", action: "Atualizar dados do contato" },
|
|
111
|
+
],
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
displayName: "Operação",
|
|
115
|
+
name: "operation",
|
|
116
|
+
type: "options",
|
|
117
|
+
noDataExpression: true,
|
|
118
|
+
default: "criarFunil",
|
|
119
|
+
displayOptions: { show: { recurso: ["funil"] } },
|
|
120
|
+
options: [
|
|
63
121
|
{ name: "Criar funil", value: "criarFunil", action: "Criar funil com etapas" },
|
|
64
122
|
{ name: "Criar etapa", value: "criarEtapa", action: "Criar etapa num funil" },
|
|
65
123
|
],
|
|
@@ -358,6 +416,22 @@ class AibDigital {
|
|
|
358
416
|
const campos = this.getNodeParameter("camposContato", i, {});
|
|
359
417
|
res = await api(this, "PATCH", `/api/v1/contatos/${contatoId}`, campos, qs);
|
|
360
418
|
}
|
|
419
|
+
else if (operation === "selecionarConta") {
|
|
420
|
+
// A âncora do fluxo, como o "Selecionar conta" do Chatwoot: devolve a
|
|
421
|
+
// conta escolhida para os nós seguintes referenciarem por expressão.
|
|
422
|
+
const contaSel = this.getNodeParameter("conta", i, "");
|
|
423
|
+
if (contaSel) {
|
|
424
|
+
const r = await api(this, "GET", "/api/v1/contas");
|
|
425
|
+
const achada = (r?.contas ?? []).find((c) => c.id === contaSel);
|
|
426
|
+
if (!achada)
|
|
427
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), "Conta não encontrada para esta chave");
|
|
428
|
+
res = achada;
|
|
429
|
+
}
|
|
430
|
+
else {
|
|
431
|
+
const ping = await api(this, "GET", "/api/v1/ping");
|
|
432
|
+
res = { id: "", nome: "— a conta da chave —", escopo: ping?.escopo };
|
|
433
|
+
}
|
|
434
|
+
}
|
|
361
435
|
else {
|
|
362
436
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operação desconhecida: ${operation}`);
|
|
363
437
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 60">
|
|
2
|
+
<rect width="60" height="60" rx="13" fill="#0D141C"/>
|
|
3
|
+
<rect x="1.5" y="1.5" width="57" height="57" rx="11.5" fill="none" stroke="#37BFDB" stroke-opacity=".35" stroke-width="3"/>
|
|
4
|
+
<path d="M14 42 L24 18 h4 L38 42 h-6 l-2-5 H22 l-2 5 Z M24 32 h4.5 L26.2 25 Z" fill="#37BFDB"/>
|
|
5
|
+
<circle cx="43" cy="21" r="4" fill="#57B98A"/>
|
|
6
|
+
<rect x="39" y="29" width="8" height="13" rx="2.5" fill="#E8EEF3" opacity=".85"/>
|
|
7
|
+
</svg>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-aib",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Nós do Sistema AIB Digital para n8n: gatilho de mensagens do WhatsApp (via AIB Inbox) e ações — enviar mensagem, mover card no funil, pausar IA — escolhendo conta e caixa por dropdown.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "AIB Digital",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"dist"
|
|
17
17
|
],
|
|
18
18
|
"scripts": {
|
|
19
|
-
"build": "tsc"
|
|
19
|
+
"build": "tsc && cp nodes/AibDigital/aibdigital.svg dist/nodes/AibDigital/"
|
|
20
20
|
},
|
|
21
21
|
"n8n": {
|
|
22
22
|
"n8nNodesApiVersion": 1,
|