n8n-nodes-underchat 0.1.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.
package/LICENSE.md ADDED
@@ -0,0 +1,7 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 UnderChat
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED.
package/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # n8n-nodes-underchat
2
+
3
+ Community Node do n8n para integrar workflows à API pública da UnderChat.
4
+
5
+ ## Operações do MVP
6
+
7
+ - Buscar contato por telefone
8
+ - Criar contato
9
+ - Enviar mensagem de texto por `chat_id`
10
+ - Enviar mensagem por telefone, criando o contato quando necessário
11
+ - Enviar template oficial em uma conversa
12
+
13
+ A operação **Enviar mensagem por telefone** executa automaticamente:
14
+
15
+ ```text
16
+ buscar contato → criar se necessário → iniciar conversa → enviar mensagem
17
+ ```
18
+
19
+ ## Requisitos
20
+
21
+ - Node.js 22 ou superior
22
+ - n8n com suporte a Community Nodes
23
+ - Conta UnderChat com plano ativo
24
+ - Token da API pública
25
+ - UUID de um usuário executor ativo
26
+
27
+ ## Desenvolvimento
28
+
29
+ ```bash
30
+ npm install
31
+ npm run build
32
+ npm run lint
33
+ npm run dev
34
+ ```
35
+
36
+ O modo de desenvolvimento inicia uma instância do n8n com o node carregado.
37
+
38
+ ## Credenciais
39
+
40
+ No n8n, crie uma credencial **UnderChat API** e informe:
41
+
42
+ - **API Key:** token gerado em `Integração → API pública`.
43
+ - **ID do Usuário Executor:** UUID do usuário cujas permissões serão aplicadas.
44
+ - **URL Base:** mantenha `https://api-public.underchat.com.br/v1` em produção.
45
+
46
+ A integração envia a chave no header `keyapi` e o executor em
47
+ `x-underchat-user-id`.
48
+
49
+ ## Teste seguro
50
+
51
+ O envio de mensagens produz efeito real no canal configurado. Use um contato e um
52
+ canal controlados durante a validação.
53
+
54
+ ## Documentação
55
+
56
+ - [UnderChat Developers](https://docs.underchat.com.br/)
57
+ - [Criação de nodes do n8n](https://docs.n8n.io/integrations/creating-nodes/)
58
+
59
+ ## Licença
60
+
61
+ MIT
@@ -0,0 +1,10 @@
1
+ import type { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class UnderChatApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ icon: "file:../nodes/UnderChat/underchat.svg";
6
+ documentationUrl: string;
7
+ properties: INodeProperties[];
8
+ authenticate: IAuthenticateGeneric;
9
+ test: ICredentialTestRequest;
10
+ }
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnderChatApi = void 0;
4
+ class UnderChatApi {
5
+ constructor() {
6
+ this.name = 'underChatApi';
7
+ this.displayName = 'UnderChat API';
8
+ this.icon = 'file:../nodes/UnderChat/underchat.svg';
9
+ this.documentationUrl = 'https://docs.underchat.com.br/guias/primeiros-passos';
10
+ this.properties = [
11
+ {
12
+ displayName: 'API Key',
13
+ name: 'apiKey',
14
+ type: 'string',
15
+ typeOptions: { password: true },
16
+ default: '',
17
+ required: true,
18
+ description: 'Token gerado em Integração → API pública no painel da UnderChat',
19
+ },
20
+ {
21
+ displayName: 'ID do Usuário Executor',
22
+ name: 'userId',
23
+ type: 'string',
24
+ default: '',
25
+ required: true,
26
+ description: 'UUID do usuário que executará as operações e cujas permissões serão aplicadas',
27
+ },
28
+ {
29
+ displayName: 'URL Base',
30
+ name: 'baseUrl',
31
+ type: 'string',
32
+ default: 'https://api-public.underchat.com.br/v1',
33
+ required: true,
34
+ description: 'Altere somente para usar outro ambiente da UnderChat',
35
+ },
36
+ ];
37
+ this.authenticate = {
38
+ type: 'generic',
39
+ properties: {
40
+ headers: {
41
+ keyapi: '={{$credentials.apiKey}}',
42
+ 'x-underchat-user-id': '={{$credentials.userId}}',
43
+ },
44
+ },
45
+ };
46
+ this.test = {
47
+ request: {
48
+ baseURL: '={{$credentials.baseUrl.replace(/\\/$/, "")}}',
49
+ url: '/chat',
50
+ qs: { status: 'my_chats', per_page: 1 },
51
+ },
52
+ };
53
+ }
54
+ }
55
+ exports.UnderChatApi = UnderChatApi;
56
+ //# sourceMappingURL=UnderChatApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnderChatApi.credentials.js","sourceRoot":"","sources":["../../credentials/UnderChatApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,YAAY;IAAzB;QACC,SAAI,GAAG,cAAc,CAAC;QAEtB,gBAAW,GAAG,eAAe,CAAC;QAE9B,SAAI,GAAG,uCAAgD,CAAC;QAExD,qBAAgB,GAAG,sDAAsD,CAAC;QAE1E,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,iEAAiE;aAC9E;YACD;gBACC,WAAW,EAAE,wBAAwB;gBACrC,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,+EAA+E;aAC5F;YACD;gBACC,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,wCAAwC;gBACjD,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,sDAAsD;aACnE;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,MAAM,EAAE,0BAA0B;oBAClC,qBAAqB,EAAE,0BAA0B;iBACjD;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,+CAA+C;gBACxD,GAAG,EAAE,OAAO;gBACZ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,EAAE;aACvC;SACD,CAAC;IACH,CAAC;CAAA;AAtDD,oCAsDC"}
@@ -0,0 +1,9 @@
1
+ import type { IDataObject, IExecuteFunctions, IHttpRequestMethods } from 'n8n-workflow';
2
+ export declare function underChatApiRequest(this: IExecuteFunctions, method: IHttpRequestMethods, endpoint: string, body?: IDataObject, qs?: IDataObject): Promise<IDataObject>;
3
+ export declare function responseData(response: IDataObject): unknown;
4
+ export declare function firstRecord(response: IDataObject): IDataObject | undefined;
5
+ export declare function getOpaqueId(record: IDataObject | undefined, names: string[]): string | undefined;
6
+ export declare function parseJsonObject(value: string): IDataObject;
7
+ export declare function isNotFoundError(error: unknown): boolean;
8
+ export declare function parseJsonArray(value: string): IDataObject[];
9
+ export declare function withoutEmptyValues(object: IDataObject): IDataObject;
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.underChatApiRequest = underChatApiRequest;
4
+ exports.responseData = responseData;
5
+ exports.firstRecord = firstRecord;
6
+ exports.getOpaqueId = getOpaqueId;
7
+ exports.parseJsonObject = parseJsonObject;
8
+ exports.isNotFoundError = isNotFoundError;
9
+ exports.parseJsonArray = parseJsonArray;
10
+ exports.withoutEmptyValues = withoutEmptyValues;
11
+ async function underChatApiRequest(method, endpoint, body = {}, qs = {}) {
12
+ const credentials = await this.getCredentials('underChatApi');
13
+ const baseUrl = String(credentials.baseUrl).replace(/\/$/, '');
14
+ const options = {
15
+ method,
16
+ url: `${baseUrl}${endpoint}`,
17
+ json: true,
18
+ };
19
+ if (Object.keys(body).length > 0)
20
+ options.body = body;
21
+ if (Object.keys(qs).length > 0)
22
+ options.qs = qs;
23
+ return (await this.helpers.httpRequestWithAuthentication.call(this, 'underChatApi', options));
24
+ }
25
+ function responseData(response) {
26
+ var _a;
27
+ return (_a = response.data) !== null && _a !== void 0 ? _a : response;
28
+ }
29
+ function firstRecord(response) {
30
+ const data = responseData(response);
31
+ if (Array.isArray(data))
32
+ return data[0];
33
+ if (data && typeof data === 'object') {
34
+ const record = data;
35
+ if (Array.isArray(record.items))
36
+ return record.items[0];
37
+ return record;
38
+ }
39
+ return undefined;
40
+ }
41
+ function getOpaqueId(record, names) {
42
+ if (!record)
43
+ return undefined;
44
+ for (const name of names) {
45
+ const value = record[name];
46
+ if (typeof value === 'string' || typeof value === 'number')
47
+ return String(value);
48
+ }
49
+ return undefined;
50
+ }
51
+ function parseJsonObject(value) {
52
+ if (!value.trim())
53
+ return {};
54
+ const parsed = JSON.parse(value);
55
+ if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed))
56
+ return {};
57
+ return parsed;
58
+ }
59
+ function isNotFoundError(error) {
60
+ var _a, _b, _c, _d, _e, _f;
61
+ if (!error || typeof error !== 'object')
62
+ return false;
63
+ const candidate = error;
64
+ const statuses = [
65
+ candidate.httpCode,
66
+ candidate.statusCode,
67
+ (_a = candidate.response) === null || _a === void 0 ? void 0 : _a.status,
68
+ (_b = candidate.response) === null || _b === void 0 ? void 0 : _b.statusCode,
69
+ (_d = (_c = candidate.cause) === null || _c === void 0 ? void 0 : _c.response) === null || _d === void 0 ? void 0 : _d.status,
70
+ (_f = (_e = candidate.cause) === null || _e === void 0 ? void 0 : _e.response) === null || _f === void 0 ? void 0 : _f.statusCode,
71
+ ];
72
+ return statuses.some((status) => String(status) === '404');
73
+ }
74
+ function parseJsonArray(value) {
75
+ if (!value.trim())
76
+ return [];
77
+ const parsed = JSON.parse(value);
78
+ if (!Array.isArray(parsed))
79
+ return [];
80
+ return parsed;
81
+ }
82
+ function withoutEmptyValues(object) {
83
+ return Object.fromEntries(Object.entries(object).filter(([, value]) => value !== '' && value !== undefined));
84
+ }
85
+ //# sourceMappingURL=GenericFunctions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GenericFunctions.js","sourceRoot":"","sources":["../../../nodes/UnderChat/GenericFunctions.ts"],"names":[],"mappings":";;AAOA,kDAuBC;AAED,oCAEC;AAED,kCASC;AAED,kCAOC;AAED,0CAKC;AAED,0CAiBC;AAED,wCAKC;AAED,gDAIC;AAtFM,KAAK,UAAU,mBAAmB,CAExC,MAA2B,EAC3B,QAAgB,EAChB,OAAoB,EAAE,EACtB,KAAkB,EAAE;IAEpB,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;IAC9D,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC/D,MAAM,OAAO,GAAwB;QACpC,MAAM;QACN,GAAG,EAAE,GAAG,OAAO,GAAG,QAAQ,EAAE;QAC5B,IAAI,EAAE,IAAI;KACV,CAAC;IAEF,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IACtD,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;IAEhD,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,6BAA6B,CAAC,IAAI,CAC5D,IAAI,EACJ,cAAc,EACd,OAAO,CACP,CAAgB,CAAC;AACnB,CAAC;AAED,SAAgB,YAAY,CAAC,QAAqB;;IACjD,OAAO,MAAA,QAAQ,CAAC,IAAI,mCAAI,QAAQ,CAAC;AAClC,CAAC;AAED,SAAgB,WAAW,CAAC,QAAqB;IAChD,MAAM,I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AAG,KAKjB,CAAC;IACF,MAAM,QAAQ,GAAG;QAChB,SAAS,CAAC,QAAQ;QAClB,SAAS,CAAC,UAAU;QACpB,MAAA,SAAS,CAAC,QAAQ,0CAAE,MAAM;QAC1B,MAAA,SAAS,CAAC,QAAQ,0CAAE,UAAU;QAC9B,MAAA,MAAA,SAAS,CAAC,KAAK,0CAAE,QAAQ,0CAAE,MAAM;QACjC,MAAA,MAAA,SAAS,CAAC,KAAK,0CAAE,QAAQ,0CAAE,UAAU;KACrC,CAAC;IACF,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,KAAK,CAAC,CAAC;AAC5D,CAAC;AAED,SAAgB,cAAc,CAAC,KAAa;IAC3C,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,CAAC;IAC7B,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAY,CAAC;IAC5C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;QAAE,OAAO,EAAE,CAAC;IACtC,OAAO,MAAuB,CAAC;AAChC,CAAC;AAED,SAAgB,kBAAkB,CAAC,MAAmB;IACrD,OAAO,MAAM,CAAC,WAAW,CACxB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,SAAS,CAAC,CACjF,CAAC;AACH,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class UnderChat implements INodeType {
3
+ description: INodeTypeDescription;
4
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
+ }
@@ -0,0 +1,254 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnderChat = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const GenericFunctions_1 = require("./GenericFunctions");
6
+ const showFor = (operations) => ({ show: { operation: operations } });
7
+ class UnderChat {
8
+ constructor() {
9
+ this.description = {
10
+ displayName: 'UnderChat',
11
+ name: 'underChat',
12
+ icon: { light: 'file:underchat.svg', dark: 'file:underchat.dark.svg' },
13
+ group: ['transform'],
14
+ version: 1,
15
+ description: 'Gerencie contatos e envie mensagens pela UnderChat',
16
+ subtitle: '={{$parameter["operation"]}}',
17
+ defaults: { name: 'UnderChat' },
18
+ inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
19
+ outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
20
+ usableAsTool: true,
21
+ credentials: [{ name: 'underChatApi', required: true }],
22
+ properties: [
23
+ {
24
+ displayName: 'Operação',
25
+ name: 'operation',
26
+ type: 'options',
27
+ noDataExpression: true,
28
+ options: [
29
+ { name: 'Buscar Contato Por Telefone', value: 'findContactByPhone', action: 'Buscar contato por telefone' },
30
+ { name: 'Criar Contato', value: 'createContact', action: 'Criar contato' },
31
+ { name: 'Enviar Mensagem Por Chat ID', value: 'sendText', action: 'Enviar mensagem por chat ID' },
32
+ { name: 'Enviar Mensagem Por Telefone', value: 'sendTextByPhone', action: 'Enviar mensagem por telefone' },
33
+ { name: 'Enviar Template Oficial', value: 'sendOfficialTemplate', action: 'Enviar template oficial' },
34
+ ],
35
+ default: 'sendTextByPhone',
36
+ },
37
+ {
38
+ displayName: 'DDI',
39
+ name: 'phoneDdi',
40
+ type: 'string',
41
+ default: '55',
42
+ required: true,
43
+ description: 'Código do país sem o sinal de mais',
44
+ displayOptions: showFor(['findContactByPhone', 'createContact', 'sendTextByPhone']),
45
+ },
46
+ {
47
+ displayName: 'Telefone',
48
+ name: 'phone',
49
+ type: 'string',
50
+ default: '',
51
+ required: true,
52
+ description: 'DDD e número, contendo somente números e sem o DDI',
53
+ displayOptions: showFor(['findContactByPhone', 'createContact', 'sendTextByPhone']),
54
+ },
55
+ {
56
+ displayName: 'Nome',
57
+ name: 'contactName',
58
+ type: 'string',
59
+ default: '',
60
+ required: true,
61
+ displayOptions: showFor(['createContact']),
62
+ },
63
+ {
64
+ displayName: 'Nome Para Novo Contato',
65
+ name: 'contactName',
66
+ type: 'string',
67
+ default: '',
68
+ description: 'Usado somente se o contato ainda não existir',
69
+ displayOptions: showFor(['sendTextByPhone']),
70
+ },
71
+ {
72
+ displayName: 'Worker ID',
73
+ name: 'workerId',
74
+ type: 'string',
75
+ default: '',
76
+ description: 'UUID do canal/worker usado para localizar ou iniciar o atendimento',
77
+ displayOptions: showFor(['findContactByPhone', 'createContact', 'sendTextByPhone']),
78
+ },
79
+ {
80
+ displayName: 'Criar Se Não Existir',
81
+ name: 'createIfMissing',
82
+ type: 'boolean',
83
+ default: true,
84
+ displayOptions: showFor(['sendTextByPhone']),
85
+ },
86
+ {
87
+ displayName: 'Sector ID',
88
+ name: 'sectorId',
89
+ type: 'string',
90
+ default: '',
91
+ description: 'Setor inicial opcional para uma nova conversa',
92
+ displayOptions: showFor(['sendTextByPhone']),
93
+ },
94
+ {
95
+ displayName: 'Chat ID',
96
+ name: 'chatId',
97
+ type: 'string',
98
+ default: '',
99
+ required: true,
100
+ displayOptions: showFor(['sendText', 'sendOfficialTemplate']),
101
+ },
102
+ {
103
+ displayName: 'Mensagem',
104
+ name: 'message',
105
+ type: 'string',
106
+ typeOptions: { rows: 4 },
107
+ default: '',
108
+ required: true,
109
+ displayOptions: showFor(['sendText', 'sendTextByPhone']),
110
+ },
111
+ {
112
+ displayName: 'Nome Do Template',
113
+ name: 'templateName',
114
+ type: 'string',
115
+ default: '',
116
+ required: true,
117
+ displayOptions: showFor(['sendOfficialTemplate']),
118
+ },
119
+ {
120
+ displayName: 'Idioma',
121
+ name: 'templateLanguage',
122
+ type: 'string',
123
+ default: 'pt_BR',
124
+ required: true,
125
+ displayOptions: showFor(['sendOfficialTemplate']),
126
+ },
127
+ {
128
+ displayName: 'Variáveis (JSON)',
129
+ name: 'templateVariables',
130
+ type: 'json',
131
+ default: '[]',
132
+ description: 'Lista com key, component_type, index, value e button_index quando aplicável',
133
+ displayOptions: showFor(['sendOfficialTemplate']),
134
+ },
135
+ {
136
+ displayName: 'Campos Adicionais (JSON)',
137
+ name: 'additionalFields',
138
+ type: 'json',
139
+ default: '{}',
140
+ description: 'Campos opcionais aceitos pela API para criação do contato',
141
+ displayOptions: showFor(['createContact', 'sendTextByPhone']),
142
+ },
143
+ ],
144
+ };
145
+ }
146
+ async execute() {
147
+ const items = this.getInputData();
148
+ const output = [];
149
+ for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
150
+ try {
151
+ const operation = this.getNodeParameter('operation', itemIndex);
152
+ let result;
153
+ if (operation === 'findContactByPhone') {
154
+ const phoneDdi = this.getNodeParameter('phoneDdi', itemIndex);
155
+ const phone = this.getNodeParameter('phone', itemIndex);
156
+ const workerId = this.getNodeParameter('workerId', itemIndex, '');
157
+ const response = await GenericFunctions_1.underChatApiRequest.call(this, 'GET', '/chat/contacts/by-phone', {}, (0, GenericFunctions_1.withoutEmptyValues)({ phone_ddi: phoneDdi, phone, worker_id: workerId }));
158
+ result = (0, GenericFunctions_1.responseData)(response);
159
+ }
160
+ else if (operation === 'createContact') {
161
+ const phoneDdi = this.getNodeParameter('phoneDdi', itemIndex);
162
+ const phone = this.getNodeParameter('phone', itemIndex);
163
+ const name = this.getNodeParameter('contactName', itemIndex);
164
+ const workerId = this.getNodeParameter('workerId', itemIndex, '');
165
+ const extra = (0, GenericFunctions_1.parseJsonObject)(this.getNodeParameter('additionalFields', itemIndex, '{}'));
166
+ await GenericFunctions_1.underChatApiRequest.call(this, 'POST', '/chat/contacts', (0, GenericFunctions_1.withoutEmptyValues)({ name, phone_ddi: phoneDdi, phone, worker_id: workerId, ...extra }));
167
+ const foundResponse = await GenericFunctions_1.underChatApiRequest.call(this, 'GET', '/chat/contacts/by-phone', {}, (0, GenericFunctions_1.withoutEmptyValues)({ phone_ddi: phoneDdi, phone, worker_id: workerId }));
168
+ result = (0, GenericFunctions_1.responseData)(foundResponse);
169
+ }
170
+ else if (operation === 'sendText') {
171
+ const chatId = this.getNodeParameter('chatId', itemIndex);
172
+ const message = this.getNodeParameter('message', itemIndex);
173
+ const response = await GenericFunctions_1.underChatApiRequest.call(this, 'POST', `/chat/${chatId}`, {
174
+ type: 'text',
175
+ message,
176
+ });
177
+ result = (0, GenericFunctions_1.responseData)(response);
178
+ }
179
+ else if (operation === 'sendOfficialTemplate') {
180
+ const chatId = this.getNodeParameter('chatId', itemIndex);
181
+ const name = this.getNodeParameter('templateName', itemIndex);
182
+ const language = this.getNodeParameter('templateLanguage', itemIndex);
183
+ const variables = (0, GenericFunctions_1.parseJsonArray)(this.getNodeParameter('templateVariables', itemIndex, '[]'));
184
+ const response = await GenericFunctions_1.underChatApiRequest.call(this, 'POST', `/chat/${chatId}/official-template`, { name, language, variables });
185
+ result = (0, GenericFunctions_1.responseData)(response);
186
+ }
187
+ else if (operation === 'sendTextByPhone') {
188
+ const phoneDdi = this.getNodeParameter('phoneDdi', itemIndex);
189
+ const phone = this.getNodeParameter('phone', itemIndex);
190
+ const name = this.getNodeParameter('contactName', itemIndex, '');
191
+ const message = this.getNodeParameter('message', itemIndex);
192
+ const workerId = this.getNodeParameter('workerId', itemIndex);
193
+ const sectorId = this.getNodeParameter('sectorId', itemIndex, '');
194
+ const createIfMissing = this.getNodeParameter('createIfMissing', itemIndex);
195
+ const extra = (0, GenericFunctions_1.parseJsonObject)(this.getNodeParameter('additionalFields', itemIndex, '{}'));
196
+ let contact;
197
+ try {
198
+ const foundResponse = await GenericFunctions_1.underChatApiRequest.call(this, 'GET', '/chat/contacts/by-phone', {}, (0, GenericFunctions_1.withoutEmptyValues)({ phone_ddi: phoneDdi, phone, worker_id: workerId }));
199
+ contact = (0, GenericFunctions_1.firstRecord)(foundResponse);
200
+ }
201
+ catch (error) {
202
+ if (!(0, GenericFunctions_1.isNotFoundError)(error)) {
203
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, { itemIndex });
204
+ }
205
+ }
206
+ let created = false;
207
+ if (!(0, GenericFunctions_1.getOpaqueId)(contact, ['contact_id', 'id'])) {
208
+ if (!createIfMissing)
209
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Contato não encontrado', { itemIndex });
210
+ if (!name)
211
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Informe o nome para criar o contato', { itemIndex });
212
+ await GenericFunctions_1.underChatApiRequest.call(this, 'POST', '/chat/contacts', (0, GenericFunctions_1.withoutEmptyValues)({ name, phone_ddi: phoneDdi, phone, worker_id: workerId, ...extra }));
213
+ const refreshedResponse = await GenericFunctions_1.underChatApiRequest.call(this, 'GET', '/chat/contacts/by-phone', {}, (0, GenericFunctions_1.withoutEmptyValues)({ phone_ddi: phoneDdi, phone, worker_id: workerId }));
214
+ contact = (0, GenericFunctions_1.firstRecord)(refreshedResponse);
215
+ created = true;
216
+ }
217
+ const contactId = (0, GenericFunctions_1.getOpaqueId)(contact, ['contact_id', 'id']);
218
+ if (!contactId)
219
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'A API não retornou o ID do contato', { itemIndex });
220
+ if (!workerId)
221
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Informe o Worker ID para iniciar a conversa', { itemIndex });
222
+ const startedResponse = await GenericFunctions_1.underChatApiRequest.call(this, 'POST', '/chat/start-with-contact', (0, GenericFunctions_1.withoutEmptyValues)({ contact_id: contactId, worker_id: workerId, sector_id: sectorId }));
223
+ const chat = (0, GenericFunctions_1.firstRecord)(startedResponse);
224
+ const chatId = (0, GenericFunctions_1.getOpaqueId)(chat, ['chat_id', 'id']);
225
+ if (!chatId)
226
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'A API não retornou o ID do chat', { itemIndex });
227
+ const messageResponse = await GenericFunctions_1.underChatApiRequest.call(this, 'POST', `/chat/${chatId}`, {
228
+ type: 'text',
229
+ message,
230
+ });
231
+ result = {
232
+ contact: { ...contact, created },
233
+ chat,
234
+ message: (0, GenericFunctions_1.responseData)(messageResponse),
235
+ };
236
+ }
237
+ else {
238
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Operação não implementada: ${operation}`, { itemIndex });
239
+ }
240
+ output.push({ json: result, pairedItem: itemIndex });
241
+ }
242
+ catch (error) {
243
+ if (this.continueOnFail()) {
244
+ output.push({ json: { error: error.message }, pairedItem: itemIndex });
245
+ continue;
246
+ }
247
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, { itemIndex });
248
+ }
249
+ }
250
+ return [output];
251
+ }
252
+ }
253
+ exports.UnderChat = UnderChat;
254
+ //# sourceMappingURL=UnderChat.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnderChat.node.js","sourceRoot":"","sources":["../../../nodes/UnderChat/UnderChat.node.ts"],"names":[],"mappings":";;;AAMA,+CAAuE;AAEvE,yDAS4B;AAE5B,MAAM,OAAO,GAAG,CAAC,UAAoB,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC;AAEhF,MAAa,SAAS;IAAtB;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,WAAW;YACxB,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,EAAE,KAAK,EAAE,oBAAoB,EAAE,IAAI,EAAE,yBAAyB,EAAE;YACtE,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,oDAAoD;YACjE,QAAQ,EAAE,8BAA8B;YACxC,QAAQ,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;YAC/B,MAAM,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YAClC,OAAO,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YACnC,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,cAAc,EA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AE,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE;wBAChC,IAAI;wBACJ,OAAO,EAAE,IAAA,+BAAY,EAAC,eAAe,CAAC;qBACtC,CAAC;gBACH,CAAC;qBAAM,CAAC;oBACP,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,8BAA8B,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;gBACxG,CAAC;gBAED,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAoC,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,CAAC;YACpF,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;oBAC3B,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAG,KAAe,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,CAAC;oBAClF,SAAS;gBACV,CAAC;gBACD,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAc,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;YAC7E,CAAC;QACF,CAAC;QAED,OAAO,CAAC,MAAM,CAAC,CAAC;IACjB,CAAC;CACD;AAlSD,8BAkSC"}
@@ -0,0 +1,5 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
2
+ <rect width="64" height="64" rx="14" fill="#5B75FF"/>
3
+ <path d="M16 18h10v24c0 4 2 6 6 6s6-2 6-6V18h10v25c0 10-6 15-16 15S16 53 16 43V18Z" fill="#fff"/>
4
+ <path d="M38 18h10v8H38z" fill="#35E3A4"/>
5
+ </svg>
@@ -0,0 +1,5 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
2
+ <rect width="64" height="64" rx="14" fill="#183BFF"/>
3
+ <path d="M16 18h10v24c0 4 2 6 6 6s6-2 6-6V18h10v25c0 10-6 15-16 15S16 53 16 43V18Z" fill="#fff"/>
4
+ <path d="M38 18h10v8H38z" fill="#35E3A4"/>
5
+ </svg>
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "n8n-nodes-underchat",
3
+ "version": "0.1.0",
4
+ "description": "Community Node do n8n para automações com a UnderChat",
5
+ "author": {
6
+ "name": "UnderChat",
7
+ "email": "contato@underchat.com.br"
8
+ },
9
+ "license": "MIT",
10
+ "keywords": [
11
+ "n8n-community-node-package",
12
+ "n8n",
13
+ "underchat",
14
+ "whatsapp",
15
+ "automation"
16
+ ],
17
+ "homepage": "https://underchat.com.br",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/sistemasunder/n8n-nodes-underchat.git"
21
+ },
22
+ "scripts": {
23
+ "build": "n8n-node build",
24
+ "dev": "n8n-node dev",
25
+ "lint": "n8n-node lint",
26
+ "lint:fix": "n8n-node lint --fix",
27
+ "prepublishOnly": "n8n-node prerelease",
28
+ "release": "n8n-node release"
29
+ },
30
+ "files": ["dist"],
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
34
+ "n8n": {
35
+ "n8nNodesApiVersion": 1,
36
+ "strict": true,
37
+ "credentials": ["dist/credentials/UnderChatApi.credentials.js"],
38
+ "nodes": ["dist/nodes/UnderChat/UnderChat.node.js"]
39
+ },
40
+ "devDependencies": {
41
+ "@n8n/node-cli": "*",
42
+ "eslint": "9.39.4",
43
+ "prettier": "3.8.3",
44
+ "typescript": "5.9.3"
45
+ },
46
+ "peerDependencies": {
47
+ "n8n-workflow": "*"
48
+ },
49
+ "engines": {
50
+ "node": ">=22.0.0"
51
+ }
52
+ }