n8n-nodes-pilot-status 2.1.0 → 2.2.1

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/CHANGELOG.md CHANGED
@@ -2,6 +2,40 @@
2
2
 
3
3
  All notable changes to `n8n-nodes-pilot-status`.
4
4
 
5
+ ## 2.2.1 - 2026-09-29
6
+
7
+ ### Fixed
8
+
9
+ - **Media Type: `audio` and `voice` now describe what the recipient actually gets.** The
10
+ dropdown said "Audio (Voice Note)" and "Voice Note With Waveform", and the help text said
11
+ both "are delivered as WhatsApp voice notes". That was wrong on official (Meta Cloud API)
12
+ numbers: there `audio` arrives as an audio **file**, and only `voice` arrives as a voice
13
+ note. On unofficial numbers both arrive as a voice note. The options are now
14
+ "Audio (File on Official Numbers)" and "Voice Note". **The option values (`audio`,
15
+ `voice`) are unchanged**, so existing workflows keep sending exactly what they sent
16
+ before; pick "Voice Note" when you want a voice message on every number.
17
+ - The Media Type help text also states that `audio`/`voice` cannot be combined with a
18
+ template. The API now rejects `voice` + `templateId` with `400`, as it already did for
19
+ `audio`: before, the template went out and the voice note was silently dropped.
20
+
21
+ ## 2.2.0 - 2026-09-10
22
+
23
+ ### Blocos interativos: `list`, `carousel` e `flow`
24
+
25
+ Os tres blocos passam a ser tipados **e encaminhados**. Antes, `list` e `carousel`
26
+ eram descartados EM SILENCIO: o corpo do envio e montado campo a campo, e um campo
27
+ que ninguem acrescenta ao construtor nao chega ao servidor por mais bem tipado que
28
+ esteja. Quem os passasse via a mensagem sair como texto simples, sem erro nenhum.
29
+
30
+ - `list` — lista interativa single-select
31
+ - `carousel` — carrossel de cards de midia
32
+ - `flow` — **novo**: Flow escolhido no envio, em vez de fixo num template aprovado
33
+
34
+ `flow` exige a janela de 24h aberta. Com ela fechada a Meta responde `200` e descarta
35
+ a mensagem em silencio, entao o Pilot Status recusa com `FLOW_WINDOW_CLOSED` em vez de
36
+ a deixar desaparecer. Nao ha campo para `flowToken`: ele e gerado por mensagem, e um
37
+ escolhido por quem chama deixaria uma conta reclamar as respostas de outra.
38
+
5
39
  ## 2.1.0
6
40
 
7
41
  ⛔ **This release is the first one npm has seen since `1.3.0`.** `1.4.0` and `2.0.0` were
package/README.md CHANGED
@@ -73,7 +73,7 @@ The API never returns the secret — not even in the `201` of the create call
73
73
  - **Newsletter Message** (`message.newsletter`): Triggered when an inbound WhatsApp channel / newsletter message is received.
74
74
  - **Number Created / Connected / Disconnected / Removed** (`number.created`, `number.connected`, `number.disconnected`, `number.removed`): Lifecycle of a WhatsApp number in your account.
75
75
  - **Call Ringing / Connected / Ended / Missed / Permission Updated** (`call.ringing`, `call.connected`, `call.ended`, `call.missed`, `call.permission_updated`): WhatsApp Business Calling events (`call.*`) — Meta Cloud API **and web (Pilot Status) numbers** (`call.permission_updated` is Meta-only). Payloads are **flat** (fields next to `event`, no `data` wrapper): `{ event, callId, externalCallId?, direction, status, from, to, timestamp, duration? }`; `duration` (seconds) appears on `call.ended` only when the call was answered. `externalCallId` is the provider call id (Meta `wacid...` or Evolution GO CallID).
76
- - **Flow Response Received** (`flow.response_received`): Triggered when someone SUBMITS a WhatsApp Flow form — the answers arrive here. **META numbers only.** Wrapped in `data`: `{ event, data: { event, flowId, metaFlowId, flowToken, messageId, whatsappNumberId, from, receivedAt, response, responseRaw } }`. Three things to know. The number field is **`whatsappNumberId`, not `numberId`** — same value, different name on the wire. **`response` and `responseRaw` are mutually exclusive**: `response` holds the parsed answers and `responseRaw` is `null`; if the parse failed it is the other way round, and the raw string is the only copy of the answer there is. And picking this event for a **non-Meta** number fails SILENTLY: the API filters a webhook's events down to what the number's provider can emit, so the subscription is created with an empty event list, returns `201`, and never fires.
76
+ - **Flow Response Received** (`flow.response_received`): Triggered when someone SUBMITS a WhatsApp Flow form — the answers arrive here. **META numbers only.** Wrapped in `data`: `{ event, data: { event, flowId, metaFlowId, flowToken, messageId, whatsappNumberId, from, receivedAt, response, responseRaw, flowMedia, submitted } }`. Four things to know. The number field is **`whatsappNumberId`, not `numberId`** — same value, different name on the wire. **`response` and `responseRaw` are mutually exclusive**: `response` holds what your own Flow endpoint returned, already parsed, and `responseRaw` is `null`; if the parse failed it is the other way round, and the raw string is the only copy of the answer there is. **On a Flow with a `data_exchange` endpoint `response` is EMPTY even on a number that stores everything** — Meta's completion payload carries only the `flow_token` — and what the person typed is in **`submitted`**: one entry per `data_exchange` screen, `{ screen, at, data, omitted }`, in order, where `omitted` (`DATA_TOO_LARGE`, `LIMIT_REACHED` or `UNREADABLE`) says why a `data` is `null`. `flowMedia` holds the files attached inside the form: `{ field, fileName, mimeType, status, url }`. Both are `null` and **never `[]`** when empty, so a node testing for an empty array never fires; `GET /v1/flows/{id}/responses` publishes the same two lists as arrays, under `media` and `submitted`. And picking this event for a **non-Meta** number fails SILENTLY: the API filters a webhook's events down to what the number's provider can emit, so the subscription is created with an empty event list, returns `201`, and never fires.
77
77
 
78
78
  Webhook payload notes:
79
79
  - 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.
@@ -249,6 +249,31 @@ class PilotStatus {
249
249
  }
250
250
  /* v8 ignore stop */
251
251
  requestOptions.body['variables'] = variables;
252
+ // Blocos interativos: cada um chega como JSON e entra no corpo com o
253
+ // nome que a API espera. Um JSON invalido para AQUI com o valor a
254
+ // vista — deixar passar mandaria a mensagem sem o bloco, e ela sairia
255
+ // como texto simples sem nada dizer que o carrossel se perdeu.
256
+ for (const [param, campo] of [
257
+ ['listJson', 'list'],
258
+ ['carouselJson', 'carousel'],
259
+ ['flowJson', 'flow'],
260
+ ]) {
261
+ const bruto = this.getNodeParameter(param, '');
262
+ if (bruto === undefined || bruto === null || bruto === '')
263
+ continue;
264
+ let valor = bruto;
265
+ if (typeof bruto === 'string') {
266
+ try {
267
+ valor = JSON.parse(bruto);
268
+ }
269
+ catch {
270
+ throw new Error(`Pilot Status: "${param}" contém JSON inválido.\nValor recebido: ${bruto}`);
271
+ }
272
+ }
273
+ if (valor && typeof valor === 'object' && !Array.isArray(valor)) {
274
+ requestOptions.body[campo] = valor;
275
+ }
276
+ }
252
277
  return requestOptions;
253
278
  },
254
279
  ],
@@ -503,12 +528,20 @@ class PilotStatus {
503
528
  { name: 'Image', value: 'image' },
504
529
  { name: 'Video', value: 'video' },
505
530
  { name: 'Document', value: 'document' },
506
- { name: 'Audio (Voice Note)', value: 'audio' },
507
- { name: 'Voice Note With Waveform', value: 'voice' },
531
+ {
532
+ name: 'Audio (File on Official Numbers)',
533
+ value: 'audio',
534
+ description: 'Audio file on official (Meta) numbers, voice note on unofficial numbers',
535
+ },
536
+ {
537
+ name: 'Voice Note',
538
+ value: 'voice',
539
+ description: 'Voice note (PTT) on all numbers',
540
+ },
508
541
  { name: 'Sticker', value: 'sticker' },
509
542
  ],
510
543
  default: 'image',
511
- description: 'Type of media being attached. Audio and voice are delivered as WhatsApp voice notes and take no caption. Sticker takes no caption either and must be an image/webp file (static up to 100 KB, animated up to 500 KB).',
544
+ description: 'Type of media being attached. Audio arrives as an audio file on official (Meta) numbers and as a voice note on unofficial numbers; Voice Note arrives as a voice note on all numbers. Audio and Voice Note cannot be combined with a template, and Audio takes no caption. Sticker takes no caption either and must be an image/webp file (static up to 100 KB, animated up to 500 KB).',
512
545
  },
513
546
  {
514
547
  displayName: 'Buttons (JSON)',
@@ -551,6 +584,37 @@ class PilotStatus {
551
584
  default: '',
552
585
  description: 'Footer text for free-form message',
553
586
  },
587
+ // ── Blocos interativos ────────────────────────────────────────────────────
588
+ //
589
+ // JSON e nao campos montados na UI, de proposito: cada um destes blocos e uma
590
+ // arvore (secoes com linhas, cards com botoes, um Flow com dados iniciais), e
591
+ // uma UI declarativa para os tres seria maior do que o no inteiro. O JSON deixa
592
+ // colar exatamente o que a documentacao mostra.
593
+ //
594
+ // ⚠️ Os tres sao MUTUAMENTE EXCLUSIVOS entre si e com template, buttons, header e
595
+ // envio direto de midia. A API recusa a combinacao com mensagem propria — este no
596
+ // nao a duplica, para nao haver duas regras a divergir.
597
+ {
598
+ displayName: 'List (JSON)',
599
+ name: 'listJson',
600
+ type: 'json',
601
+ default: '',
602
+ description: 'Lista interativa single-select. Ex.: {"buttonText":"Ver","sections":[{"rows":[{"title":"A"}]}]}. Exige "Text" como corpo.',
603
+ },
604
+ {
605
+ displayName: 'Carousel (JSON)',
606
+ name: 'carouselJson',
607
+ type: 'json',
608
+ default: '',
609
+ description: 'Carrossel de cards de midia. Cada card carrega a propria midia. Exige "Text" como corpo.',
610
+ },
611
+ {
612
+ displayName: 'Flow (JSON)',
613
+ name: 'flowJson',
614
+ type: 'json',
615
+ default: '',
616
+ description: 'Flow dinamico, escolhido no envio. Ex.: {"flowId":"123","cta":"Abrir"}. EXIGE a janela de 24h aberta: com ela fechada a Meta aceita e descarta em silencio, e o Pilot Status recusa com FLOW_WINDOW_CLOSED. Nao inclua flow_token — ele e gerado por mensagem.',
617
+ },
554
618
  ],
555
619
  },
556
620
  // Message: Get History — filtros (query string, não body)
@@ -1048,8 +1112,8 @@ class PilotStatus {
1048
1112
  displayName: 'History Import Enabled',
1049
1113
  name: 'historyImportEnabled',
1050
1114
  type: 'boolean',
1051
- default: false,
1052
- description: 'Whether to import the history the provider dumps on connect (up to 30 days back) into the chat. Applies to every provider. Off by default, and on a number that already connected this only affects the NEXT connection — the dump that already happened cannot be fetched again.',
1115
+ default: true,
1116
+ description: 'Whether to import the history the provider dumps on connect (up to 30 days back) into the chat. Applies to every provider. On by default, and on a number that already connected this only affects the NEXT connection — the dump that already happened cannot be fetched again.',
1053
1117
  },
1054
1118
  {
1055
1119
  displayName: 'Webhook Historical Messages',
@@ -165,7 +165,7 @@ class PilotStatusTrigger {
165
165
  // non-Meta number, the subscription is created with an EMPTY event
166
166
  // list, HTTP 201, and never fires — so the warning has to live here,
167
167
  // where the choice is made.
168
- description: 'Answers of a submitted WhatsApp Flow. META numbers only: on any other number this subscribes to nothing and the Trigger never fires, with no error at activation. The data wrapper names the number whatsappNumberId, NOT numberId.',
168
+ description: 'Answers of a submitted WhatsApp Flow. META numbers only: on any other number this subscribes to nothing and the Trigger never fires, with no error at activation. The data wrapper names the number whatsappNumberId, NOT numberId. On a Flow with a data_exchange endpoint the answers are in data.submitted, NOT in data.response — see the payload notice below before mapping anything.',
169
169
  },
170
170
  ],
171
171
  default: '*',
@@ -191,7 +191,7 @@ class PilotStatusTrigger {
191
191
  name: 'payloadNotice',
192
192
  type: 'notice',
193
193
  default: '',
194
- 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. call.* events (WhatsApp Business Calling — Meta Cloud API and web/Pilot Status numbers; call.permission_updated is Meta-only) are FLAT — fields sit next to event with no data wrapper: { event, callId, externalCallId?, direction, status, from, to, timestamp, duration? }. externalCallId is the provider call id (Meta wacid or Evolution GO CallID). On every number.* event, data.numberId is the WhatsApp NUMBER id — the same id GET /v1/numbers returns and the other number operations take. It used to carry the underlying instance id on number.created/connected/removed, so a workflow that stored that value and matched later events against it never matched. flow.response_received (Meta numbers only) carries the submitted Flow answers under data: { event, flowId, metaFlowId, flowToken, messageId, whatsappNumberId, from, receivedAt, response, responseRaw }. Its number field is whatsappNumberId, NOT numberId — same value, different name, so a mapping copied from a message.* branch reads undefined. response and responseRaw are mutually exclusive: response holds the parsed answers, and responseRaw carries the raw bytes from Meta ONLY when that parse failed.',
194
+ 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. call.* events (WhatsApp Business Calling — Meta Cloud API and web/Pilot Status numbers; call.permission_updated is Meta-only) are FLAT — fields sit next to event with no data wrapper: { event, callId, externalCallId?, direction, status, from, to, timestamp, duration? }. externalCallId is the provider call id (Meta wacid or Evolution GO CallID). On every number.* event, data.numberId is the WhatsApp NUMBER id — the same id GET /v1/numbers returns and the other number operations take. It used to carry the underlying instance id on number.created/connected/removed, so a workflow that stored that value and matched later events against it never matched. flow.response_received (Meta numbers only) carries the submitted Flow answers under data: { event, flowId, metaFlowId, flowToken, messageId, whatsappNumberId, from, receivedAt, response, responseRaw, flowMedia, submitted }. Its number field is whatsappNumberId, NOT numberId — same value, different name, so a mapping copied from a message.* branch reads undefined. response and responseRaw are mutually exclusive: response holds what YOUR OWN Flow endpoint returned, already parsed, and responseRaw carries the raw bytes from Meta ONLY when that parse failed. On a Flow with a data_exchange endpoint response is EMPTY even on a number that stores everything — Meta\'s completion payload carries only the flow_token — and WHAT THE PERSON TYPED IS IN submitted: one entry per data_exchange screen, { screen, at, data, omitted }, in order, where omitted (DATA_TOO_LARGE, LIMIT_REACHED or UNREADABLE) says why a data is null. flowMedia holds the files attached inside the form: { field, fileName, mimeType, status, url }. Both submitted and flowMedia are null and NEVER [] when empty, so a node testing for an empty array never fires; GET /v1/flows/{id}/responses publishes the same two lists as arrays, under media and submitted.',
195
195
  },
196
196
  ],
197
197
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-pilot-status",
3
- "version": "2.1.0",
3
+ "version": "2.2.1",
4
4
  "description": "n8n node for Pilot Status API",
5
5
  "keywords": [
6
6
  "n8ncommunity",