n8n-nodes-pilot-status 2.1.0 → 2.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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `n8n-nodes-pilot-status`.
|
|
4
4
|
|
|
5
|
+
## 2.2.0 - 2026-09-10
|
|
6
|
+
|
|
7
|
+
### Blocos interativos: `list`, `carousel` e `flow`
|
|
8
|
+
|
|
9
|
+
Os tres blocos passam a ser tipados **e encaminhados**. Antes, `list` e `carousel`
|
|
10
|
+
eram descartados EM SILENCIO: o corpo do envio e montado campo a campo, e um campo
|
|
11
|
+
que ninguem acrescenta ao construtor nao chega ao servidor por mais bem tipado que
|
|
12
|
+
esteja. Quem os passasse via a mensagem sair como texto simples, sem erro nenhum.
|
|
13
|
+
|
|
14
|
+
- `list` — lista interativa single-select
|
|
15
|
+
- `carousel` — carrossel de cards de midia
|
|
16
|
+
- `flow` — **novo**: Flow escolhido no envio, em vez de fixo num template aprovado
|
|
17
|
+
|
|
18
|
+
`flow` exige a janela de 24h aberta. Com ela fechada a Meta responde `200` e descarta
|
|
19
|
+
a mensagem em silencio, entao o Pilot Status recusa com `FLOW_WINDOW_CLOSED` em vez de
|
|
20
|
+
a deixar desaparecer. Nao ha campo para `flowToken`: ele e gerado por mensagem, e um
|
|
21
|
+
escolhido por quem chama deixaria uma conta reclamar as respostas de outra.
|
|
22
|
+
|
|
5
23
|
## 2.1.0
|
|
6
24
|
|
|
7
25
|
⛔ **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 } }`.
|
|
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
|
],
|
|
@@ -551,6 +576,37 @@ class PilotStatus {
|
|
|
551
576
|
default: '',
|
|
552
577
|
description: 'Footer text for free-form message',
|
|
553
578
|
},
|
|
579
|
+
// ── Blocos interativos ────────────────────────────────────────────────────
|
|
580
|
+
//
|
|
581
|
+
// JSON e nao campos montados na UI, de proposito: cada um destes blocos e uma
|
|
582
|
+
// arvore (secoes com linhas, cards com botoes, um Flow com dados iniciais), e
|
|
583
|
+
// uma UI declarativa para os tres seria maior do que o no inteiro. O JSON deixa
|
|
584
|
+
// colar exatamente o que a documentacao mostra.
|
|
585
|
+
//
|
|
586
|
+
// ⚠️ Os tres sao MUTUAMENTE EXCLUSIVOS entre si e com template, buttons, header e
|
|
587
|
+
// envio direto de midia. A API recusa a combinacao com mensagem propria — este no
|
|
588
|
+
// nao a duplica, para nao haver duas regras a divergir.
|
|
589
|
+
{
|
|
590
|
+
displayName: 'List (JSON)',
|
|
591
|
+
name: 'listJson',
|
|
592
|
+
type: 'json',
|
|
593
|
+
default: '',
|
|
594
|
+
description: 'Lista interativa single-select. Ex.: {"buttonText":"Ver","sections":[{"rows":[{"title":"A"}]}]}. Exige "Text" como corpo.',
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
displayName: 'Carousel (JSON)',
|
|
598
|
+
name: 'carouselJson',
|
|
599
|
+
type: 'json',
|
|
600
|
+
default: '',
|
|
601
|
+
description: 'Carrossel de cards de midia. Cada card carrega a propria midia. Exige "Text" como corpo.',
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
displayName: 'Flow (JSON)',
|
|
605
|
+
name: 'flowJson',
|
|
606
|
+
type: 'json',
|
|
607
|
+
default: '',
|
|
608
|
+
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.',
|
|
609
|
+
},
|
|
554
610
|
],
|
|
555
611
|
},
|
|
556
612
|
// Message: Get History — filtros (query string, não body)
|
|
@@ -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
|
|
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
|
};
|