n8n-nodes-pilot-status 1.0.11 → 1.2.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Pilot Status - n8n Integration
2
2
 
3
- This is the official [n8n](https://n8n.io/) node for [Pilot Status](https://pilotstatus.online) — a WhatsApp transactional, marketing, and bulk messaging platform.
3
+ This is the official [n8n](https://n8n.io/) node for [Pilot Status](https://pilotstatuss.com) — a WhatsApp transactional, marketing, and bulk messaging platform.
4
4
 
5
5
  With this integration, you can seamlessly connect your n8n workflows to Pilot Status to send messages, manage projects, connect WhatsApp numbers, and react to incoming messages or status changes in real time.
6
6
 
@@ -27,8 +27,8 @@ npm install n8n-nodes-pilot-status
27
27
 
28
28
  To use the Pilot Status node, you need an **API Key**.
29
29
 
30
- 1. Go to your [Pilot Status Dashboard](https://pilotstatus.online/api-keys).
31
- 2. Create a new API Key (you can choose between a `TEST` key or a `LIVE` key).
30
+ 1. Go to your [Pilot Status Dashboard](https://pilotstatuss.com/api-keys).
31
+ 2. Create a new API Key.
32
32
  3. In n8n, add a new **Pilot Status API** credential and paste your API Key.
33
33
 
34
34
  *Note: TEST keys will only send messages to the WhatsApp number registered in your Pilot Status Profile.*
@@ -53,7 +53,6 @@ To use it:
53
53
  - **Message Reply:** Triggered when a user replies specifically to an automated message.
54
54
  - **Message Received:** Triggered when a general inbound message is received on your connected WhatsApp number.
55
55
  - **Group Message:** Triggered when an inbound group message is received (group subject is included when available).
56
- - **Opt-in Created:** Triggered when an opt-in is recorded (consent message received by the Pilot Status number).
57
56
 
58
57
  Webhook payload notes:
59
58
  - Customer webhook payloads do not include: `projectSlug`, `lastMessageId`. Optional `correlationId` (same as HTTP 202 when present) may appear on outbound status events and on `message.reply` / `message.received` when correlated to a prior send.
@@ -70,7 +69,6 @@ The **Pilot Status** node provides several resources and operations to manage yo
70
69
  ### 1. Message
71
70
  - **Send:** Send a template message (OTP, Utility, or Marketing). Choose **Phone Number** or **WhatsApp Group**; for groups use `groupId` (JID ending in `@g.us`) instead of `destinationNumber`. Optional dropdown loads groups from `GET /v1/groups` when the WhatsApp session is connected. Variables can be provided via JSON or the UI collection (including placeholders used in button labels).
72
71
  - **Get Status:** Retrieve the current status of a specific message using either its Pilot Status message id or WhatsApp provider id.
73
- - **Check Opt-In:** Check if a specific destination number has opted in to receive messages from your project (required for LIVE environments when using the Pilot Status shared number).
74
72
 
75
73
  ### 2. Number
76
74
  - **Create:** Provision a new WhatsApp number instance. It returns a base64 QR Code and optional `pairingCode` (letter code) for WhatsApp “link a device”. By default, the number is linked to the API Key used in the request.
@@ -103,7 +101,7 @@ Here are some ideas of what you can build with this integration:
103
101
 
104
102
  ## 📚 Documentation & Support
105
103
 
106
- - **API Documentation:** [https://pilotstatus.online/docs](https://pilotstatus.online/docs)
107
- - **Official Website:** [https://pilotstatus.online](https://pilotstatus.online)
104
+ - **API Documentation:** [https://pilotstatuss.com/docs](https://pilotstatuss.com/docs)
105
+ - **Official Website:** [https://pilotstatuss.com](https://pilotstatuss.com)
108
106
 
109
107
  If you have any questions or need help, feel free to reach out to our support via the dashboard!
@@ -5,7 +5,7 @@ class PilotStatusApi {
5
5
  constructor() {
6
6
  this.name = 'pilotStatusApi';
7
7
  this.displayName = 'Pilot Status API';
8
- this.documentationUrl = 'https://pilotstatus.online/docs';
8
+ this.documentationUrl = 'https://pilotstatuss.com/docs';
9
9
  this.properties = [
10
10
  {
11
11
  displayName: 'API Key',
@@ -29,7 +29,7 @@ class PilotStatusApi {
29
29
  };
30
30
  this.test = {
31
31
  request: {
32
- baseURL: 'https://pilotstatus.online/v1',
32
+ baseURL: 'https://pilotstatuss.com/v1',
33
33
  url: '/templates',
34
34
  },
35
35
  };
@@ -4,6 +4,8 @@ export declare class PilotStatus implements INodeType {
4
4
  loadOptions: {
5
5
  getTemplates(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
6
6
  getTemplateVariables(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
7
+ getGroups(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
8
+ getNewsletters(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
7
9
  };
8
10
  };
9
11
  description: INodeTypeDescription;
@@ -8,7 +8,7 @@ class PilotStatus {
8
8
  async getTemplates() {
9
9
  const response = (await this.helpers.requestWithAuthentication.call(this, 'pilotStatusApi', {
10
10
  method: 'GET',
11
- baseURL: 'https://pilotstatus.online/v1',
11
+ baseURL: 'https://pilotstatuss.com/v1',
12
12
  url: '/templates',
13
13
  json: true,
14
14
  }));
@@ -30,13 +30,37 @@ class PilotStatus {
30
30
  return [];
31
31
  const response = (await this.helpers.requestWithAuthentication.call(this, 'pilotStatusApi', {
32
32
  method: 'GET',
33
- baseURL: 'https://pilotstatus.online/v1',
33
+ baseURL: 'https://pilotstatuss.com/v1',
34
34
  url: `/templates/${templateId}`,
35
35
  json: true,
36
36
  }));
37
37
  const vars = (_b = (_a = response === null || response === void 0 ? void 0 : response.latestVersion) === null || _a === void 0 ? void 0 : _a.variables) !== null && _b !== void 0 ? _b : [];
38
38
  return Array.isArray(vars) ? vars.map((v) => ({ name: v, value: v })) : [];
39
39
  },
40
+ async getGroups() {
41
+ const response = (await this.helpers.requestWithAuthentication.call(this, 'pilotStatusApi', {
42
+ method: 'GET',
43
+ baseURL: 'https://pilotstatuss.com/v1',
44
+ url: '/groups',
45
+ json: true,
46
+ }));
47
+ return (response || []).map((g) => ({
48
+ name: g.subject,
49
+ value: g.id,
50
+ }));
51
+ },
52
+ async getNewsletters() {
53
+ const response = (await this.helpers.requestWithAuthentication.call(this, 'pilotStatusApi', {
54
+ method: 'GET',
55
+ baseURL: 'https://pilotstatuss.com/v1',
56
+ url: '/newsletters',
57
+ json: true,
58
+ }));
59
+ return (response || []).map((n) => ({
60
+ name: n.name,
61
+ value: n.id,
62
+ }));
63
+ },
40
64
  },
41
65
  };
42
66
  this.description = {
@@ -59,7 +83,7 @@ class PilotStatus {
59
83
  },
60
84
  ],
61
85
  requestDefaults: {
62
- baseURL: 'https://pilotstatus.online/v1',
86
+ baseURL: 'https://pilotstatuss.com/v1',
63
87
  headers: {
64
88
  Accept: 'application/json',
65
89
  'Content-Type': 'application/json',
@@ -73,10 +97,15 @@ class PilotStatus {
73
97
  noDataExpression: true,
74
98
  options: [
75
99
  { name: 'Message', value: 'message' },
100
+ { name: 'Media', value: 'media' },
76
101
  { name: 'Project', value: 'project' },
77
102
  { name: 'API Key', value: 'apiKey' },
78
103
  { name: 'Number', value: 'number' },
104
+ { name: 'Template', value: 'template' },
105
+ { name: 'Group', value: 'group' },
106
+ { name: 'Newsletter', value: 'newsletter' },
79
107
  { name: 'Analytics', value: 'analytics' },
108
+ { name: 'Remote Pairing', value: 'remotePairing' },
80
109
  ],
81
110
  default: 'message',
82
111
  },
@@ -97,7 +126,6 @@ class PilotStatus {
97
126
  action: 'Send a message',
98
127
  routing: {
99
128
  request: { method: 'POST', url: '/messages/send' },
100
- // ✅ preSend hook: monta o campo "variables" como objeto antes de enviar
101
129
  send: {
102
130
  preSend: [
103
131
  async function (requestOptions) {
@@ -141,7 +169,6 @@ class PilotStatus {
141
169
  try {
142
170
  const parsed = typeof raw === 'string' ? JSON.parse(raw) : raw;
143
171
  if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
144
- // ✅ API exige que todos os valores sejam strings
145
172
  for (const [k, v] of Object.entries(parsed)) {
146
173
  variables[k] = String(v !== null && v !== void 0 ? v : '');
147
174
  }
@@ -154,14 +181,15 @@ class PilotStatus {
154
181
  else {
155
182
  const ui = this.getNodeParameter('variablesUi');
156
183
  for (const entry of (_a = ui === null || ui === void 0 ? void 0 : ui.values) !== null && _a !== void 0 ? _a : []) {
157
- // ✅ API exige que todos os valores sejam strings
158
184
  variables[entry.name] = String((_b = entry.value) !== null && _b !== void 0 ? _b : '');
159
185
  }
160
186
  }
161
- // Garante que o body é um objeto e injeta "variables" como objeto
187
+ // reason: defensive re-guard — requestOptions.body is already an object here (set above by the first guard / destination handling), so this branch is unreachable.
188
+ /* v8 ignore start */
162
189
  if (!requestOptions.body || typeof requestOptions.body !== 'object') {
163
190
  requestOptions.body = {};
164
191
  }
192
+ /* v8 ignore stop */
165
193
  requestOptions.body['variables'] = variables;
166
194
  return requestOptions;
167
195
  },
@@ -179,15 +207,27 @@ class PilotStatus {
179
207
  },
180
208
  },
181
209
  {
182
- name: 'Check Opt-In',
183
- value: 'checkOptIn',
184
- description: 'Check opt-in status for a number',
185
- action: 'Check opt in status for a number',
210
+ name: 'Cancel',
211
+ value: 'cancel',
212
+ description: 'Cancel scheduled messages',
213
+ action: 'Cancel messages',
186
214
  routing: {
187
- request: {
188
- method: 'GET',
189
- url: '/messages/opt-in',
190
- qs: { destinationNumber: '={{$parameter.destinationNumber}}' },
215
+ request: { method: 'DELETE', url: '/messages/cancel' },
216
+ send: {
217
+ preSend: [
218
+ async function (requestOptions) {
219
+ const raw = this.getNodeParameter('messageIds');
220
+ const ids = raw
221
+ .split(',')
222
+ .map((s) => s.trim())
223
+ .filter((s) => s);
224
+ if (!requestOptions.body || typeof requestOptions.body !== 'object') {
225
+ requestOptions.body = {};
226
+ }
227
+ requestOptions.body['messageIds'] = ids;
228
+ return requestOptions;
229
+ },
230
+ ],
191
231
  },
192
232
  },
193
233
  },
@@ -202,7 +242,7 @@ class PilotStatus {
202
242
  typeOptions: { loadOptionsMethod: 'getTemplates' },
203
243
  displayOptions: { show: { resource: ['message'], operation: ['send'] } },
204
244
  default: '',
205
- required: true,
245
+ required: false,
206
246
  routing: { send: { type: 'body', property: 'templateId' } },
207
247
  },
208
248
  {
@@ -234,18 +274,6 @@ class PilotStatus {
234
274
  required: true,
235
275
  routing: { send: { type: 'body', property: 'destinationNumber' } },
236
276
  },
237
- {
238
- displayName: 'Destination Number',
239
- name: 'destinationNumber',
240
- type: 'string',
241
- description: 'E.164 format (e.g. +5511999999999)',
242
- displayOptions: {
243
- show: { resource: ['message'], operation: ['checkOptIn'] },
244
- },
245
- default: '',
246
- required: true,
247
- routing: { send: { type: 'query', property: 'destinationNumber' } },
248
- },
249
277
  {
250
278
  displayName: 'Group ID',
251
279
  name: 'groupId',
@@ -291,7 +319,6 @@ class PilotStatus {
291
319
  show: { resource: ['message'], operation: ['send'], variablesMode: ['json'] },
292
320
  },
293
321
  description: 'A JSON object containing key-value pairs for variables',
294
- // ✅ Sem routing aqui — o preSend cuida do envio como objeto
295
322
  },
296
323
  {
297
324
  displayName: 'Variables',
@@ -329,7 +356,6 @@ class PilotStatus {
329
356
  ],
330
357
  },
331
358
  ],
332
- // ✅ Sem routing aqui — o preSend cuida do envio como objeto
333
359
  },
334
360
  {
335
361
  displayName: 'Additional Fields',
@@ -353,6 +379,80 @@ class PilotStatus {
353
379
  default: '',
354
380
  description: 'Optional expiration limit for the message delivery (ISO8601)',
355
381
  },
382
+ {
383
+ displayName: 'Labels',
384
+ name: 'labels',
385
+ type: 'string',
386
+ default: '',
387
+ description: 'Comma-separated label names (processed asynchronously)',
388
+ },
389
+ {
390
+ displayName: 'AI Rewrite Enabled',
391
+ name: 'aiRewriteEnabled',
392
+ type: 'boolean',
393
+ default: false,
394
+ description: 'Whether to enable AI rewriting for marketing messages',
395
+ },
396
+ {
397
+ displayName: 'Media URL',
398
+ name: 'media',
399
+ type: 'string',
400
+ default: '',
401
+ description: 'URL of the media to attach (image, video, or document)',
402
+ },
403
+ {
404
+ displayName: 'Media Type',
405
+ name: 'mediaType',
406
+ type: 'options',
407
+ options: [
408
+ { name: 'Image', value: 'image' },
409
+ { name: 'Video', value: 'video' },
410
+ { name: 'Document', value: 'document' },
411
+ ],
412
+ default: 'image',
413
+ description: 'Type of media being attached',
414
+ },
415
+ {
416
+ displayName: 'Buttons (JSON)',
417
+ name: 'buttons',
418
+ type: 'json',
419
+ default: '',
420
+ description: 'JSON array of button objects (reply, url, call, copy)',
421
+ },
422
+ {
423
+ displayName: 'Text',
424
+ name: 'text',
425
+ type: 'string',
426
+ default: '',
427
+ description: 'Free-form message body text (used without templateId)',
428
+ },
429
+ {
430
+ displayName: 'Header Type',
431
+ name: 'headerType',
432
+ type: 'options',
433
+ options: [
434
+ { name: 'Text', value: 'text' },
435
+ { name: 'Image', value: 'image' },
436
+ { name: 'Video', value: 'video' },
437
+ { name: 'Document', value: 'document' },
438
+ ],
439
+ default: 'text',
440
+ description: 'Type of header for free-form message',
441
+ },
442
+ {
443
+ displayName: 'Header Content',
444
+ name: 'headerContent',
445
+ type: 'string',
446
+ default: '',
447
+ description: 'Header content (text string or URL for image/video/document)',
448
+ },
449
+ {
450
+ displayName: 'Footer',
451
+ name: 'footer',
452
+ type: 'string',
453
+ default: '',
454
+ description: 'Footer text for free-form message',
455
+ },
356
456
  ],
357
457
  },
358
458
  // Hidden fields para deliverAt / deliverUntil normalizados
@@ -372,6 +472,70 @@ class PilotStatus {
372
472
  default: '={{ $parameter.additionalFields?.deliverUntil ? new Date($parameter.additionalFields.deliverUntil).toISOString() : undefined }}',
373
473
  routing: { send: { type: 'body', property: 'deliverUntil' } },
374
474
  },
475
+ {
476
+ displayName: 'Labels',
477
+ name: 'labelsNormalized',
478
+ type: 'hidden',
479
+ displayOptions: { show: { resource: ['message'], operation: ['send'] } },
480
+ default: '={{ $parameter.additionalFields?.labels ? $parameter.additionalFields.labels.split(",").map(l => l.trim()).filter(l => l) : undefined }}',
481
+ routing: { send: { type: 'body', property: 'labels' } },
482
+ },
483
+ {
484
+ displayName: 'Marketing Options',
485
+ name: 'marketingOptionsNormalized',
486
+ type: 'hidden',
487
+ displayOptions: { show: { resource: ['message'], operation: ['send'] } },
488
+ default: '={{ $parameter.additionalFields?.aiRewriteEnabled ? { aiRewriteEnabled: true } : undefined }}',
489
+ routing: { send: { type: 'body', property: 'marketingOptions' } },
490
+ },
491
+ {
492
+ displayName: 'Media URL',
493
+ name: 'mediaNormalized',
494
+ type: 'hidden',
495
+ displayOptions: { show: { resource: ['message'], operation: ['send'] } },
496
+ default: '={{ $parameter.additionalFields?.media || undefined }}',
497
+ routing: { send: { type: 'body', property: 'media' } },
498
+ },
499
+ {
500
+ displayName: 'Media Type',
501
+ name: 'mediaTypeNormalized',
502
+ type: 'hidden',
503
+ displayOptions: { show: { resource: ['message'], operation: ['send'] } },
504
+ default: '={{ $parameter.additionalFields?.media ? ($parameter.additionalFields.mediaType || "image") : undefined }}',
505
+ routing: { send: { type: 'body', property: 'mediaType' } },
506
+ },
507
+ {
508
+ displayName: 'Buttons',
509
+ name: 'buttonsNormalized',
510
+ type: 'hidden',
511
+ displayOptions: { show: { resource: ['message'], operation: ['send'] } },
512
+ default: '={{ $parameter.additionalFields?.buttons ? (() => { try { return JSON.parse($parameter.additionalFields.buttons); } catch { return undefined; } })() : undefined }}',
513
+ routing: { send: { type: 'body', property: 'buttons' } },
514
+ },
515
+ {
516
+ displayName: 'Text',
517
+ name: 'textNormalized',
518
+ type: 'hidden',
519
+ displayOptions: { show: { resource: ['message'], operation: ['send'] } },
520
+ default: '={{ $parameter.additionalFields?.text || undefined }}',
521
+ routing: { send: { type: 'body', property: 'text' } },
522
+ },
523
+ {
524
+ displayName: 'Header',
525
+ name: 'headerNormalized',
526
+ type: 'hidden',
527
+ displayOptions: { show: { resource: ['message'], operation: ['send'] } },
528
+ default: '={{ $parameter.additionalFields?.headerContent ? { type: $parameter.additionalFields.headerType || "text", content: $parameter.additionalFields.headerContent } : undefined }}',
529
+ routing: { send: { type: 'body', property: 'header' } },
530
+ },
531
+ {
532
+ displayName: 'Footer',
533
+ name: 'footerNormalized',
534
+ type: 'hidden',
535
+ displayOptions: { show: { resource: ['message'], operation: ['send'] } },
536
+ default: '={{ $parameter.additionalFields?.footer || undefined }}',
537
+ routing: { send: { type: 'body', property: 'footer' } },
538
+ },
375
539
  // Message: Get Status
376
540
  {
377
541
  displayName: 'Message ID',
@@ -382,6 +546,67 @@ class PilotStatus {
382
546
  default: '',
383
547
  required: true,
384
548
  },
549
+ // Message: Cancel
550
+ {
551
+ displayName: 'Message IDs',
552
+ name: 'messageIds',
553
+ type: 'string',
554
+ description: 'Comma-separated message IDs to cancel (1-100)',
555
+ displayOptions: { show: { resource: ['message'], operation: ['cancel'] } },
556
+ default: '',
557
+ required: true,
558
+ placeholder: 'id1,id2,id3',
559
+ },
560
+ // ----------------------------------
561
+ // Media Operations
562
+ // ----------------------------------
563
+ {
564
+ displayName: 'Operation',
565
+ name: 'operation',
566
+ type: 'options',
567
+ noDataExpression: true,
568
+ displayOptions: { show: { resource: ['media'] } },
569
+ options: [
570
+ {
571
+ name: 'Download',
572
+ value: 'download',
573
+ description: 'Download inbound media as base64',
574
+ action: 'Download inbound media',
575
+ routing: {
576
+ request: {
577
+ method: 'GET',
578
+ url: '=/media/{{$parameter.mediaId}}',
579
+ },
580
+ },
581
+ },
582
+ ],
583
+ default: 'download',
584
+ },
585
+ // Media: Download
586
+ {
587
+ displayName: 'Media ID',
588
+ name: 'mediaId',
589
+ type: 'string',
590
+ description: 'Meta media object ID from inbound webhook payload',
591
+ displayOptions: { show: { resource: ['media'], operation: ['download'] } },
592
+ default: '',
593
+ required: true,
594
+ },
595
+ {
596
+ displayName: 'Phone Number ID',
597
+ name: 'phoneNumberId',
598
+ type: 'string',
599
+ description: 'Meta Phone Number ID that received the message (from webhook payload)',
600
+ displayOptions: { show: { resource: ['media'], operation: ['download'] } },
601
+ default: '',
602
+ required: true,
603
+ routing: {
604
+ send: {
605
+ type: 'query',
606
+ property: 'phoneNumberId',
607
+ },
608
+ },
609
+ },
385
610
  // ----------------------------------
386
611
  // Project Operations
387
612
  // ----------------------------------
@@ -470,6 +695,15 @@ class PilotStatus {
470
695
  default: 3650,
471
696
  routing: { send: { type: 'body', property: 'retentionDays' } },
472
697
  },
698
+ {
699
+ displayName: 'WhatsApp Number ID',
700
+ name: 'whatsappNumberId',
701
+ type: 'string',
702
+ displayOptions: { show: { resource: ['apiKey'], operation: ['create'] } },
703
+ default: '',
704
+ description: 'ID of the WhatsApp number to link to this API key',
705
+ routing: { send: { type: 'body', property: 'whatsappNumberId' } },
706
+ },
473
707
  // ----------------------------------
474
708
  // Number Operations
475
709
  // ----------------------------------
@@ -501,6 +735,20 @@ class PilotStatus {
501
735
  action: 'Connect a number',
502
736
  routing: { request: { method: 'GET', url: '=/numbers/{{$parameter.numberId}}/connect' } },
503
737
  },
738
+ {
739
+ name: 'Delete',
740
+ value: 'delete',
741
+ description: 'Remove a WhatsApp number',
742
+ action: 'Delete a number',
743
+ routing: { request: { method: 'DELETE', url: '=/numbers/{{$parameter.numberId}}' } },
744
+ },
745
+ {
746
+ name: 'Remote Pairing',
747
+ value: 'remotePairing',
748
+ description: 'Connect a number via remote pairing',
749
+ action: 'Remote pairing a number',
750
+ routing: { request: { method: 'POST', url: '/numbers/remote-pairing' } },
751
+ },
504
752
  ],
505
753
  default: 'create',
506
754
  },
@@ -508,7 +756,7 @@ class PilotStatus {
508
756
  displayName: 'Name',
509
757
  name: 'name',
510
758
  type: 'string',
511
- displayOptions: { show: { resource: ['number'], operation: ['create'] } },
759
+ displayOptions: { show: { resource: ['number'], operation: ['create', 'remotePairing'] } },
512
760
  default: '',
513
761
  required: true,
514
762
  routing: { send: { type: 'body', property: 'name' } },
@@ -517,7 +765,7 @@ class PilotStatus {
517
765
  displayName: 'Number',
518
766
  name: 'number',
519
767
  type: 'string',
520
- displayOptions: { show: { resource: ['number'], operation: ['create'] } },
768
+ displayOptions: { show: { resource: ['number'], operation: ['create', 'remotePairing'] } },
521
769
  default: '',
522
770
  required: true,
523
771
  description: 'E.164 format (e.g. +5511999999999)',
@@ -527,19 +775,103 @@ class PilotStatus {
527
775
  displayName: 'Link to API Key',
528
776
  name: 'linkToApiKey',
529
777
  type: 'boolean',
530
- displayOptions: { show: { resource: ['number'], operation: ['create'] } },
778
+ displayOptions: { show: { resource: ['number'], operation: ['create', 'remotePairing'] } },
531
779
  default: true,
532
780
  routing: { send: { type: 'body', property: 'linkToApiKey' } },
533
781
  },
782
+ {
783
+ displayName: 'Send via WhatsApp',
784
+ name: 'sendViaWhatsApp',
785
+ type: 'boolean',
786
+ displayOptions: { show: { resource: ['number'], operation: ['remotePairing'] } },
787
+ default: false,
788
+ description: 'Whether to send the pairing code via WhatsApp message',
789
+ routing: { send: { type: 'body', property: 'sendViaWhatsApp' } },
790
+ },
534
791
  {
535
792
  displayName: 'Number Instance ID',
536
793
  name: 'numberId',
537
794
  type: 'string',
538
- displayOptions: { show: { resource: ['number'], operation: ['getStatus', 'connect'] } },
795
+ displayOptions: { show: { resource: ['number'], operation: ['getStatus', 'connect', 'delete'] } },
539
796
  default: '',
540
797
  required: true,
541
798
  },
542
799
  // ----------------------------------
800
+ // Template Operations
801
+ // ----------------------------------
802
+ {
803
+ displayName: 'Operation',
804
+ name: 'operation',
805
+ type: 'options',
806
+ noDataExpression: true,
807
+ displayOptions: { show: { resource: ['template'] } },
808
+ options: [
809
+ {
810
+ name: 'Get Many',
811
+ value: 'getAll',
812
+ description: 'List all message templates',
813
+ action: 'Get many templates',
814
+ routing: { request: { method: 'GET', url: '/templates' } },
815
+ },
816
+ {
817
+ name: 'Get',
818
+ value: 'get',
819
+ description: 'Get a single template by ID',
820
+ action: 'Get a template',
821
+ routing: { request: { method: 'GET', url: '=/templates/{{$parameter.templateIdForGet}}' } },
822
+ },
823
+ ],
824
+ default: 'getAll',
825
+ },
826
+ {
827
+ displayName: 'Template ID',
828
+ name: 'templateIdForGet',
829
+ type: 'string',
830
+ displayOptions: { show: { resource: ['template'], operation: ['get'] } },
831
+ default: '',
832
+ required: true,
833
+ },
834
+ // ----------------------------------
835
+ // Group Operations
836
+ // ----------------------------------
837
+ {
838
+ displayName: 'Operation',
839
+ name: 'operation',
840
+ type: 'options',
841
+ noDataExpression: true,
842
+ displayOptions: { show: { resource: ['group'] } },
843
+ options: [
844
+ {
845
+ name: 'Get Many',
846
+ value: 'getAll',
847
+ description: 'List WhatsApp groups',
848
+ action: 'Get many groups',
849
+ routing: { request: { method: 'GET', url: '/groups' } },
850
+ },
851
+ ],
852
+ default: 'getAll',
853
+ },
854
+ // ----------------------------------
855
+ // Newsletter Operations
856
+ // ----------------------------------
857
+ {
858
+ displayName: 'Operation',
859
+ name: 'operation',
860
+ type: 'options',
861
+ noDataExpression: true,
862
+ displayOptions: { show: { resource: ['newsletter'] } },
863
+ options: [
864
+ {
865
+ name: 'Get Many',
866
+ value: 'getAll',
867
+ description: 'List WhatsApp newsletters',
868
+ action: 'Get many newsletters',
869
+ routing: { request: { method: 'GET', url: '/newsletters' } },
870
+ },
871
+ ],
872
+ default: 'getAll',
873
+ },
874
+ // ----------------------------------
543
875
  // Analytics Operations
544
876
  // ----------------------------------
545
877
  {
@@ -568,6 +900,49 @@ class PilotStatus {
568
900
  description: 'IANA timezone (e.g. America/Sao_Paulo)',
569
901
  routing: { send: { type: 'query', property: 'tz' } },
570
902
  },
903
+ // ----------------------------------
904
+ // Remote Pairing Operations
905
+ // ----------------------------------
906
+ {
907
+ displayName: 'Operation',
908
+ name: 'operation',
909
+ type: 'options',
910
+ noDataExpression: true,
911
+ displayOptions: { show: { resource: ['remotePairing'] } },
912
+ options: [
913
+ {
914
+ name: 'Get Info',
915
+ value: 'getInfo',
916
+ description: 'Get remote pairing info by token',
917
+ action: 'Get remote pairing info',
918
+ routing: { request: { method: 'GET', url: '=/remote-pairing/{{$parameter.pairingToken}}' } },
919
+ },
920
+ {
921
+ name: 'Get Status',
922
+ value: 'getStatus',
923
+ description: 'Get remote pairing connection status',
924
+ action: 'Get remote pairing status',
925
+ routing: { request: { method: 'GET', url: '=/remote-pairing/{{$parameter.pairingToken}}/status' } },
926
+ },
927
+ {
928
+ name: 'Connect',
929
+ value: 'connect',
930
+ description: 'Initiate remote pairing connection (generate QR/pairing code)',
931
+ action: 'Connect remote pairing',
932
+ routing: { request: { method: 'POST', url: '=/remote-pairing/{{$parameter.pairingToken}}/connect' } },
933
+ },
934
+ ],
935
+ default: 'getInfo',
936
+ },
937
+ {
938
+ displayName: 'Pairing Token',
939
+ name: 'pairingToken',
940
+ type: 'string',
941
+ displayOptions: { show: { resource: ['remotePairing'] } },
942
+ default: '',
943
+ required: true,
944
+ description: 'The remote pairing token',
945
+ },
571
946
  ],
572
947
  };
573
948
  }
@@ -65,10 +65,6 @@ class PilotStatusTrigger {
65
65
  name: 'Newsletter Message',
66
66
  value: 'message.newsletter',
67
67
  },
68
- {
69
- name: 'Opt-in Created',
70
- value: 'optin.created',
71
- },
72
68
  {
73
69
  name: 'Number Created',
74
70
  value: 'number.created',
@@ -101,7 +97,7 @@ class PilotStatusTrigger {
101
97
  name: 'payloadNotice',
102
98
  type: 'notice',
103
99
  default: '',
104
- description: 'The full JSON body is passed through (event + data). Outbound events may include optional correlationId. message.reply always includes messageRepliedId (string or null).',
100
+ description: 'The full JSON body is passed through (event + data). Phones are E.164 with a leading "+"; message.* events carry from/to/numberId/id/messageId/type/createdAt and may include an optional correlationId. message.reply adds contentReplied and quotedMessageId.',
105
101
  },
106
102
  ],
107
103
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-pilot-status",
3
- "version": "1.0.11",
3
+ "version": "1.2.0",
4
4
  "description": "n8n node for Pilot Status API",
5
5
  "keywords": [
6
6
  "n8ncommunity",
@@ -14,6 +14,7 @@
14
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
15
  "dev": "tsc --watch",
16
16
  "test": "jest",
17
+ "test:coverage": "jest --coverage",
17
18
  "prepublishOnly": "npm run build"
18
19
  },
19
20
  "files": [