@connectorx/n8n-nodes-cortex 0.1.42 → 0.1.43
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.
|
@@ -11,7 +11,7 @@ class CortexApi {
|
|
|
11
11
|
name: 'apiBaseUrl',
|
|
12
12
|
type: 'string',
|
|
13
13
|
default: 'https://api.your-cortex-instance.com',
|
|
14
|
-
description: 'The base URL of the Cortex
|
|
14
|
+
description: 'The base URL of the Cortex API (e.g. https://api.agentecortex.com.br)',
|
|
15
15
|
required: true,
|
|
16
16
|
},
|
|
17
17
|
{
|
|
@@ -29,7 +29,7 @@ class CortexApi {
|
|
|
29
29
|
this.test = {
|
|
30
30
|
request: {
|
|
31
31
|
baseURL: '={{$credentials.apiBaseUrl.replace(/\\/$/, "")}}',
|
|
32
|
-
url: '/validate',
|
|
32
|
+
url: '/integrations/validate-token',
|
|
33
33
|
method: 'GET',
|
|
34
34
|
headers: {
|
|
35
35
|
Authorization: '={{ "Bearer " + $credentials.accessToken }}',
|
|
@@ -8,14 +8,18 @@ class CortexTrigger {
|
|
|
8
8
|
name: 'cortexTrigger',
|
|
9
9
|
icon: 'file:cortex.png',
|
|
10
10
|
group: ['trigger'],
|
|
11
|
-
version:
|
|
12
|
-
description: '
|
|
11
|
+
version: 2,
|
|
12
|
+
description: 'Recebe eventos do Cortex via webhook: mensagens, atualizações de prompt e atribuições de conversa.',
|
|
13
13
|
defaults: {
|
|
14
14
|
name: 'Cortex Trigger',
|
|
15
15
|
},
|
|
16
16
|
inputs: [],
|
|
17
17
|
outputs: ['main', 'main', 'main'],
|
|
18
|
-
outputNames: [
|
|
18
|
+
outputNames: [
|
|
19
|
+
'Mensagens Recebidas',
|
|
20
|
+
'Prompt Atualizado',
|
|
21
|
+
'Conversa Atribuída',
|
|
22
|
+
],
|
|
19
23
|
properties: [
|
|
20
24
|
{
|
|
21
25
|
displayName: 'Webhook Secret',
|
|
@@ -23,7 +27,7 @@ class CortexTrigger {
|
|
|
23
27
|
type: 'string',
|
|
24
28
|
default: '',
|
|
25
29
|
placeholder: 'your-secret-token',
|
|
26
|
-
description: '
|
|
30
|
+
description: 'Token secreto para validar requisições. Usado tanto na verificação (hub.verify_token) quanto na recepção de dados (Bearer token).',
|
|
27
31
|
required: true,
|
|
28
32
|
},
|
|
29
33
|
{
|
|
@@ -37,7 +41,21 @@ class CortexTrigger {
|
|
|
37
41
|
{ name: 'Conversation Assigned', value: 'ai_assignment' },
|
|
38
42
|
],
|
|
39
43
|
default: ['*'],
|
|
40
|
-
description: '
|
|
44
|
+
description: 'Quais eventos escutar. Selecione eventos específicos ou "All Events" para receber tudo.',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
displayName: 'Saída separada para Prompt Atualizado',
|
|
48
|
+
name: 'enablePromptOutput',
|
|
49
|
+
type: 'boolean',
|
|
50
|
+
default: true,
|
|
51
|
+
description: 'Quando LIGADO, eventos de atualização de prompt do agente saem pela 2ª saída (Prompt Atualizado). Quando DESLIGADO, vão para a 1ª saída (Mensagens Recebidas).',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
displayName: 'Saída separada para Conversa Atribuída',
|
|
55
|
+
name: 'enableAssignmentOutput',
|
|
56
|
+
type: 'boolean',
|
|
57
|
+
default: true,
|
|
58
|
+
description: 'Quando LIGADO, eventos de atribuição de conversa a um agente IA saem pela 3ª saída (Conversa Atribuída). Quando DESLIGADO, vão para a 1ª saída (Mensagens Recebidas).',
|
|
41
59
|
},
|
|
42
60
|
],
|
|
43
61
|
webhooks: [
|
|
@@ -104,8 +122,8 @@ class CortexTrigger {
|
|
|
104
122
|
};
|
|
105
123
|
}
|
|
106
124
|
const events = this.getNodeParameter('events', []);
|
|
107
|
-
const eventType = ((_a = body) === null || _a === void 0 ? void 0 : _a.event) || ((_b = body) === null || _b === void 0 ? void 0 : _b.type) || '
|
|
108
|
-
if (events.length > 0 && !events.includes('*') && !events.includes(eventType)) {
|
|
125
|
+
const eventType = String(((_a = body) === null || _a === void 0 ? void 0 : _a.event) || ((_b = body) === null || _b === void 0 ? void 0 : _b.type) || '').trim();
|
|
126
|
+
if (events.length > 0 && !events.includes('*') && eventType && !events.includes(eventType)) {
|
|
109
127
|
return {
|
|
110
128
|
webhookResponse: {
|
|
111
129
|
status: 200,
|
|
@@ -113,11 +131,13 @@ class CortexTrigger {
|
|
|
113
131
|
},
|
|
114
132
|
};
|
|
115
133
|
}
|
|
134
|
+
const enablePromptOutput = this.getNodeParameter('enablePromptOutput', true);
|
|
135
|
+
const enableAssignmentOutput = this.getNodeParameter('enableAssignmentOutput', true);
|
|
116
136
|
const outputData = this.helpers.returnJsonArray(body);
|
|
117
|
-
if (eventType === 'agent_prompt_updated') {
|
|
137
|
+
if (eventType === 'agent_prompt_updated' && enablePromptOutput) {
|
|
118
138
|
return { workflowData: [[], outputData, []] };
|
|
119
139
|
}
|
|
120
|
-
else if (eventType === 'ai_assignment') {
|
|
140
|
+
else if (eventType === 'ai_assignment' && enableAssignmentOutput) {
|
|
121
141
|
return { workflowData: [[], [], outputData] };
|
|
122
142
|
}
|
|
123
143
|
else {
|