n8n-nodes-pilot-status 1.1.0 → 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
  };
@@ -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,7 +30,7 @@ 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
  }));
@@ -40,7 +40,7 @@ class PilotStatus {
40
40
  async getGroups() {
41
41
  const response = (await this.helpers.requestWithAuthentication.call(this, 'pilotStatusApi', {
42
42
  method: 'GET',
43
- baseURL: 'https://pilotstatus.online/v1',
43
+ baseURL: 'https://pilotstatuss.com/v1',
44
44
  url: '/groups',
45
45
  json: true,
46
46
  }));
@@ -52,7 +52,7 @@ class PilotStatus {
52
52
  async getNewsletters() {
53
53
  const response = (await this.helpers.requestWithAuthentication.call(this, 'pilotStatusApi', {
54
54
  method: 'GET',
55
- baseURL: 'https://pilotstatus.online/v1',
55
+ baseURL: 'https://pilotstatuss.com/v1',
56
56
  url: '/newsletters',
57
57
  json: true,
58
58
  }));
@@ -83,7 +83,7 @@ class PilotStatus {
83
83
  },
84
84
  ],
85
85
  requestDefaults: {
86
- baseURL: 'https://pilotstatus.online/v1',
86
+ baseURL: 'https://pilotstatuss.com/v1',
87
87
  headers: {
88
88
  Accept: 'application/json',
89
89
  'Content-Type': 'application/json',
@@ -97,6 +97,7 @@ class PilotStatus {
97
97
  noDataExpression: true,
98
98
  options: [
99
99
  { name: 'Message', value: 'message' },
100
+ { name: 'Media', value: 'media' },
100
101
  { name: 'Project', value: 'project' },
101
102
  { name: 'API Key', value: 'apiKey' },
102
103
  { name: 'Number', value: 'number' },
@@ -104,6 +105,7 @@ class PilotStatus {
104
105
  { name: 'Group', value: 'group' },
105
106
  { name: 'Newsletter', value: 'newsletter' },
106
107
  { name: 'Analytics', value: 'analytics' },
108
+ { name: 'Remote Pairing', value: 'remotePairing' },
107
109
  ],
108
110
  default: 'message',
109
111
  },
@@ -182,9 +184,12 @@ class PilotStatus {
182
184
  variables[entry.name] = String((_b = entry.value) !== null && _b !== void 0 ? _b : '');
183
185
  }
184
186
  }
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 */
185
189
  if (!requestOptions.body || typeof requestOptions.body !== 'object') {
186
190
  requestOptions.body = {};
187
191
  }
192
+ /* v8 ignore stop */
188
193
  requestOptions.body['variables'] = variables;
189
194
  return requestOptions;
190
195
  },
@@ -202,15 +207,27 @@ class PilotStatus {
202
207
  },
203
208
  },
204
209
  {
205
- name: 'Check Opt-In',
206
- value: 'checkOptIn',
207
- description: 'Check opt-in status for a number',
208
- action: 'Check opt in status for a number',
210
+ name: 'Cancel',
211
+ value: 'cancel',
212
+ description: 'Cancel scheduled messages',
213
+ action: 'Cancel messages',
209
214
  routing: {
210
- request: {
211
- method: 'GET',
212
- url: '/messages/opt-in',
213
- 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
+ ],
214
231
  },
215
232
  },
216
233
  },
@@ -225,7 +242,7 @@ class PilotStatus {
225
242
  typeOptions: { loadOptionsMethod: 'getTemplates' },
226
243
  displayOptions: { show: { resource: ['message'], operation: ['send'] } },
227
244
  default: '',
228
- required: true,
245
+ required: false,
229
246
  routing: { send: { type: 'body', property: 'templateId' } },
230
247
  },
231
248
  {
@@ -257,18 +274,6 @@ class PilotStatus {
257
274
  required: true,
258
275
  routing: { send: { type: 'body', property: 'destinationNumber' } },
259
276
  },
260
- {
261
- displayName: 'Destination Number',
262
- name: 'destinationNumber',
263
- type: 'string',
264
- description: 'E.164 format (e.g. +5511999999999)',
265
- displayOptions: {
266
- show: { resource: ['message'], operation: ['checkOptIn'] },
267
- },
268
- default: '',
269
- required: true,
270
- routing: { send: { type: 'query', property: 'destinationNumber' } },
271
- },
272
277
  {
273
278
  displayName: 'Group ID',
274
279
  name: 'groupId',
@@ -414,6 +419,40 @@ class PilotStatus {
414
419
  default: '',
415
420
  description: 'JSON array of button objects (reply, url, call, copy)',
416
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
+ },
417
456
  ],
418
457
  },
419
458
  // Hidden fields para deliverAt / deliverUntil normalizados
@@ -473,6 +512,30 @@ class PilotStatus {
473
512
  default: '={{ $parameter.additionalFields?.buttons ? (() => { try { return JSON.parse($parameter.additionalFields.buttons); } catch { return undefined; } })() : undefined }}',
474
513
  routing: { send: { type: 'body', property: 'buttons' } },
475
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
+ },
476
539
  // Message: Get Status
477
540
  {
478
541
  displayName: 'Message ID',
@@ -483,6 +546,67 @@ class PilotStatus {
483
546
  default: '',
484
547
  required: true,
485
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
+ },
486
610
  // ----------------------------------
487
611
  // Project Operations
488
612
  // ----------------------------------
@@ -571,6 +695,15 @@ class PilotStatus {
571
695
  default: 3650,
572
696
  routing: { send: { type: 'body', property: 'retentionDays' } },
573
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
+ },
574
707
  // ----------------------------------
575
708
  // Number Operations
576
709
  // ----------------------------------
@@ -767,6 +900,49 @@ class PilotStatus {
767
900
  description: 'IANA timezone (e.g. America/Sao_Paulo)',
768
901
  routing: { send: { type: 'query', property: 'tz' } },
769
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
+ },
770
946
  ],
771
947
  };
772
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.1.0",
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": [