n8n-nodes-pilot-status 1.0.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.
@@ -0,0 +1,9 @@
1
+ import { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class PilotStatusApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ documentationUrl: string;
6
+ properties: INodeProperties[];
7
+ authenticate: IAuthenticateGeneric;
8
+ test: ICredentialTestRequest;
9
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PilotStatusApi = void 0;
4
+ class PilotStatusApi {
5
+ constructor() {
6
+ this.name = 'pilotStatusApi';
7
+ this.displayName = 'Pilot Status API';
8
+ this.documentationUrl = 'https://pilotstatus.online/docs';
9
+ this.properties = [
10
+ {
11
+ displayName: 'API Key',
12
+ name: 'apiKey',
13
+ type: 'string',
14
+ typeOptions: {
15
+ password: true,
16
+ },
17
+ default: '',
18
+ required: true,
19
+ description: 'API Key can be found in Pilot Status Dashboard -> API Keys',
20
+ },
21
+ ];
22
+ this.authenticate = {
23
+ type: 'generic',
24
+ properties: {
25
+ headers: {
26
+ 'x-api-key': '={{$credentials.apiKey}}',
27
+ },
28
+ },
29
+ };
30
+ this.test = {
31
+ request: {
32
+ baseURL: 'https://api.pilotstatus.online/v1',
33
+ url: '/analytics/dashboard',
34
+ },
35
+ };
36
+ }
37
+ }
38
+ exports.PilotStatusApi = PilotStatusApi;
@@ -0,0 +1,4 @@
1
+ import { INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class PilotStatus implements INodeType {
3
+ description: INodeTypeDescription;
4
+ }
@@ -0,0 +1,534 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PilotStatus = void 0;
4
+ class PilotStatus {
5
+ constructor() {
6
+ this.description = {
7
+ displayName: 'Pilot Status',
8
+ name: 'pilotStatus',
9
+ icon: 'file:pilotStatus.svg',
10
+ group: ['transform'],
11
+ version: 1,
12
+ subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
13
+ description: 'Consume Pilot Status API',
14
+ defaults: {
15
+ name: 'Pilot Status',
16
+ },
17
+ inputs: ['main'],
18
+ outputs: ['main'],
19
+ credentials: [
20
+ {
21
+ name: 'pilotStatusApi',
22
+ required: true,
23
+ },
24
+ ],
25
+ requestDefaults: {
26
+ baseURL: 'https://api.pilotstatus.online/v1',
27
+ headers: {
28
+ Accept: 'application/json',
29
+ 'Content-Type': 'application/json',
30
+ },
31
+ },
32
+ properties: [
33
+ {
34
+ displayName: 'Resource',
35
+ name: 'resource',
36
+ type: 'options',
37
+ noDataExpression: true,
38
+ options: [
39
+ {
40
+ name: 'Message',
41
+ value: 'message',
42
+ },
43
+ {
44
+ name: 'Project',
45
+ value: 'project',
46
+ },
47
+ {
48
+ name: 'API Key',
49
+ value: 'apiKey',
50
+ },
51
+ {
52
+ name: 'Number',
53
+ value: 'number',
54
+ },
55
+ {
56
+ name: 'Analytics',
57
+ value: 'analytics',
58
+ },
59
+ ],
60
+ default: 'message',
61
+ },
62
+ // ----------------------------------
63
+ // Message Operations
64
+ // ----------------------------------
65
+ {
66
+ displayName: 'Operation',
67
+ name: 'operation',
68
+ type: 'options',
69
+ noDataExpression: true,
70
+ displayOptions: {
71
+ show: {
72
+ resource: ['message'],
73
+ },
74
+ },
75
+ options: [
76
+ {
77
+ name: 'Send',
78
+ value: 'send',
79
+ description: 'Send a message',
80
+ action: 'Send a message',
81
+ routing: {
82
+ request: {
83
+ method: 'POST',
84
+ url: '/messages/send',
85
+ },
86
+ },
87
+ },
88
+ {
89
+ name: 'Get Status',
90
+ value: 'getStatus',
91
+ description: 'Get the status of a message',
92
+ action: 'Get status of a message',
93
+ routing: {
94
+ request: {
95
+ method: 'GET',
96
+ url: '=/messages/{{$parameter.messageId}}',
97
+ },
98
+ },
99
+ },
100
+ {
101
+ name: 'Check Opt-In',
102
+ value: 'checkOptIn',
103
+ description: 'Check opt-in status for a number',
104
+ action: 'Check opt in status for a number',
105
+ routing: {
106
+ request: {
107
+ method: 'GET',
108
+ url: '/messages/opt-in',
109
+ qs: {
110
+ destinationNumber: '={{$parameter.destinationNumber}}',
111
+ },
112
+ },
113
+ },
114
+ },
115
+ ],
116
+ default: 'send',
117
+ },
118
+ // Message: Send
119
+ {
120
+ displayName: 'Template ID',
121
+ name: 'templateId',
122
+ type: 'string',
123
+ displayOptions: {
124
+ show: {
125
+ resource: ['message'],
126
+ operation: ['send'],
127
+ },
128
+ },
129
+ default: '',
130
+ required: true,
131
+ routing: {
132
+ send: {
133
+ type: 'body',
134
+ property: 'templateId',
135
+ },
136
+ },
137
+ },
138
+ {
139
+ displayName: 'Destination Number',
140
+ name: 'destinationNumber',
141
+ type: 'string',
142
+ description: 'E.164 format (e.g. +5511999999999)',
143
+ displayOptions: {
144
+ show: {
145
+ resource: ['message'],
146
+ operation: ['send', 'checkOptIn'],
147
+ },
148
+ },
149
+ default: '',
150
+ required: true,
151
+ routing: {
152
+ send: {
153
+ type: 'body',
154
+ property: 'destinationNumber',
155
+ },
156
+ },
157
+ },
158
+ {
159
+ displayName: 'Variables',
160
+ name: 'variables',
161
+ type: 'json',
162
+ displayOptions: {
163
+ show: {
164
+ resource: ['message'],
165
+ operation: ['send'],
166
+ },
167
+ },
168
+ default: '{}',
169
+ description: 'Variables for the template as JSON object',
170
+ routing: {
171
+ send: {
172
+ type: 'body',
173
+ property: 'variables',
174
+ },
175
+ },
176
+ },
177
+ {
178
+ displayName: 'Deliver At',
179
+ name: 'deliverAt',
180
+ type: 'dateTime',
181
+ displayOptions: {
182
+ show: {
183
+ resource: ['message'],
184
+ operation: ['send'],
185
+ },
186
+ },
187
+ default: '',
188
+ description: 'Optional scheduled delivery time (ISO8601)',
189
+ routing: {
190
+ send: {
191
+ type: 'body',
192
+ property: 'deliverAt',
193
+ },
194
+ },
195
+ },
196
+ // Message: Get Status
197
+ {
198
+ displayName: 'Message ID',
199
+ name: 'messageId',
200
+ type: 'string',
201
+ displayOptions: {
202
+ show: {
203
+ resource: ['message'],
204
+ operation: ['getStatus'],
205
+ },
206
+ },
207
+ default: '',
208
+ required: true,
209
+ },
210
+ // ----------------------------------
211
+ // Project Operations
212
+ // ----------------------------------
213
+ {
214
+ displayName: 'Operation',
215
+ name: 'operation',
216
+ type: 'options',
217
+ noDataExpression: true,
218
+ displayOptions: {
219
+ show: {
220
+ resource: ['project'],
221
+ },
222
+ },
223
+ options: [
224
+ {
225
+ name: 'Create',
226
+ value: 'create',
227
+ description: 'Create a new project',
228
+ action: 'Create a project',
229
+ routing: {
230
+ request: {
231
+ method: 'POST',
232
+ url: '/projects',
233
+ },
234
+ },
235
+ },
236
+ {
237
+ name: 'Get Many',
238
+ value: 'getAll',
239
+ description: 'Get many projects',
240
+ action: 'Get many projects',
241
+ routing: {
242
+ request: {
243
+ method: 'GET',
244
+ url: '/projects',
245
+ },
246
+ },
247
+ },
248
+ ],
249
+ default: 'getAll',
250
+ },
251
+ // Project: Create
252
+ {
253
+ displayName: 'Name',
254
+ name: 'name',
255
+ type: 'string',
256
+ displayOptions: {
257
+ show: {
258
+ resource: ['project'],
259
+ operation: ['create'],
260
+ },
261
+ },
262
+ default: '',
263
+ required: true,
264
+ routing: {
265
+ send: {
266
+ type: 'body',
267
+ property: 'name',
268
+ },
269
+ },
270
+ },
271
+ {
272
+ displayName: 'Description',
273
+ name: 'description',
274
+ type: 'string',
275
+ displayOptions: {
276
+ show: {
277
+ resource: ['project'],
278
+ operation: ['create'],
279
+ },
280
+ },
281
+ default: '',
282
+ routing: {
283
+ send: {
284
+ type: 'body',
285
+ property: 'description',
286
+ },
287
+ },
288
+ },
289
+ // ----------------------------------
290
+ // API Key Operations
291
+ // ----------------------------------
292
+ {
293
+ displayName: 'Operation',
294
+ name: 'operation',
295
+ type: 'options',
296
+ noDataExpression: true,
297
+ displayOptions: {
298
+ show: {
299
+ resource: ['apiKey'],
300
+ },
301
+ },
302
+ options: [
303
+ {
304
+ name: 'Create',
305
+ value: 'create',
306
+ description: 'Create a new API Key',
307
+ action: 'Create an api key',
308
+ routing: {
309
+ request: {
310
+ method: 'POST',
311
+ url: '/api-keys',
312
+ },
313
+ },
314
+ },
315
+ {
316
+ name: 'Get Many',
317
+ value: 'getAll',
318
+ description: 'Get many API Keys',
319
+ action: 'Get many api keys',
320
+ routing: {
321
+ request: {
322
+ method: 'GET',
323
+ url: '/api-keys',
324
+ },
325
+ },
326
+ },
327
+ ],
328
+ default: 'getAll',
329
+ },
330
+ // API Key: Create
331
+ {
332
+ displayName: 'Name',
333
+ name: 'name',
334
+ type: 'string',
335
+ displayOptions: {
336
+ show: {
337
+ resource: ['apiKey'],
338
+ operation: ['create'],
339
+ },
340
+ },
341
+ default: '',
342
+ required: true,
343
+ routing: {
344
+ send: {
345
+ type: 'body',
346
+ property: 'name',
347
+ },
348
+ },
349
+ },
350
+ {
351
+ displayName: 'Retention Days',
352
+ name: 'retentionDays',
353
+ type: 'number',
354
+ displayOptions: {
355
+ show: {
356
+ resource: ['apiKey'],
357
+ operation: ['create'],
358
+ },
359
+ },
360
+ default: 30,
361
+ routing: {
362
+ send: {
363
+ type: 'body',
364
+ property: 'retentionDays',
365
+ },
366
+ },
367
+ },
368
+ // ----------------------------------
369
+ // Number Operations
370
+ // ----------------------------------
371
+ {
372
+ displayName: 'Operation',
373
+ name: 'operation',
374
+ type: 'options',
375
+ noDataExpression: true,
376
+ displayOptions: {
377
+ show: {
378
+ resource: ['number'],
379
+ },
380
+ },
381
+ options: [
382
+ {
383
+ name: 'Create',
384
+ value: 'create',
385
+ description: 'Create/Connect a WhatsApp Number',
386
+ action: 'Create a number',
387
+ routing: {
388
+ request: {
389
+ method: 'POST',
390
+ url: '/numbers',
391
+ },
392
+ },
393
+ },
394
+ {
395
+ name: 'Get Status',
396
+ value: 'getStatus',
397
+ description: 'Get connection status of a number',
398
+ action: 'Get status of a number',
399
+ routing: {
400
+ request: {
401
+ method: 'GET',
402
+ url: '=/numbers/{{$parameter.numberId}}/status',
403
+ },
404
+ },
405
+ },
406
+ ],
407
+ default: 'create',
408
+ },
409
+ // Number: Create
410
+ {
411
+ displayName: 'Name',
412
+ name: 'name',
413
+ type: 'string',
414
+ displayOptions: {
415
+ show: {
416
+ resource: ['number'],
417
+ operation: ['create'],
418
+ },
419
+ },
420
+ default: '',
421
+ required: true,
422
+ routing: {
423
+ send: {
424
+ type: 'body',
425
+ property: 'name',
426
+ },
427
+ },
428
+ },
429
+ {
430
+ displayName: 'Number',
431
+ name: 'number',
432
+ type: 'string',
433
+ displayOptions: {
434
+ show: {
435
+ resource: ['number'],
436
+ operation: ['create'],
437
+ },
438
+ },
439
+ default: '',
440
+ required: true,
441
+ description: 'E.164 format (e.g. +5511999999999)',
442
+ routing: {
443
+ send: {
444
+ type: 'body',
445
+ property: 'number',
446
+ },
447
+ },
448
+ },
449
+ {
450
+ displayName: 'Link to API Key',
451
+ name: 'linkToApiKey',
452
+ type: 'boolean',
453
+ displayOptions: {
454
+ show: {
455
+ resource: ['number'],
456
+ operation: ['create'],
457
+ },
458
+ },
459
+ default: true,
460
+ routing: {
461
+ send: {
462
+ type: 'body',
463
+ property: 'linkToApiKey',
464
+ },
465
+ },
466
+ },
467
+ // Number: Get Status
468
+ {
469
+ displayName: 'Number Instance ID',
470
+ name: 'numberId',
471
+ type: 'string',
472
+ displayOptions: {
473
+ show: {
474
+ resource: ['number'],
475
+ operation: ['getStatus'],
476
+ },
477
+ },
478
+ default: '',
479
+ required: true,
480
+ },
481
+ // ----------------------------------
482
+ // Analytics Operations
483
+ // ----------------------------------
484
+ {
485
+ displayName: 'Operation',
486
+ name: 'operation',
487
+ type: 'options',
488
+ noDataExpression: true,
489
+ displayOptions: {
490
+ show: {
491
+ resource: ['analytics'],
492
+ },
493
+ },
494
+ options: [
495
+ {
496
+ name: 'Get Dashboard',
497
+ value: 'getDashboard',
498
+ description: 'Get dashboard analytics stats',
499
+ action: 'Get dashboard analytics',
500
+ routing: {
501
+ request: {
502
+ method: 'GET',
503
+ url: '/analytics/dashboard',
504
+ },
505
+ },
506
+ },
507
+ ],
508
+ default: 'getDashboard',
509
+ },
510
+ // Analytics: Get Dashboard
511
+ {
512
+ displayName: 'Timezone (TZ)',
513
+ name: 'tz',
514
+ type: 'string',
515
+ displayOptions: {
516
+ show: {
517
+ resource: ['analytics'],
518
+ operation: ['getDashboard'],
519
+ },
520
+ },
521
+ default: 'America/Sao_Paulo',
522
+ description: 'IANA timezone (e.g. America/Sao_Paulo)',
523
+ routing: {
524
+ send: {
525
+ type: 'query',
526
+ property: 'tz',
527
+ },
528
+ },
529
+ },
530
+ ],
531
+ };
532
+ }
533
+ }
534
+ exports.PilotStatus = PilotStatus;
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
2
+ <path fill="#25d366" d="M12 0C5.373 0 0 5.373 0 12c0 2.124.553 4.118 1.515 5.861L.22 23.78l6.082-1.597A11.93 11.93 0 0012 24c6.627 0 12-5.373 12-12S18.627 0 12 0z"/>
3
+ </svg>
@@ -0,0 +1,5 @@
1
+ import { IWebhookFunctions, INodeType, INodeTypeDescription, IWebhookResponseData } from 'n8n-workflow';
2
+ export declare class PilotStatusTrigger implements INodeType {
3
+ description: INodeTypeDescription;
4
+ webhook(this: IWebhookFunctions): Promise<IWebhookResponseData>;
5
+ }
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PilotStatusTrigger = void 0;
4
+ class PilotStatusTrigger {
5
+ constructor() {
6
+ this.description = {
7
+ displayName: 'Pilot Status Trigger',
8
+ name: 'pilotStatusTrigger',
9
+ icon: 'file:pilotStatus.svg',
10
+ group: ['trigger'],
11
+ version: 1,
12
+ description: 'Handle Pilot Status events via Webhook',
13
+ defaults: {
14
+ name: 'Pilot Status Trigger',
15
+ },
16
+ inputs: [],
17
+ outputs: ['main'],
18
+ webhooks: [
19
+ {
20
+ name: 'default',
21
+ httpMethod: 'POST',
22
+ responseMode: 'onReceived',
23
+ path: 'webhook',
24
+ },
25
+ ],
26
+ properties: [
27
+ {
28
+ displayName: 'Event',
29
+ name: 'event',
30
+ type: 'options',
31
+ options: [
32
+ {
33
+ name: 'All Events',
34
+ value: '*',
35
+ },
36
+ {
37
+ name: 'Message Sent',
38
+ value: 'message.sent',
39
+ },
40
+ {
41
+ name: 'Message Delivered',
42
+ value: 'message.delivered',
43
+ },
44
+ {
45
+ name: 'Message Read',
46
+ value: 'message.read',
47
+ },
48
+ {
49
+ name: 'Message Failed',
50
+ value: 'message.failed',
51
+ },
52
+ {
53
+ name: 'Message Reply',
54
+ value: 'message.reply',
55
+ },
56
+ {
57
+ name: 'Message Received',
58
+ value: 'message.received',
59
+ },
60
+ ],
61
+ default: '*',
62
+ description: 'The event to listen to',
63
+ },
64
+ {
65
+ displayName: 'Notice: Webhook URL',
66
+ name: 'notice',
67
+ type: 'notice',
68
+ default: '',
69
+ description: 'Copy the Webhook URL from the side panel and paste it in the Pilot Status Dashboard under Webhooks.',
70
+ },
71
+ ],
72
+ };
73
+ }
74
+ async webhook() {
75
+ const req = this.getRequestObject();
76
+ const event = this.getNodeParameter('event');
77
+ const bodyData = req.body;
78
+ if (event !== '*' && bodyData.event !== event) {
79
+ return {
80
+ webhookResponse: {
81
+ status: 200,
82
+ body: 'Ignored event',
83
+ },
84
+ };
85
+ }
86
+ return {
87
+ workflowData: [
88
+ [
89
+ {
90
+ json: bodyData,
91
+ },
92
+ ],
93
+ ],
94
+ };
95
+ }
96
+ }
97
+ exports.PilotStatusTrigger = PilotStatusTrigger;
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
2
+ <path fill="#25d366" d="M12 0C5.373 0 0 5.373 0 12c0 2.124.553 4.118 1.515 5.861L.22 23.78l6.082-1.597A11.93 11.93 0 0012 24c6.627 0 12-5.373 12-12S18.627 0 12 0z"/>
3
+ </svg>
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "n8n-nodes-pilot-status",
3
+ "version": "1.0.0",
4
+ "description": "n8n node for Pilot Status API",
5
+ "keywords": [
6
+ "n8ncommunity",
7
+ "n8n-nodes-pilot-status"
8
+ ],
9
+ "author": "Ismael Ash",
10
+ "license": "MIT",
11
+ "main": "dist/index.js",
12
+ "scripts": {
13
+ "build": "rimraf dist && tsc && npm run build:icons",
14
+ "build:icons": "mkdir -p dist/nodes/PilotStatus dist/nodes/PilotStatusTrigger && cp nodes/PilotStatus/*.svg dist/nodes/PilotStatus/ && cp nodes/PilotStatusTrigger/*.svg dist/nodes/PilotStatusTrigger/",
15
+ "dev": "tsc --watch",
16
+ "prepublishOnly": "npm run build"
17
+ },
18
+ "files": [
19
+ "dist"
20
+ ],
21
+ "n8n": {
22
+ "n8nNodesApiVersion": 1,
23
+ "credentials": [
24
+ "dist/credentials/PilotStatusApi.credentials.js"
25
+ ],
26
+ "nodes": [
27
+ "dist/nodes/PilotStatus/PilotStatus.node.js",
28
+ "dist/nodes/PilotStatusTrigger/PilotStatusTrigger.node.js"
29
+ ]
30
+ },
31
+ "dependencies": {
32
+ "n8n-workflow": "^1.0.0"
33
+ },
34
+ "devDependencies": {
35
+ "@types/node": "^18.0.0",
36
+ "n8n-core": "^1.0.0",
37
+ "rimraf": "^5.0.0",
38
+ "typescript": "^5.0.0"
39
+ }
40
+ }