n8n-nodes-aib 0.3.0 → 0.3.2
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.
|
@@ -51,6 +51,7 @@ class AibDigital {
|
|
|
51
51
|
noDataExpression: true,
|
|
52
52
|
default: "enviarMensagem",
|
|
53
53
|
options: [
|
|
54
|
+
{ name: "Selecionar conta", value: "selecionarConta", action: "Selecionar a conta (âncora do fluxo)" },
|
|
54
55
|
{ name: "Enviar mensagem", value: "enviarMensagem", action: "Enviar mensagem de texto" },
|
|
55
56
|
{ name: "Listar conversas", value: "listarConversas", action: "Listar conversas" },
|
|
56
57
|
{ name: "Buscar conversa", value: "buscarConversa", action: "Buscar uma conversa" },
|
|
@@ -205,6 +206,22 @@ class AibDigital {
|
|
|
205
206
|
default: "",
|
|
206
207
|
displayOptions: { show: { operation: ["criarEtapa"] } },
|
|
207
208
|
},
|
|
209
|
+
{
|
|
210
|
+
displayName: "Etapa de ganho",
|
|
211
|
+
name: "etapaGanha",
|
|
212
|
+
type: "boolean",
|
|
213
|
+
default: false,
|
|
214
|
+
displayOptions: { show: { operation: ["criarEtapa"] } },
|
|
215
|
+
description: "Card que chega aqui conta como negócio ganho",
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
displayName: "Etapa de perda",
|
|
219
|
+
name: "etapaPerdida",
|
|
220
|
+
type: "boolean",
|
|
221
|
+
default: false,
|
|
222
|
+
displayOptions: { show: { operation: ["criarEtapa"] } },
|
|
223
|
+
description: "Card que chega aqui conta como negócio perdido",
|
|
224
|
+
},
|
|
208
225
|
{
|
|
209
226
|
displayName: "Contato (ID)",
|
|
210
227
|
name: "contatoId",
|
|
@@ -333,6 +350,8 @@ class AibDigital {
|
|
|
333
350
|
res = await api(this, "POST", `/api/v1/funis/${funilId}/etapas`, {
|
|
334
351
|
nome: this.getNodeParameter("etapaNome", i),
|
|
335
352
|
...(this.getNodeParameter("etapaCor", i, "") ? { cor: this.getNodeParameter("etapaCor", i, "") } : {}),
|
|
353
|
+
...(this.getNodeParameter("etapaGanha", i, false) ? { ganha: true } : {}),
|
|
354
|
+
...(this.getNodeParameter("etapaPerdida", i, false) ? { perdida: true } : {}),
|
|
336
355
|
}, qs);
|
|
337
356
|
}
|
|
338
357
|
else if (operation === "atualizarContato") {
|
|
@@ -340,6 +359,22 @@ class AibDigital {
|
|
|
340
359
|
const campos = this.getNodeParameter("camposContato", i, {});
|
|
341
360
|
res = await api(this, "PATCH", `/api/v1/contatos/${contatoId}`, campos, qs);
|
|
342
361
|
}
|
|
362
|
+
else if (operation === "selecionarConta") {
|
|
363
|
+
// A âncora do fluxo, como o "Selecionar conta" do Chatwoot: devolve a
|
|
364
|
+
// conta escolhida para os nós seguintes referenciarem por expressão.
|
|
365
|
+
const contaSel = this.getNodeParameter("conta", i, "");
|
|
366
|
+
if (contaSel) {
|
|
367
|
+
const r = await api(this, "GET", "/api/v1/contas");
|
|
368
|
+
const achada = (r?.contas ?? []).find((c) => c.id === contaSel);
|
|
369
|
+
if (!achada)
|
|
370
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), "Conta não encontrada para esta chave");
|
|
371
|
+
res = achada;
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
const ping = await api(this, "GET", "/api/v1/ping");
|
|
375
|
+
res = { id: "", nome: "— a conta da chave —", escopo: ping?.escopo };
|
|
376
|
+
}
|
|
377
|
+
}
|
|
343
378
|
else {
|
|
344
379
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operação desconhecida: ${operation}`);
|
|
345
380
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-aib",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
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",
|