n8n-nodes-wati 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 +22 -0
- package/dist/credentials/WatiApi.credentials.d.ts +9 -0
- package/dist/credentials/WatiApi.credentials.js +50 -0
- package/dist/credentials/WatiApi.credentials.js.map +1 -0
- package/dist/nodes/Wati/Wati.node.d.ts +5 -0
- package/dist/nodes/Wati/Wati.node.js +698 -0
- package/dist/nodes/Wati/Wati.node.js.map +1 -0
- package/dist/nodes/Wati/WatiTrigger.node.d.ts +12 -0
- package/dist/nodes/Wati/WatiTrigger.node.js +146 -0
- package/dist/nodes/Wati/WatiTrigger.node.js.map +1 -0
- package/dist/nodes/Wati/wati.svg +13 -0
- package/index.js +2 -0
- package/package.json +56 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 nliang
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class WatiApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
documentationUrl: string;
|
|
6
|
+
properties: INodeProperties[];
|
|
7
|
+
authenticate: IAuthenticateGeneric;
|
|
8
|
+
test: ICredentialTestRequest;
|
|
9
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WatiApi = void 0;
|
|
4
|
+
class WatiApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'watiApi';
|
|
7
|
+
this.displayName = 'WATI API';
|
|
8
|
+
this.documentationUrl = 'https://docs.wati.io/reference/introduction';
|
|
9
|
+
this.properties = [
|
|
10
|
+
{
|
|
11
|
+
displayName: 'API Endpoint URL',
|
|
12
|
+
name: 'apiUrl',
|
|
13
|
+
type: 'string',
|
|
14
|
+
default: '',
|
|
15
|
+
placeholder: 'https://live-mt-server.wati.io/123456',
|
|
16
|
+
description: 'The API endpoint URL from your WATI Dashboard → API Docs. Include the tenant ID (e.g. https://live-mt-server.wati.io/123456). The V3 base URL will be derived automatically.',
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
displayName: 'Access Token',
|
|
21
|
+
name: 'accessToken',
|
|
22
|
+
type: 'string',
|
|
23
|
+
typeOptions: { password: true },
|
|
24
|
+
default: '',
|
|
25
|
+
description: 'Bearer token for WATI API authentication. Find it in WATI Dashboard → API Docs.',
|
|
26
|
+
required: true,
|
|
27
|
+
},
|
|
28
|
+
];
|
|
29
|
+
this.authenticate = {
|
|
30
|
+
type: 'generic',
|
|
31
|
+
properties: {
|
|
32
|
+
headers: {
|
|
33
|
+
Authorization: '={{"Bearer " + $credentials.accessToken}}',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
this.test = {
|
|
38
|
+
request: {
|
|
39
|
+
baseURL: '={{$credentials.apiUrl.replace(/\\/+$/, "").replace(/\\/\\d+$/, "")}}',
|
|
40
|
+
url: '/api/ext/v3/contacts',
|
|
41
|
+
method: 'GET',
|
|
42
|
+
qs: {
|
|
43
|
+
pageSize: 1,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.WatiApi = WatiApi;
|
|
50
|
+
//# sourceMappingURL=WatiApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WatiApi.credentials.js","sourceRoot":"","sources":["../../credentials/WatiApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,OAAO;IAApB;QACC,SAAI,GAAG,SAAS,CAAC;QACjB,gBAAW,GAAG,UAAU,CAAC;QACzB,qBAAgB,GAAG,6CAA6C,CAAC;QACjE,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,kBAAkB;gBAC/B,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,uCAAuC;gBACpD,WAAW,EACV,8KAA8K;gBAC/K,QAAQ,EAAE,IAAI;aACd;YACD;gBACC,WAAW,EAAE,cAAc;gBAC3B,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,WAAW,EACV,iFAAiF;gBAClF,QAAQ,EAAE,IAAI;aACd;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,aAAa,EAAE,2CAA2C;iBAC1D;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EACN,uEAAuE;gBACxE,GAAG,EAAE,sBAAsB;gBAC3B,MAAM,EAAE,KAAK;gBACb,EAAE,EAAE;oBACH,QAAQ,EAAE,CAAC;iBACX;aACD;SACD,CAAC;IACH,CAAC;CAAA;AA/CD,0BA+CC"}
|
|
@@ -0,0 +1,698 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Wati = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
/**
|
|
6
|
+
* Derive the V3 base URL from the WATI dashboard URL.
|
|
7
|
+
* Dashboard URL format: https://live-mt-server.wati.io/200055
|
|
8
|
+
* V3 base URL format: https://live-mt-server.wati.io
|
|
9
|
+
*/
|
|
10
|
+
function getV3BaseUrl(apiUrl) {
|
|
11
|
+
const cleaned = apiUrl.replace(/\/+$/, '');
|
|
12
|
+
// Strip trailing tenant ID (numeric path segment)
|
|
13
|
+
return cleaned.replace(/\/\d+$/, '');
|
|
14
|
+
}
|
|
15
|
+
class Wati {
|
|
16
|
+
constructor() {
|
|
17
|
+
this.description = {
|
|
18
|
+
displayName: 'WATI',
|
|
19
|
+
name: 'wati',
|
|
20
|
+
icon: 'file:wati.svg',
|
|
21
|
+
group: ['transform'],
|
|
22
|
+
version: 1,
|
|
23
|
+
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
24
|
+
description: 'Send and receive WhatsApp messages via WATI V3 API',
|
|
25
|
+
defaults: {
|
|
26
|
+
name: 'WATI',
|
|
27
|
+
},
|
|
28
|
+
inputs: ['main'],
|
|
29
|
+
outputs: ['main'],
|
|
30
|
+
credentials: [
|
|
31
|
+
{
|
|
32
|
+
name: 'watiApi',
|
|
33
|
+
required: true,
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
properties: [
|
|
37
|
+
// ----------------------------------
|
|
38
|
+
// Resource
|
|
39
|
+
// ----------------------------------
|
|
40
|
+
{
|
|
41
|
+
displayName: 'Resource',
|
|
42
|
+
name: 'resource',
|
|
43
|
+
type: 'options',
|
|
44
|
+
noDataExpression: true,
|
|
45
|
+
options: [
|
|
46
|
+
{
|
|
47
|
+
name: 'Message',
|
|
48
|
+
value: 'message',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'Template Message',
|
|
52
|
+
value: 'templateMessage',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: 'Contact',
|
|
56
|
+
value: 'contact',
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
default: 'message',
|
|
60
|
+
},
|
|
61
|
+
// ----------------------------------
|
|
62
|
+
// Message Operations
|
|
63
|
+
// ----------------------------------
|
|
64
|
+
{
|
|
65
|
+
displayName: 'Operation',
|
|
66
|
+
name: 'operation',
|
|
67
|
+
type: 'options',
|
|
68
|
+
noDataExpression: true,
|
|
69
|
+
displayOptions: {
|
|
70
|
+
show: {
|
|
71
|
+
resource: ['message'],
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
options: [
|
|
75
|
+
{
|
|
76
|
+
name: 'Send Text Message',
|
|
77
|
+
value: 'sendTextMessage',
|
|
78
|
+
description: 'Send a text message to an active WhatsApp conversation (within 24h window)',
|
|
79
|
+
action: 'Send a text message',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: 'Send Interactive Buttons',
|
|
83
|
+
value: 'sendInteractiveButtons',
|
|
84
|
+
description: 'Send an interactive button message',
|
|
85
|
+
action: 'Send interactive buttons',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: 'Send Interactive List',
|
|
89
|
+
value: 'sendInteractiveList',
|
|
90
|
+
description: 'Send an interactive list message',
|
|
91
|
+
action: 'Send interactive list',
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: 'Get Messages',
|
|
95
|
+
value: 'getMessages',
|
|
96
|
+
description: 'Get messages for a conversation by conversation ID',
|
|
97
|
+
action: 'Get messages',
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
default: 'sendTextMessage',
|
|
101
|
+
},
|
|
102
|
+
// ----------------------------------
|
|
103
|
+
// Template Message Operations
|
|
104
|
+
// ----------------------------------
|
|
105
|
+
{
|
|
106
|
+
displayName: 'Operation',
|
|
107
|
+
name: 'operation',
|
|
108
|
+
type: 'options',
|
|
109
|
+
noDataExpression: true,
|
|
110
|
+
displayOptions: {
|
|
111
|
+
show: {
|
|
112
|
+
resource: ['templateMessage'],
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
options: [
|
|
116
|
+
{
|
|
117
|
+
name: 'Send Template Message',
|
|
118
|
+
value: 'sendTemplateMessage',
|
|
119
|
+
description: 'Send a template message (outside 24h window)',
|
|
120
|
+
action: 'Send a template message',
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: 'Get Templates',
|
|
124
|
+
value: 'getTemplates',
|
|
125
|
+
description: 'Get list of message templates',
|
|
126
|
+
action: 'Get templates',
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
default: 'sendTemplateMessage',
|
|
130
|
+
},
|
|
131
|
+
// ----------------------------------
|
|
132
|
+
// Contact Operations
|
|
133
|
+
// ----------------------------------
|
|
134
|
+
{
|
|
135
|
+
displayName: 'Operation',
|
|
136
|
+
name: 'operation',
|
|
137
|
+
type: 'options',
|
|
138
|
+
noDataExpression: true,
|
|
139
|
+
displayOptions: {
|
|
140
|
+
show: {
|
|
141
|
+
resource: ['contact'],
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
options: [
|
|
145
|
+
{
|
|
146
|
+
name: 'Get Contacts',
|
|
147
|
+
value: 'getContacts',
|
|
148
|
+
description: 'Get list of contacts',
|
|
149
|
+
action: 'Get contacts',
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
name: 'Get Contact Detail',
|
|
153
|
+
value: 'getContactDetail',
|
|
154
|
+
description: 'Get details of a specific contact by phone number',
|
|
155
|
+
action: 'Get contact detail',
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
name: 'Add Contact',
|
|
159
|
+
value: 'addContact',
|
|
160
|
+
description: 'Add a new contact',
|
|
161
|
+
action: 'Add a contact',
|
|
162
|
+
},
|
|
163
|
+
],
|
|
164
|
+
default: 'getContacts',
|
|
165
|
+
},
|
|
166
|
+
// ==================================
|
|
167
|
+
// Message Parameters
|
|
168
|
+
// ==================================
|
|
169
|
+
// --- Target (phone number or conversation ID) ---
|
|
170
|
+
{
|
|
171
|
+
displayName: 'Target (Phone Number)',
|
|
172
|
+
name: 'target',
|
|
173
|
+
type: 'string',
|
|
174
|
+
required: true,
|
|
175
|
+
default: '',
|
|
176
|
+
placeholder: '14155552671',
|
|
177
|
+
description: 'The target conversation. Can be a phone number (e.g. 14155552671), conversation ID, or Channel:PhoneNumber format.',
|
|
178
|
+
displayOptions: {
|
|
179
|
+
show: {
|
|
180
|
+
resource: ['message'],
|
|
181
|
+
operation: [
|
|
182
|
+
'sendTextMessage',
|
|
183
|
+
'sendInteractiveButtons',
|
|
184
|
+
'sendInteractiveList',
|
|
185
|
+
],
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
// --- Send Text Message ---
|
|
190
|
+
{
|
|
191
|
+
displayName: 'Message Text',
|
|
192
|
+
name: 'messageText',
|
|
193
|
+
type: 'string',
|
|
194
|
+
typeOptions: {
|
|
195
|
+
rows: 4,
|
|
196
|
+
},
|
|
197
|
+
required: true,
|
|
198
|
+
default: '',
|
|
199
|
+
placeholder: 'Hello, this is a test message!',
|
|
200
|
+
description: 'The text content of the message to send',
|
|
201
|
+
displayOptions: {
|
|
202
|
+
show: {
|
|
203
|
+
resource: ['message'],
|
|
204
|
+
operation: ['sendTextMessage'],
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
// --- Send Interactive Buttons ---
|
|
209
|
+
{
|
|
210
|
+
displayName: 'Body Text',
|
|
211
|
+
name: 'bodyText',
|
|
212
|
+
type: 'string',
|
|
213
|
+
typeOptions: { rows: 4 },
|
|
214
|
+
required: true,
|
|
215
|
+
default: '',
|
|
216
|
+
placeholder: 'Please choose an option:',
|
|
217
|
+
description: 'The body text of the interactive message',
|
|
218
|
+
displayOptions: {
|
|
219
|
+
show: {
|
|
220
|
+
resource: ['message'],
|
|
221
|
+
operation: ['sendInteractiveButtons'],
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
displayName: 'Buttons (JSON)',
|
|
227
|
+
name: 'buttonsJson',
|
|
228
|
+
type: 'json',
|
|
229
|
+
required: true,
|
|
230
|
+
default: '{\n "body": "Choose an option",\n "buttons": [\n { "text": "Yes" },\n { "text": "No" }\n ]\n}',
|
|
231
|
+
description: 'The button_message JSON object. "body" is a plain string, "buttons" is an array of {text} objects (max 3). Optional: "header" as {"type":"Text","text":"..."}, "footer" as a string.',
|
|
232
|
+
displayOptions: {
|
|
233
|
+
show: {
|
|
234
|
+
resource: ['message'],
|
|
235
|
+
operation: ['sendInteractiveButtons'],
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
// --- Send Interactive List ---
|
|
240
|
+
{
|
|
241
|
+
displayName: 'List Message (JSON)',
|
|
242
|
+
name: 'listJson',
|
|
243
|
+
type: 'json',
|
|
244
|
+
required: true,
|
|
245
|
+
default: '{\n "body": "Please select:",\n "button_text": "Select",\n "sections": [\n {\n "title": "Section 1",\n "rows": [\n { "id": "1", "title": "Option 1", "description": "Desc 1" },\n { "id": "2", "title": "Option 2", "description": "Desc 2" }\n ]\n }\n ]\n}',
|
|
246
|
+
description: 'The list_message JSON object. "body" is a plain string, "button_text" is the button label, "sections" is the array of section objects. Optional: "header" and "footer" as strings.',
|
|
247
|
+
displayOptions: {
|
|
248
|
+
show: {
|
|
249
|
+
resource: ['message'],
|
|
250
|
+
operation: ['sendInteractiveList'],
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
// --- Get Messages ---
|
|
255
|
+
{
|
|
256
|
+
displayName: 'Conversation ID',
|
|
257
|
+
name: 'conversationId',
|
|
258
|
+
type: 'string',
|
|
259
|
+
required: true,
|
|
260
|
+
default: '',
|
|
261
|
+
placeholder: '65b73810e2bd04...',
|
|
262
|
+
description: 'The conversation ID. You can find this in the response of a send message operation or from WATI dashboard.',
|
|
263
|
+
displayOptions: {
|
|
264
|
+
show: {
|
|
265
|
+
resource: ['message'],
|
|
266
|
+
operation: ['getMessages'],
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
displayName: 'Page Size',
|
|
272
|
+
name: 'pageSize',
|
|
273
|
+
type: 'number',
|
|
274
|
+
default: 20,
|
|
275
|
+
description: 'Number of messages to retrieve per page',
|
|
276
|
+
displayOptions: {
|
|
277
|
+
show: {
|
|
278
|
+
resource: ['message'],
|
|
279
|
+
operation: ['getMessages'],
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
displayName: 'Page Number',
|
|
285
|
+
name: 'pageNumber',
|
|
286
|
+
type: 'number',
|
|
287
|
+
default: 1,
|
|
288
|
+
description: 'Page number for pagination',
|
|
289
|
+
displayOptions: {
|
|
290
|
+
show: {
|
|
291
|
+
resource: ['message'],
|
|
292
|
+
operation: ['getMessages'],
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
// ==================================
|
|
297
|
+
// Template Message Parameters
|
|
298
|
+
// ==================================
|
|
299
|
+
{
|
|
300
|
+
displayName: 'Template Name',
|
|
301
|
+
name: 'templateName',
|
|
302
|
+
type: 'string',
|
|
303
|
+
required: true,
|
|
304
|
+
default: '',
|
|
305
|
+
placeholder: 'hello_world',
|
|
306
|
+
description: 'The name of the WhatsApp message template',
|
|
307
|
+
displayOptions: {
|
|
308
|
+
show: {
|
|
309
|
+
resource: ['templateMessage'],
|
|
310
|
+
operation: ['sendTemplateMessage'],
|
|
311
|
+
},
|
|
312
|
+
},
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
displayName: 'Broadcast Name',
|
|
316
|
+
name: 'broadcastName',
|
|
317
|
+
type: 'string',
|
|
318
|
+
required: true,
|
|
319
|
+
default: '',
|
|
320
|
+
placeholder: 'my_broadcast',
|
|
321
|
+
description: 'A name to identify this broadcast/campaign',
|
|
322
|
+
displayOptions: {
|
|
323
|
+
show: {
|
|
324
|
+
resource: ['templateMessage'],
|
|
325
|
+
operation: ['sendTemplateMessage'],
|
|
326
|
+
},
|
|
327
|
+
},
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
displayName: 'Recipients (JSON)',
|
|
331
|
+
name: 'recipientsJson',
|
|
332
|
+
type: 'json',
|
|
333
|
+
required: true,
|
|
334
|
+
default: '[\n {\n "whatsapp_number": "14155552671",\n "custom_params": [\n { "name": "name", "value": "John" }\n ]\n }\n]',
|
|
335
|
+
description: 'JSON array of recipients. Each must have whatsapp_number and optionally custom_params.',
|
|
336
|
+
displayOptions: {
|
|
337
|
+
show: {
|
|
338
|
+
resource: ['templateMessage'],
|
|
339
|
+
operation: ['sendTemplateMessage'],
|
|
340
|
+
},
|
|
341
|
+
},
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
displayName: 'Page Size',
|
|
345
|
+
name: 'templatePageSize',
|
|
346
|
+
type: 'number',
|
|
347
|
+
default: 20,
|
|
348
|
+
description: 'Number of templates to retrieve per page',
|
|
349
|
+
displayOptions: {
|
|
350
|
+
show: {
|
|
351
|
+
resource: ['templateMessage'],
|
|
352
|
+
operation: ['getTemplates'],
|
|
353
|
+
},
|
|
354
|
+
},
|
|
355
|
+
},
|
|
356
|
+
// ==================================
|
|
357
|
+
// Contact Parameters
|
|
358
|
+
// ==================================
|
|
359
|
+
{
|
|
360
|
+
displayName: 'Page Size',
|
|
361
|
+
name: 'contactPageSize',
|
|
362
|
+
type: 'number',
|
|
363
|
+
default: 20,
|
|
364
|
+
description: 'Number of contacts to retrieve per page',
|
|
365
|
+
displayOptions: {
|
|
366
|
+
show: {
|
|
367
|
+
resource: ['contact'],
|
|
368
|
+
operation: ['getContacts'],
|
|
369
|
+
},
|
|
370
|
+
},
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
displayName: 'Page Number',
|
|
374
|
+
name: 'contactPageNumber',
|
|
375
|
+
type: 'number',
|
|
376
|
+
default: 1,
|
|
377
|
+
description: 'Page number for pagination',
|
|
378
|
+
displayOptions: {
|
|
379
|
+
show: {
|
|
380
|
+
resource: ['contact'],
|
|
381
|
+
operation: ['getContacts'],
|
|
382
|
+
},
|
|
383
|
+
},
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
displayName: 'Phone Number',
|
|
387
|
+
name: 'phoneNumber',
|
|
388
|
+
type: 'string',
|
|
389
|
+
required: true,
|
|
390
|
+
default: '',
|
|
391
|
+
placeholder: '14155552671',
|
|
392
|
+
description: 'Phone number of the contact (with country code, no + prefix)',
|
|
393
|
+
displayOptions: {
|
|
394
|
+
show: {
|
|
395
|
+
resource: ['contact'],
|
|
396
|
+
operation: ['getContactDetail'],
|
|
397
|
+
},
|
|
398
|
+
},
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
displayName: 'WhatsApp Number',
|
|
402
|
+
name: 'whatsappNumber',
|
|
403
|
+
type: 'string',
|
|
404
|
+
required: true,
|
|
405
|
+
default: '',
|
|
406
|
+
placeholder: '14155552671',
|
|
407
|
+
description: 'Phone number (with country code, no + prefix)',
|
|
408
|
+
displayOptions: {
|
|
409
|
+
show: {
|
|
410
|
+
resource: ['contact'],
|
|
411
|
+
operation: ['addContact'],
|
|
412
|
+
},
|
|
413
|
+
},
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
displayName: 'Name',
|
|
417
|
+
name: 'contactName',
|
|
418
|
+
type: 'string',
|
|
419
|
+
required: true,
|
|
420
|
+
default: '',
|
|
421
|
+
placeholder: 'John Doe',
|
|
422
|
+
description: 'Name of the new contact',
|
|
423
|
+
displayOptions: {
|
|
424
|
+
show: {
|
|
425
|
+
resource: ['contact'],
|
|
426
|
+
operation: ['addContact'],
|
|
427
|
+
},
|
|
428
|
+
},
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
displayName: 'Custom Parameters (JSON)',
|
|
432
|
+
name: 'customParamsJson',
|
|
433
|
+
type: 'json',
|
|
434
|
+
default: '[]',
|
|
435
|
+
description: 'Optional JSON array of custom parameters, e.g. [{"name":"company","value":"Acme"}]',
|
|
436
|
+
displayOptions: {
|
|
437
|
+
show: {
|
|
438
|
+
resource: ['contact'],
|
|
439
|
+
operation: ['addContact'],
|
|
440
|
+
},
|
|
441
|
+
},
|
|
442
|
+
},
|
|
443
|
+
],
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
async execute() {
|
|
447
|
+
const items = this.getInputData();
|
|
448
|
+
const returnData = [];
|
|
449
|
+
const resource = this.getNodeParameter('resource', 0);
|
|
450
|
+
const operation = this.getNodeParameter('operation', 0);
|
|
451
|
+
const credentials = await this.getCredentials('watiApi');
|
|
452
|
+
const apiUrl = credentials.apiUrl;
|
|
453
|
+
const baseUrl = getV3BaseUrl(apiUrl);
|
|
454
|
+
for (let i = 0; i < items.length; i++) {
|
|
455
|
+
try {
|
|
456
|
+
let responseData;
|
|
457
|
+
// ========================
|
|
458
|
+
// Message
|
|
459
|
+
// ========================
|
|
460
|
+
if (resource === 'message') {
|
|
461
|
+
if (operation === 'sendTextMessage') {
|
|
462
|
+
const target = this.getNodeParameter('target', i);
|
|
463
|
+
const messageText = this.getNodeParameter('messageText', i);
|
|
464
|
+
const options = {
|
|
465
|
+
method: 'POST',
|
|
466
|
+
uri: `${baseUrl}/api/ext/v3/conversations/messages/text`,
|
|
467
|
+
headers: {
|
|
468
|
+
'Content-Type': 'application/json',
|
|
469
|
+
},
|
|
470
|
+
body: {
|
|
471
|
+
target,
|
|
472
|
+
text: messageText,
|
|
473
|
+
},
|
|
474
|
+
json: true,
|
|
475
|
+
};
|
|
476
|
+
responseData =
|
|
477
|
+
(await this.helpers.requestWithAuthentication.call(this, 'watiApi', options));
|
|
478
|
+
}
|
|
479
|
+
else if (operation === 'sendInteractiveButtons') {
|
|
480
|
+
const target = this.getNodeParameter('target', i);
|
|
481
|
+
const buttonsJsonRaw = this.getNodeParameter('buttonsJson', i);
|
|
482
|
+
let buttonMessage;
|
|
483
|
+
try {
|
|
484
|
+
buttonMessage =
|
|
485
|
+
typeof buttonsJsonRaw === 'string'
|
|
486
|
+
? JSON.parse(buttonsJsonRaw)
|
|
487
|
+
: buttonsJsonRaw;
|
|
488
|
+
}
|
|
489
|
+
catch {
|
|
490
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Invalid JSON in Buttons field.', { itemIndex: i });
|
|
491
|
+
}
|
|
492
|
+
const options = {
|
|
493
|
+
method: 'POST',
|
|
494
|
+
uri: `${baseUrl}/api/ext/v3/conversations/messages/interactive`,
|
|
495
|
+
headers: {
|
|
496
|
+
'Content-Type': 'application/json',
|
|
497
|
+
},
|
|
498
|
+
body: {
|
|
499
|
+
target,
|
|
500
|
+
type: 'buttons',
|
|
501
|
+
button_message: buttonMessage,
|
|
502
|
+
},
|
|
503
|
+
json: true,
|
|
504
|
+
};
|
|
505
|
+
responseData =
|
|
506
|
+
(await this.helpers.requestWithAuthentication.call(this, 'watiApi', options));
|
|
507
|
+
}
|
|
508
|
+
else if (operation === 'sendInteractiveList') {
|
|
509
|
+
const target = this.getNodeParameter('target', i);
|
|
510
|
+
const listJsonRaw = this.getNodeParameter('listJson', i);
|
|
511
|
+
let listMessage;
|
|
512
|
+
try {
|
|
513
|
+
listMessage =
|
|
514
|
+
typeof listJsonRaw === 'string'
|
|
515
|
+
? JSON.parse(listJsonRaw)
|
|
516
|
+
: listJsonRaw;
|
|
517
|
+
}
|
|
518
|
+
catch {
|
|
519
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Invalid JSON in List Message field.', { itemIndex: i });
|
|
520
|
+
}
|
|
521
|
+
const options = {
|
|
522
|
+
method: 'POST',
|
|
523
|
+
uri: `${baseUrl}/api/ext/v3/conversations/messages/interactive`,
|
|
524
|
+
headers: {
|
|
525
|
+
'Content-Type': 'application/json',
|
|
526
|
+
},
|
|
527
|
+
body: {
|
|
528
|
+
target,
|
|
529
|
+
type: 'list',
|
|
530
|
+
list_message: listMessage,
|
|
531
|
+
},
|
|
532
|
+
json: true,
|
|
533
|
+
};
|
|
534
|
+
responseData =
|
|
535
|
+
(await this.helpers.requestWithAuthentication.call(this, 'watiApi', options));
|
|
536
|
+
}
|
|
537
|
+
else if (operation === 'getMessages') {
|
|
538
|
+
const conversationId = this.getNodeParameter('conversationId', i);
|
|
539
|
+
const pageSize = this.getNodeParameter('pageSize', i, 20);
|
|
540
|
+
const pageNumber = this.getNodeParameter('pageNumber', i, 1);
|
|
541
|
+
const options = {
|
|
542
|
+
method: 'GET',
|
|
543
|
+
uri: `${baseUrl}/api/ext/v3/conversations/${encodeURIComponent(conversationId)}/messages`,
|
|
544
|
+
qs: {
|
|
545
|
+
pageSize,
|
|
546
|
+
pageNumber,
|
|
547
|
+
},
|
|
548
|
+
json: true,
|
|
549
|
+
};
|
|
550
|
+
responseData =
|
|
551
|
+
(await this.helpers.requestWithAuthentication.call(this, 'watiApi', options));
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
// ========================
|
|
555
|
+
// Template Message
|
|
556
|
+
// ========================
|
|
557
|
+
else if (resource === 'templateMessage') {
|
|
558
|
+
if (operation === 'sendTemplateMessage') {
|
|
559
|
+
const templateName = this.getNodeParameter('templateName', i);
|
|
560
|
+
const broadcastName = this.getNodeParameter('broadcastName', i);
|
|
561
|
+
const recipientsJsonRaw = this.getNodeParameter('recipientsJson', i);
|
|
562
|
+
let recipients;
|
|
563
|
+
try {
|
|
564
|
+
recipients =
|
|
565
|
+
typeof recipientsJsonRaw === 'string'
|
|
566
|
+
? JSON.parse(recipientsJsonRaw)
|
|
567
|
+
: recipientsJsonRaw;
|
|
568
|
+
}
|
|
569
|
+
catch {
|
|
570
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Invalid JSON in Recipients field.', { itemIndex: i });
|
|
571
|
+
}
|
|
572
|
+
const options = {
|
|
573
|
+
method: 'POST',
|
|
574
|
+
uri: `${baseUrl}/api/ext/v3/messageTemplates/send`,
|
|
575
|
+
headers: {
|
|
576
|
+
'Content-Type': 'application/json',
|
|
577
|
+
},
|
|
578
|
+
body: {
|
|
579
|
+
template_name: templateName,
|
|
580
|
+
broadcast_name: broadcastName,
|
|
581
|
+
recipients,
|
|
582
|
+
},
|
|
583
|
+
json: true,
|
|
584
|
+
};
|
|
585
|
+
responseData =
|
|
586
|
+
(await this.helpers.requestWithAuthentication.call(this, 'watiApi', options));
|
|
587
|
+
}
|
|
588
|
+
else if (operation === 'getTemplates') {
|
|
589
|
+
const pageSize = this.getNodeParameter('templatePageSize', i, 20);
|
|
590
|
+
const options = {
|
|
591
|
+
method: 'GET',
|
|
592
|
+
uri: `${baseUrl}/api/ext/v3/messageTemplates`,
|
|
593
|
+
qs: {
|
|
594
|
+
pageSize,
|
|
595
|
+
},
|
|
596
|
+
json: true,
|
|
597
|
+
};
|
|
598
|
+
responseData =
|
|
599
|
+
(await this.helpers.requestWithAuthentication.call(this, 'watiApi', options));
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
// ========================
|
|
603
|
+
// Contact
|
|
604
|
+
// ========================
|
|
605
|
+
else if (resource === 'contact') {
|
|
606
|
+
if (operation === 'getContacts') {
|
|
607
|
+
const pageSize = this.getNodeParameter('contactPageSize', i, 20);
|
|
608
|
+
const pageNumber = this.getNodeParameter('contactPageNumber', i, 1);
|
|
609
|
+
const options = {
|
|
610
|
+
method: 'GET',
|
|
611
|
+
uri: `${baseUrl}/api/ext/v3/contacts`,
|
|
612
|
+
qs: {
|
|
613
|
+
pageSize,
|
|
614
|
+
pageNumber,
|
|
615
|
+
},
|
|
616
|
+
json: true,
|
|
617
|
+
};
|
|
618
|
+
responseData =
|
|
619
|
+
(await this.helpers.requestWithAuthentication.call(this, 'watiApi', options));
|
|
620
|
+
}
|
|
621
|
+
else if (operation === 'getContactDetail') {
|
|
622
|
+
const phoneNumber = this.getNodeParameter('phoneNumber', i);
|
|
623
|
+
const options = {
|
|
624
|
+
method: 'GET',
|
|
625
|
+
uri: `${baseUrl}/api/ext/v3/contacts/${encodeURIComponent(phoneNumber)}`,
|
|
626
|
+
json: true,
|
|
627
|
+
};
|
|
628
|
+
responseData =
|
|
629
|
+
(await this.helpers.requestWithAuthentication.call(this, 'watiApi', options));
|
|
630
|
+
}
|
|
631
|
+
else if (operation === 'addContact') {
|
|
632
|
+
const whatsappNumber = this.getNodeParameter('whatsappNumber', i);
|
|
633
|
+
const contactName = this.getNodeParameter('contactName', i);
|
|
634
|
+
const customParamsJsonRaw = this.getNodeParameter('customParamsJson', i, '[]');
|
|
635
|
+
let customParams;
|
|
636
|
+
try {
|
|
637
|
+
customParams =
|
|
638
|
+
typeof customParamsJsonRaw === 'string'
|
|
639
|
+
? JSON.parse(customParamsJsonRaw)
|
|
640
|
+
: customParamsJsonRaw;
|
|
641
|
+
}
|
|
642
|
+
catch {
|
|
643
|
+
customParams = [];
|
|
644
|
+
}
|
|
645
|
+
const body = {
|
|
646
|
+
whatsapp_number: whatsappNumber,
|
|
647
|
+
name: contactName,
|
|
648
|
+
};
|
|
649
|
+
if (Array.isArray(customParams) &&
|
|
650
|
+
customParams.length > 0) {
|
|
651
|
+
body.custom_params = customParams;
|
|
652
|
+
}
|
|
653
|
+
const options = {
|
|
654
|
+
method: 'POST',
|
|
655
|
+
uri: `${baseUrl}/api/ext/v3/contacts`,
|
|
656
|
+
headers: {
|
|
657
|
+
'Content-Type': 'application/json',
|
|
658
|
+
},
|
|
659
|
+
body,
|
|
660
|
+
json: true,
|
|
661
|
+
};
|
|
662
|
+
responseData =
|
|
663
|
+
(await this.helpers.requestWithAuthentication.call(this, 'watiApi', options));
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
// Push response data
|
|
667
|
+
if (responseData !== undefined) {
|
|
668
|
+
if (Array.isArray(responseData)) {
|
|
669
|
+
returnData.push(...responseData.map((item) => ({
|
|
670
|
+
json: item,
|
|
671
|
+
})));
|
|
672
|
+
}
|
|
673
|
+
else {
|
|
674
|
+
returnData.push({
|
|
675
|
+
json: responseData,
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
catch (error) {
|
|
681
|
+
if (this.continueOnFail()) {
|
|
682
|
+
returnData.push({
|
|
683
|
+
json: {
|
|
684
|
+
error: error.message,
|
|
685
|
+
},
|
|
686
|
+
});
|
|
687
|
+
continue;
|
|
688
|
+
}
|
|
689
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, {
|
|
690
|
+
itemIndex: i,
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
return [returnData];
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
exports.Wati = Wati;
|
|
698
|
+
//# sourceMappingURL=Wati.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Wati.node.js","sourceRoot":"","sources":["../../../nodes/Wati/Wati.node.ts"],"names":[],"mappings":";;;AAAA,+CASsB;AAEtB;;;;GAIG;AACH,SAAS,YAAY,CAAC,MAAc;IACnC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC3C,kDAAkD;IAClD,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,EA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ebhookFunctions, INodeType, INodeTypeDescription, IWebhookResponseData } from 'n8n-workflow';
|
|
2
|
+
export declare class WatiTrigger implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
webhookMethods: {
|
|
5
|
+
default: {
|
|
6
|
+
checkExists(this: IHookFunctions): Promise<boolean>;
|
|
7
|
+
create(this: IHookFunctions): Promise<boolean>;
|
|
8
|
+
delete(this: IHookFunctions): Promise<boolean>;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
webhook(this: IWebhookFunctions): Promise<IWebhookResponseData>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WatiTrigger = void 0;
|
|
4
|
+
class WatiTrigger {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.description = {
|
|
7
|
+
displayName: 'WATI Trigger',
|
|
8
|
+
name: 'watiTrigger',
|
|
9
|
+
icon: 'file:wati.svg',
|
|
10
|
+
group: ['trigger'],
|
|
11
|
+
version: 1,
|
|
12
|
+
subtitle: '={{$parameter["event"]}}',
|
|
13
|
+
description: 'Trigger workflow on WATI webhook events (incoming messages, status updates). Configure the webhook URL in WATI Dashboard → Webhooks.',
|
|
14
|
+
defaults: {
|
|
15
|
+
name: 'WATI Trigger',
|
|
16
|
+
},
|
|
17
|
+
inputs: [],
|
|
18
|
+
outputs: ['main'],
|
|
19
|
+
credentials: [
|
|
20
|
+
{
|
|
21
|
+
name: 'watiApi',
|
|
22
|
+
required: false,
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
webhooks: [
|
|
26
|
+
{
|
|
27
|
+
name: 'default',
|
|
28
|
+
httpMethod: 'POST',
|
|
29
|
+
responseMode: 'onReceived',
|
|
30
|
+
path: 'webhook',
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
properties: [
|
|
34
|
+
{
|
|
35
|
+
displayName: 'Event',
|
|
36
|
+
name: 'event',
|
|
37
|
+
type: 'options',
|
|
38
|
+
options: [
|
|
39
|
+
{
|
|
40
|
+
name: 'All Events',
|
|
41
|
+
value: 'all',
|
|
42
|
+
description: 'Trigger on any WATI webhook event',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: 'Message Received',
|
|
46
|
+
value: 'messageReceived',
|
|
47
|
+
description: 'When a new message is received from a contact',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'New Contact Message',
|
|
51
|
+
value: 'newContactMessage',
|
|
52
|
+
description: 'When a new contact sends a message',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: 'Session Message Sent',
|
|
56
|
+
value: 'sessionMessageSent',
|
|
57
|
+
description: 'When a session message is sent',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: 'Template Message Sent',
|
|
61
|
+
value: 'templateMessageSent',
|
|
62
|
+
description: 'When a template message is sent',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'Message Delivered',
|
|
66
|
+
value: 'messageDelivered',
|
|
67
|
+
description: 'When a sent message is delivered',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: 'Message Read',
|
|
71
|
+
value: 'messageRead',
|
|
72
|
+
description: 'When a sent message is read',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: 'Message Replied',
|
|
76
|
+
value: 'messageReplied',
|
|
77
|
+
description: 'When a sent message is replied to',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: 'Template Message Failed',
|
|
81
|
+
value: 'templateMessageFailed',
|
|
82
|
+
description: 'When a template message fails to send',
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
default: 'all',
|
|
86
|
+
description: 'Which event to listen for',
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
};
|
|
90
|
+
this.webhookMethods = {
|
|
91
|
+
default: {
|
|
92
|
+
async checkExists() {
|
|
93
|
+
// WATI webhooks are configured in WATI Dashboard → Settings → Webhooks.
|
|
94
|
+
// The user must manually set the n8n webhook URL in WATI dashboard.
|
|
95
|
+
// This node just provides the endpoint that WATI will POST to.
|
|
96
|
+
return true;
|
|
97
|
+
},
|
|
98
|
+
async create() {
|
|
99
|
+
// Webhook creation is done manually in WATI Dashboard
|
|
100
|
+
// or via the WATI API (POST /api/v3/webhooks/create).
|
|
101
|
+
return true;
|
|
102
|
+
},
|
|
103
|
+
async delete() {
|
|
104
|
+
// Webhook deletion is done manually in WATI Dashboard
|
|
105
|
+
return true;
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
async webhook() {
|
|
111
|
+
const body = this.getBodyData();
|
|
112
|
+
const event = this.getNodeParameter('event');
|
|
113
|
+
// Map WATI webhook event type keys to our filter values.
|
|
114
|
+
// WATI sends different event type strings depending on the webhook type.
|
|
115
|
+
const eventTypeMap = {
|
|
116
|
+
whatsappMessageReceived: 'messageReceived',
|
|
117
|
+
newContactMessage: 'newContactMessage',
|
|
118
|
+
sessionMessageSent: 'sessionMessageSent',
|
|
119
|
+
templateMessageSent: 'templateMessageSent',
|
|
120
|
+
messageDelivered: 'messageDelivered',
|
|
121
|
+
messageRead: 'messageRead',
|
|
122
|
+
messageReplied: 'messageReplied',
|
|
123
|
+
templateMessageFailed: 'templateMessageFailed',
|
|
124
|
+
};
|
|
125
|
+
// If filtering by event type (not "all"), check the incoming event
|
|
126
|
+
if (event !== 'all') {
|
|
127
|
+
const bodyData = body;
|
|
128
|
+
const eventType = bodyData.eventType ||
|
|
129
|
+
bodyData.event ||
|
|
130
|
+
bodyData.type ||
|
|
131
|
+
'';
|
|
132
|
+
const mappedEvent = eventTypeMap[eventType] || eventType;
|
|
133
|
+
if (mappedEvent !== event) {
|
|
134
|
+
// Event doesn't match filter — return empty to skip
|
|
135
|
+
return {
|
|
136
|
+
workflowData: [[]],
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return {
|
|
141
|
+
workflowData: [this.helpers.returnJsonArray(body)],
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
exports.WatiTrigger = WatiTrigger;
|
|
146
|
+
//# sourceMappingURL=WatiTrigger.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WatiTrigger.node.js","sourceRoot":"","sources":["../../../nodes/Wati/WatiTrigger.node.ts"],"names":[],"mappings":";;;AASA,MAAa,WAAW;IAAxB;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,cAAc;YAC3B,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE,eAAe;YACrB,KAAK,EAAE,CAAC,SAAS,CAAC;YAClB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,0BAA0B;YACpC,WAAW,EACV,sIAAsI;YACvI,QAAQ,EAAE;gBACT,IAAI,EAAE,cAAc;aACpB;YACD,MAAM,EAAE,EAAE;YACV,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE;gBACZ;oBACC,IAAI,EAAE,SAAS;oBACf,QAAQ,EAAE,KAAK;iBACf;aACD;YACD,QAAQ,EAAE;gBACT;oBACC,IAAI,EAAE,SAAS;oBACf,UAAU,EAAE,MAAM;oBAClB,YAAY,EAAE,YAAY;oBAC1B,IAAI,EAAE,SAAS;iBACf;aACD;YACD,UAAU,EAAE;gBACX;oBACC,WAAW,EAAE,OAAO;oBACpB,IAAI,EAAE,OAAO;oBACb,IAAI,EAAE,SAAS;oBACf,OAAO,EAAE;wBACR;4BACC,IAAI,EAAE,YAAY;4BAClB,KAAK,EAAE,KAAK;4BACZ,WAAW,EAAE,mCAAmC;yBAChD;wBACD;4BACC,IAAI,EAAE,kBAAkB;4BACxB,KAAK,EAAE,iBAAiB;4BACxB,WAAW,EACV,+CAA+C;yBAChD;wBACD;4BACC,IAAI,EAAE,qBAAqB;4BAC3B,KAAK,EAAE,mBAAmB;4BAC1B,WAAW,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uBAAuB,EAAE,iBAAiB;YAC1C,iBAAiB,EAAE,mBAAmB;YACtC,kBAAkB,EAAE,oBAAoB;YACxC,mBAAmB,EAAE,qBAAqB;YAC1C,gBAAgB,EAAE,kBAAkB;YACpC,WAAW,EAAE,aAAa;YAC1B,cAAc,EAAE,gBAAgB;YAChC,qBAAqB,EAAE,uBAAuB;SAC9C,CAAC;QAEF,mEAAmE;QACnE,IAAI,KAAK,KAAK,KAAK,EAAE,CAAC;YACrB,MAAM,QAAQ,GAAG,IAAmB,CAAC;YACrC,MAAM,SAAS,GACb,QAAQ,CAAC,SAAoB;gBAC7B,QAAQ,CAAC,KAAgB;gBACzB,QAAQ,CAAC,IAAe;gBACzB,EAAE,CAAC;YAEJ,MAAM,WAAW,GAAG,YAAY,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC;YAEzD,IAAI,WAAW,KAAK,KAAK,EAAE,CAAC;gBAC3B,oDAAoD;gBACpD,OAAO;oBACN,YAAY,EAAE,CAAC,EAAE,CAAC;iBAClB,CAAC;YACH,CAAC;QACF,CAAC;QAED,OAAO;YACN,YAAY,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAmB,CAAC,CAAC;SACjE,CAAC;IACH,CAAC;CACD;AApJD,kCAoJC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-4 -4 130 116">
|
|
3
|
+
<defs>
|
|
4
|
+
<style>
|
|
5
|
+
.cls-1{fill:#00e785;}
|
|
6
|
+
.cls-2{fill:#1d1d1b;}
|
|
7
|
+
</style>
|
|
8
|
+
</defs>
|
|
9
|
+
<!-- Green chat bubble fill -->
|
|
10
|
+
<path class="cls-1" d="M36.56,86.33h37.13l22.19,22.17v-22.17h9.48c11.31,0,20.56-9.25,20.56-20.56v-29.2c0-11.31-9.25-20.56-20.56-20.56H36.56c-11.31,0-20.56,9.25-20.56,20.56v29.2c0,11.31,9.25,20.56,20.56,20.56Z"/>
|
|
11
|
+
<!-- Black chat bubble outline -->
|
|
12
|
+
<path class="cls-2" d="M83.9,102.17l-23.86-23.84H24.56c-13.54,0-24.56-11.02-24.56-24.56V24.56C0,11.02,11.02,0,24.56,0H93.36c13.54,0,24.56,11.02,24.56,24.56v29.2c0,13.54-11.02,24.56-24.56,24.56h-9.48v-8h9.48c9.13,0,16.56-7.43,16.56-16.56V24.56c0-9.13-7.43-16.56-16.56-16.56H24.56c-9.13,0-16.56,7.43-16.56,16.56v29.2c0,9.13,7.43,16.56,16.56,16.56H63.35l20.62,20.6-.07,11.24Z"/>
|
|
13
|
+
</svg>
|
package/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "n8n-nodes-wati",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "n8n node for WATI (WhatsApp Team Inbox) API - Send and receive WhatsApp messages",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"n8n-community-node-package",
|
|
7
|
+
"n8n",
|
|
8
|
+
"wati",
|
|
9
|
+
"whatsapp",
|
|
10
|
+
"messaging"
|
|
11
|
+
],
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"homepage": "https://github.com/nick-wati/n8n-nodes-wati",
|
|
14
|
+
"author": {
|
|
15
|
+
"name": "WATI",
|
|
16
|
+
"url": "https://www.wati.io"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/nick-wati/n8n-nodes-wati.git"
|
|
21
|
+
},
|
|
22
|
+
"main": "index.js",
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "tsc && gulp build:icons",
|
|
25
|
+
"dev": "tsc --watch",
|
|
26
|
+
"format": "prettier nodes credentials --write",
|
|
27
|
+
"lint": "eslint nodes credentials package.json",
|
|
28
|
+
"lintfix": "eslint nodes credentials package.json --fix",
|
|
29
|
+
"prepublishOnly": "npm run build"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist"
|
|
33
|
+
],
|
|
34
|
+
"n8n": {
|
|
35
|
+
"n8nNodesApiVersion": 1,
|
|
36
|
+
"credentials": [
|
|
37
|
+
"dist/credentials/WatiApi.credentials.js"
|
|
38
|
+
],
|
|
39
|
+
"nodes": [
|
|
40
|
+
"dist/nodes/Wati/Wati.node.js",
|
|
41
|
+
"dist/nodes/Wati/WatiTrigger.node.js"
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/node": "^25.2.2",
|
|
46
|
+
"@typescript-eslint/parser": "^7.0.0",
|
|
47
|
+
"eslint": "^8.56.0",
|
|
48
|
+
"gulp": "^5.0.1",
|
|
49
|
+
"n8n-workflow": "^1.120.8",
|
|
50
|
+
"prettier": "^3.2.0",
|
|
51
|
+
"typescript": "^5.9.3"
|
|
52
|
+
},
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"n8n-workflow": "*"
|
|
55
|
+
}
|
|
56
|
+
}
|