n8n-nodes-pilot-status 1.3.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 +63 -0
- package/README.md +53 -17
- package/dist/credentials/PilotStatusApi.credentials.d.ts +2 -0
- package/dist/credentials/PilotStatusApi.credentials.js +25 -2
- package/dist/nodes/PilotStatus/PilotStatus.node.d.ts +22 -0
- package/dist/nodes/PilotStatus/PilotStatus.node.js +754 -60
- package/dist/nodes/PilotStatusTrigger/PilotStatusTrigger.node.d.ts +22 -1
- package/dist/nodes/PilotStatusTrigger/PilotStatusTrigger.node.js +169 -3
- package/package.json +4 -3
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PilotStatus = exports.GO_TRISTATE = void 0;
|
|
3
|
+
exports.PilotStatus = exports.DEFAULT_BASE_URL = exports.FLOW_CATEGORY_OPTIONS = exports.GO_TRISTATE = void 0;
|
|
4
|
+
exports.apiBaseUrl = apiBaseUrl;
|
|
4
5
|
/**
|
|
5
6
|
* Tri-estado dos `advancedSettings` do Evolution GO. A API distingue `true`,
|
|
6
7
|
* `false` e `null` (= volta ao default do provider), e o `type: 'boolean'` do
|
|
@@ -12,6 +13,41 @@ exports.GO_TRISTATE = [
|
|
|
12
13
|
{ name: 'Off', value: 'off' },
|
|
13
14
|
{ name: 'Reset to Provider Default', value: 'default', description: 'Clear the stored value (sends null)' },
|
|
14
15
|
];
|
|
16
|
+
/**
|
|
17
|
+
* The Flow categories Meta accepts, as n8n dropdown options.
|
|
18
|
+
*
|
|
19
|
+
* ⚠️ A CLOSED list, mirroring `FLOW_CATEGORIES` in the backend's `flow.service.ts`.
|
|
20
|
+
* A free string would only fail AFTER the round trip to the Graph, and Meta's refusal
|
|
21
|
+
* does not name which of the values it rejected — so the author would be left guessing
|
|
22
|
+
* at a typo the node could have made unrepresentable.
|
|
23
|
+
*
|
|
24
|
+
* Shared by Create and Update so the two controls cannot drift apart.
|
|
25
|
+
*/
|
|
26
|
+
exports.FLOW_CATEGORY_OPTIONS = [
|
|
27
|
+
{ name: 'Sign Up', value: 'SIGN_UP' },
|
|
28
|
+
{ name: 'Sign In', value: 'SIGN_IN' },
|
|
29
|
+
{ name: 'Appointment Booking', value: 'APPOINTMENT_BOOKING' },
|
|
30
|
+
{ name: 'Lead Generation', value: 'LEAD_GENERATION' },
|
|
31
|
+
{ name: 'Contact Us', value: 'CONTACT_US' },
|
|
32
|
+
{ name: 'Customer Support', value: 'CUSTOMER_SUPPORT' },
|
|
33
|
+
{ name: 'Survey', value: 'SURVEY' },
|
|
34
|
+
{ name: 'Other', value: 'OTHER' },
|
|
35
|
+
];
|
|
36
|
+
/** Production. Mirrors the credential's default. */
|
|
37
|
+
exports.DEFAULT_BASE_URL = 'https://pilotstatus.com.br';
|
|
38
|
+
/**
|
|
39
|
+
* The `/v1` root to use in the `loadOptions` calls.
|
|
40
|
+
*
|
|
41
|
+
* The node's `requestDefaults` resolves `$credentials` on its own, but
|
|
42
|
+
* `loadOptions` runs outside that path: here the URL was a literal, so the
|
|
43
|
+
* template/group dropdowns hit PRODUCTION even with the credential pointing at
|
|
44
|
+
* staging — the author saw one list while the workflow called a different API.
|
|
45
|
+
*/
|
|
46
|
+
async function apiBaseUrl(ctx) {
|
|
47
|
+
const credentials = (await ctx.getCredentials('pilotStatusApi'));
|
|
48
|
+
const root = (credentials === null || credentials === void 0 ? void 0 : credentials.baseUrl) || exports.DEFAULT_BASE_URL;
|
|
49
|
+
return `${root.replace(/\/+$/, '')}/v1`;
|
|
50
|
+
}
|
|
15
51
|
class PilotStatus {
|
|
16
52
|
constructor() {
|
|
17
53
|
this.methods = {
|
|
@@ -19,7 +55,7 @@ class PilotStatus {
|
|
|
19
55
|
async getTemplates() {
|
|
20
56
|
const response = (await this.helpers.requestWithAuthentication.call(this, 'pilotStatusApi', {
|
|
21
57
|
method: 'GET',
|
|
22
|
-
baseURL:
|
|
58
|
+
baseURL: await apiBaseUrl(this),
|
|
23
59
|
url: '/templates',
|
|
24
60
|
json: true,
|
|
25
61
|
}));
|
|
@@ -41,7 +77,7 @@ class PilotStatus {
|
|
|
41
77
|
return [];
|
|
42
78
|
const response = (await this.helpers.requestWithAuthentication.call(this, 'pilotStatusApi', {
|
|
43
79
|
method: 'GET',
|
|
44
|
-
baseURL:
|
|
80
|
+
baseURL: await apiBaseUrl(this),
|
|
45
81
|
url: `/templates/${templateId}`,
|
|
46
82
|
json: true,
|
|
47
83
|
}));
|
|
@@ -51,7 +87,7 @@ class PilotStatus {
|
|
|
51
87
|
async getGroups() {
|
|
52
88
|
const response = (await this.helpers.requestWithAuthentication.call(this, 'pilotStatusApi', {
|
|
53
89
|
method: 'GET',
|
|
54
|
-
baseURL:
|
|
90
|
+
baseURL: await apiBaseUrl(this),
|
|
55
91
|
url: '/groups',
|
|
56
92
|
json: true,
|
|
57
93
|
}));
|
|
@@ -63,7 +99,7 @@ class PilotStatus {
|
|
|
63
99
|
async getNewsletters() {
|
|
64
100
|
const response = (await this.helpers.requestWithAuthentication.call(this, 'pilotStatusApi', {
|
|
65
101
|
method: 'GET',
|
|
66
|
-
baseURL:
|
|
102
|
+
baseURL: await apiBaseUrl(this),
|
|
67
103
|
url: '/newsletters',
|
|
68
104
|
json: true,
|
|
69
105
|
}));
|
|
@@ -94,7 +130,11 @@ class PilotStatus {
|
|
|
94
130
|
},
|
|
95
131
|
],
|
|
96
132
|
requestDefaults: {
|
|
97
|
-
|
|
133
|
+
// `requestDefaults` is resolved by the RoutingNode with `$credentials` in
|
|
134
|
+
// scope, so the root comes from the credential and not from a literal —
|
|
135
|
+
// that is what allows pointing a whole workflow at staging without
|
|
136
|
+
// editing the node.
|
|
137
|
+
baseURL: `={{ ($credentials.baseUrl || "${exports.DEFAULT_BASE_URL}").replace(/\\/+$/, "") + "/v1" }}`,
|
|
98
138
|
headers: {
|
|
99
139
|
Accept: 'application/json',
|
|
100
140
|
'Content-Type': 'application/json',
|
|
@@ -107,15 +147,21 @@ class PilotStatus {
|
|
|
107
147
|
type: 'options',
|
|
108
148
|
noDataExpression: true,
|
|
109
149
|
options: [
|
|
150
|
+
// 'Project' was REMOVED: `/v1/projects` does not exist in the backend, so
|
|
151
|
+
// the two operations could only ever return 404 — with autocomplete
|
|
152
|
+
// claiming otherwise. A saved workflow still pointing at it now fails at
|
|
153
|
+
// resource selection, which is better than failing on a 404 in
|
|
154
|
+
// production.
|
|
110
155
|
{ name: 'Message', value: 'message' },
|
|
111
156
|
{ name: 'Media', value: 'media' },
|
|
112
|
-
{ name: 'Project', value: 'project' },
|
|
113
157
|
{ name: 'API Key', value: 'apiKey' },
|
|
114
158
|
{ name: 'Number', value: 'number' },
|
|
115
159
|
{ name: 'Template', value: 'template' },
|
|
160
|
+
{ name: 'Flow', value: 'flow' },
|
|
116
161
|
{ name: 'Group', value: 'group' },
|
|
117
162
|
{ name: 'Newsletter', value: 'newsletter' },
|
|
118
163
|
{ name: 'Analytics', value: 'analytics' },
|
|
164
|
+
{ name: 'Service Window', value: 'serviceWindow' },
|
|
119
165
|
{ name: 'Remote Pairing', value: 'remotePairing' },
|
|
120
166
|
{ name: 'Call', value: 'call' },
|
|
121
167
|
],
|
|
@@ -203,6 +249,31 @@ class PilotStatus {
|
|
|
203
249
|
}
|
|
204
250
|
/* v8 ignore stop */
|
|
205
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
|
+
}
|
|
206
277
|
return requestOptions;
|
|
207
278
|
},
|
|
208
279
|
],
|
|
@@ -227,6 +298,34 @@ class PilotStatus {
|
|
|
227
298
|
request: { method: 'GET', url: '/messages/history' },
|
|
228
299
|
},
|
|
229
300
|
},
|
|
301
|
+
{
|
|
302
|
+
name: 'Get Many',
|
|
303
|
+
value: 'getAll',
|
|
304
|
+
description: 'List the message LOG (sent and received) with delivery status, newest first. Different from Get History: this is the operational trail (status, errorCode, origin, whether the 24h window was open at send), not the chat thread. More filters (dates, search, templateId) are available through n8n\'s generic HTTP Request node with this same credential.',
|
|
305
|
+
action: 'Get many messages',
|
|
306
|
+
routing: { request: { method: 'GET', url: '/messages' } },
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
name: 'Get Unread',
|
|
310
|
+
value: 'getUnread',
|
|
311
|
+
description: 'List unread inbound messages. `total` is the real unread count (from the conversation counters) — NOT the length of the returned list, which carries only the latest unread per conversation. Empty when the number\'s privacy mode is RELAY_ONLY.',
|
|
312
|
+
action: 'Get unread messages',
|
|
313
|
+
routing: { request: { method: 'GET', url: '/messages/unread' } },
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
name: 'Mark as Read',
|
|
317
|
+
value: 'markRead',
|
|
318
|
+
description: 'Send a read receipt (blue ticks) for a contact\'s LAST inbound message and every earlier one, WITHOUT sending a message. Best-effort: a 200 with acked=false means there was nothing to acknowledge (empty thread) or the number is RELAY_ONLY.',
|
|
319
|
+
action: 'Mark messages as read',
|
|
320
|
+
routing: { request: { method: 'POST', url: '/messages/read' } },
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
name: 'Send Typing Indicator',
|
|
324
|
+
value: 'typing',
|
|
325
|
+
description: 'Show a live typing/recording indicator to a contact without sending a message. It clears when a message is sent or after a provider timeout (~25s on Meta). On META numbers "recording" is shown as "typing" and "paused" is a no-op — read effectiveState in the response to see what actually happened.',
|
|
326
|
+
action: 'Send a typing indicator',
|
|
327
|
+
routing: { request: { method: 'POST', url: '/messages/typing' } },
|
|
328
|
+
},
|
|
230
329
|
{
|
|
231
330
|
name: 'Cancel',
|
|
232
331
|
value: 'cancel',
|
|
@@ -419,7 +518,7 @@ class PilotStatus {
|
|
|
419
518
|
name: 'media',
|
|
420
519
|
type: 'string',
|
|
421
520
|
default: '',
|
|
422
|
-
description: 'URL of the media to attach (image, video, or
|
|
521
|
+
description: 'URL of the media to attach (image, video, document, audio, voice, or sticker)',
|
|
423
522
|
},
|
|
424
523
|
{
|
|
425
524
|
displayName: 'Media Type',
|
|
@@ -429,9 +528,12 @@ class PilotStatus {
|
|
|
429
528
|
{ name: 'Image', value: 'image' },
|
|
430
529
|
{ name: 'Video', value: 'video' },
|
|
431
530
|
{ name: 'Document', value: 'document' },
|
|
531
|
+
{ name: 'Audio (Voice Note)', value: 'audio' },
|
|
532
|
+
{ name: 'Voice Note With Waveform', value: 'voice' },
|
|
533
|
+
{ name: 'Sticker', value: 'sticker' },
|
|
432
534
|
],
|
|
433
535
|
default: 'image',
|
|
434
|
-
description: 'Type of media being attached',
|
|
536
|
+
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).',
|
|
435
537
|
},
|
|
436
538
|
{
|
|
437
539
|
displayName: 'Buttons (JSON)',
|
|
@@ -474,6 +576,37 @@ class PilotStatus {
|
|
|
474
576
|
default: '',
|
|
475
577
|
description: 'Footer text for free-form message',
|
|
476
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
|
+
},
|
|
477
610
|
],
|
|
478
611
|
},
|
|
479
612
|
// Message: Get History — filtros (query string, não body)
|
|
@@ -631,6 +764,91 @@ class PilotStatus {
|
|
|
631
764
|
required: true,
|
|
632
765
|
placeholder: 'id1,id2,id3',
|
|
633
766
|
},
|
|
767
|
+
// Message: Get Many / Get Unread
|
|
768
|
+
//
|
|
769
|
+
// ⚠️ Field shared by TWO operations: whoever adds a third one that paginates
|
|
770
|
+
// must include it in this `displayOptions.show.operation`, otherwise the
|
|
771
|
+
// control simply does not render — with no error at all.
|
|
772
|
+
{
|
|
773
|
+
displayName: 'Page',
|
|
774
|
+
name: 'listPage',
|
|
775
|
+
type: 'number',
|
|
776
|
+
typeOptions: { minValue: 1 },
|
|
777
|
+
displayOptions: { show: { resource: ['message'], operation: ['getAll', 'getUnread'] } },
|
|
778
|
+
default: 1,
|
|
779
|
+
routing: { send: { type: 'query', property: 'page' } },
|
|
780
|
+
},
|
|
781
|
+
{
|
|
782
|
+
displayName: 'Page Size',
|
|
783
|
+
name: 'listPageSize',
|
|
784
|
+
type: 'number',
|
|
785
|
+
typeOptions: { minValue: 1, maxValue: 100 },
|
|
786
|
+
displayOptions: { show: { resource: ['message'], operation: ['getAll', 'getUnread'] } },
|
|
787
|
+
default: 30,
|
|
788
|
+
description: 'Items per page (max 100)',
|
|
789
|
+
routing: { send: { type: 'query', property: 'pageSize' } },
|
|
790
|
+
},
|
|
791
|
+
{
|
|
792
|
+
displayName: 'Direction',
|
|
793
|
+
name: 'listDirection',
|
|
794
|
+
type: 'options',
|
|
795
|
+
options: [
|
|
796
|
+
{ name: 'Any', value: '' },
|
|
797
|
+
{ name: 'Received (in)', value: 'in' },
|
|
798
|
+
{ name: 'Sent (out)', value: 'out' },
|
|
799
|
+
],
|
|
800
|
+
displayOptions: { show: { resource: ['message'], operation: ['getAll'] } },
|
|
801
|
+
default: '',
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
displayName: 'Direction',
|
|
805
|
+
name: 'listDirectionNormalized',
|
|
806
|
+
type: 'hidden',
|
|
807
|
+
displayOptions: { show: { resource: ['message'], operation: ['getAll'] } },
|
|
808
|
+
default: '={{ $parameter.listDirection || undefined }}',
|
|
809
|
+
routing: { send: { type: 'query', property: 'direction' } },
|
|
810
|
+
},
|
|
811
|
+
{
|
|
812
|
+
displayName: 'Status',
|
|
813
|
+
name: 'listStatus',
|
|
814
|
+
type: 'string',
|
|
815
|
+
displayOptions: { show: { resource: ['message'], operation: ['getAll'] } },
|
|
816
|
+
default: '',
|
|
817
|
+
placeholder: 'SENT,DELIVERED',
|
|
818
|
+
description: 'Comma-separated statuses to include: QUEUED, SENT, DELIVERED, READ, FAILED, CANCELED. Leave empty for all.',
|
|
819
|
+
},
|
|
820
|
+
{
|
|
821
|
+
displayName: 'Status',
|
|
822
|
+
name: 'listStatusNormalized',
|
|
823
|
+
type: 'hidden',
|
|
824
|
+
displayOptions: { show: { resource: ['message'], operation: ['getAll'] } },
|
|
825
|
+
default: '={{ $parameter.listStatus || undefined }}',
|
|
826
|
+
routing: { send: { type: 'query', property: 'status' } },
|
|
827
|
+
},
|
|
828
|
+
// Message: Mark as Read / Send Typing Indicator
|
|
829
|
+
{
|
|
830
|
+
displayName: 'To',
|
|
831
|
+
name: 'presenceTo',
|
|
832
|
+
type: 'string',
|
|
833
|
+
description: 'Contact phone in E.164 or bare digits',
|
|
834
|
+
displayOptions: { show: { resource: ['message'], operation: ['markRead', 'typing'] } },
|
|
835
|
+
default: '',
|
|
836
|
+
required: true,
|
|
837
|
+
routing: { send: { type: 'body', property: 'to' } },
|
|
838
|
+
},
|
|
839
|
+
{
|
|
840
|
+
displayName: 'State',
|
|
841
|
+
name: 'typingState',
|
|
842
|
+
type: 'options',
|
|
843
|
+
options: [
|
|
844
|
+
{ name: 'Typing', value: 'typing' },
|
|
845
|
+
{ name: 'Recording', value: 'recording' },
|
|
846
|
+
{ name: 'Paused', value: 'paused' },
|
|
847
|
+
],
|
|
848
|
+
displayOptions: { show: { resource: ['message'], operation: ['typing'] } },
|
|
849
|
+
default: 'typing',
|
|
850
|
+
routing: { send: { type: 'body', property: 'state' } },
|
|
851
|
+
},
|
|
634
852
|
// ----------------------------------
|
|
635
853
|
// Media Operations
|
|
636
854
|
// ----------------------------------
|
|
@@ -682,50 +900,6 @@ class PilotStatus {
|
|
|
682
900
|
},
|
|
683
901
|
},
|
|
684
902
|
// ----------------------------------
|
|
685
|
-
// Project Operations
|
|
686
|
-
// ----------------------------------
|
|
687
|
-
{
|
|
688
|
-
displayName: 'Operation',
|
|
689
|
-
name: 'operation',
|
|
690
|
-
type: 'options',
|
|
691
|
-
noDataExpression: true,
|
|
692
|
-
displayOptions: { show: { resource: ['project'] } },
|
|
693
|
-
options: [
|
|
694
|
-
{
|
|
695
|
-
name: 'Create',
|
|
696
|
-
value: 'create',
|
|
697
|
-
description: 'Create a new project',
|
|
698
|
-
action: 'Create a project',
|
|
699
|
-
routing: { request: { method: 'POST', url: '/projects' } },
|
|
700
|
-
},
|
|
701
|
-
{
|
|
702
|
-
name: 'Get Many',
|
|
703
|
-
value: 'getAll',
|
|
704
|
-
description: 'Get many projects',
|
|
705
|
-
action: 'Get many projects',
|
|
706
|
-
routing: { request: { method: 'GET', url: '/projects' } },
|
|
707
|
-
},
|
|
708
|
-
],
|
|
709
|
-
default: 'getAll',
|
|
710
|
-
},
|
|
711
|
-
{
|
|
712
|
-
displayName: 'Name',
|
|
713
|
-
name: 'name',
|
|
714
|
-
type: 'string',
|
|
715
|
-
displayOptions: { show: { resource: ['project'], operation: ['create'] } },
|
|
716
|
-
default: '',
|
|
717
|
-
required: true,
|
|
718
|
-
routing: { send: { type: 'body', property: 'name' } },
|
|
719
|
-
},
|
|
720
|
-
{
|
|
721
|
-
displayName: 'Description',
|
|
722
|
-
name: 'description',
|
|
723
|
-
type: 'string',
|
|
724
|
-
displayOptions: { show: { resource: ['project'], operation: ['create'] } },
|
|
725
|
-
default: '',
|
|
726
|
-
routing: { send: { type: 'body', property: 'description' } },
|
|
727
|
-
},
|
|
728
|
-
// ----------------------------------
|
|
729
903
|
// API Key Operations
|
|
730
904
|
// ----------------------------------
|
|
731
905
|
{
|
|
@@ -796,10 +970,38 @@ class PilotStatus {
|
|
|
796
970
|
{
|
|
797
971
|
name: 'Delete',
|
|
798
972
|
value: 'delete',
|
|
799
|
-
description: '
|
|
973
|
+
description: 'Soft-delete a WhatsApp number: the device is logged out and the row survives for 30 days. Deleting a number is now REVERSIBLE within that window (see Restore), and restoring requires reconnecting — the response carries restorableUntil. Use Purge for the old, immediate and irreversible behaviour. Does NOT reduce paid capacity: the freed slot stays available to reconnect another number this cycle.',
|
|
800
974
|
action: 'Delete a number',
|
|
801
975
|
routing: { request: { method: 'DELETE', url: '=/numbers/{{$parameter.numberId}}' } },
|
|
802
976
|
},
|
|
977
|
+
{
|
|
978
|
+
name: 'Restore',
|
|
979
|
+
value: 'restore',
|
|
980
|
+
description: 'Undo a soft-delete inside the 30-day window. Gives back the ROW, not the connection — the device was logged out on delete, so run Connect afterwards (the response says requiresReconnect: true).',
|
|
981
|
+
action: 'Restore a number',
|
|
982
|
+
routing: { request: { method: 'POST', url: '=/numbers/{{$parameter.numberId}}/restore' } },
|
|
983
|
+
},
|
|
984
|
+
{
|
|
985
|
+
name: 'Purge',
|
|
986
|
+
value: 'purge',
|
|
987
|
+
description: 'IRREVERSIBLE hard delete — the behaviour Delete had before the soft-delete. Cascades chat, messages, templates and keys, and tears the number down at Meta. Only for a genuine delete-and-recreate flow.',
|
|
988
|
+
action: 'Purge a number',
|
|
989
|
+
routing: { request: { method: 'DELETE', url: '=/numbers/{{$parameter.numberId}}/purge' } },
|
|
990
|
+
},
|
|
991
|
+
{
|
|
992
|
+
name: 'Logout',
|
|
993
|
+
value: 'logout',
|
|
994
|
+
description: 'Unpair the device without deleting anything — id, API keys, webhooks and history are kept, and Connect pairs it again',
|
|
995
|
+
action: 'Logout a number',
|
|
996
|
+
routing: { request: { method: 'POST', url: '=/numbers/{{$parameter.numberId}}/logout' } },
|
|
997
|
+
},
|
|
998
|
+
{
|
|
999
|
+
name: 'Check on WhatsApp',
|
|
1000
|
+
value: 'check',
|
|
1001
|
+
description: 'Check whether a phone number exists on WhatsApp. NON-official (Evolution) numbers only — a Meta Cloud API number answers 400 NOT_SUPPORTED_FOR_META. For Brazilian mobiles the 9th-digit variant is also probed, and the returned `number` is the REGISTERED form to send to, which may differ from what you passed.',
|
|
1002
|
+
action: 'Check a number on whats app',
|
|
1003
|
+
routing: { request: { method: 'POST', url: '/numbers/check' } },
|
|
1004
|
+
},
|
|
803
1005
|
{
|
|
804
1006
|
name: 'Remote Pairing',
|
|
805
1007
|
value: 'remotePairing',
|
|
@@ -858,12 +1060,31 @@ class PilotStatus {
|
|
|
858
1060
|
displayOptions: {
|
|
859
1061
|
show: {
|
|
860
1062
|
resource: ['number'],
|
|
861
|
-
operation: [
|
|
1063
|
+
operation: [
|
|
1064
|
+
'getStatus',
|
|
1065
|
+
'connect',
|
|
1066
|
+
'delete',
|
|
1067
|
+
'restore',
|
|
1068
|
+
'purge',
|
|
1069
|
+
'logout',
|
|
1070
|
+
'get',
|
|
1071
|
+
'updateSettings',
|
|
1072
|
+
],
|
|
862
1073
|
},
|
|
863
1074
|
},
|
|
864
1075
|
default: '',
|
|
865
1076
|
required: true,
|
|
866
1077
|
},
|
|
1078
|
+
{
|
|
1079
|
+
displayName: 'Phone Number',
|
|
1080
|
+
name: 'checkNumber',
|
|
1081
|
+
type: 'string',
|
|
1082
|
+
description: 'Phone to check, in E.164 digits',
|
|
1083
|
+
displayOptions: { show: { resource: ['number'], operation: ['check'] } },
|
|
1084
|
+
default: '',
|
|
1085
|
+
required: true,
|
|
1086
|
+
routing: { send: { type: 'body', property: 'number' } },
|
|
1087
|
+
},
|
|
867
1088
|
// Number: Update Settings
|
|
868
1089
|
//
|
|
869
1090
|
// Os seis campos do Evolution GO são tri-estado (true / false / herdar do
|
|
@@ -883,8 +1104,8 @@ class PilotStatus {
|
|
|
883
1104
|
displayName: 'History Import Enabled',
|
|
884
1105
|
name: 'historyImportEnabled',
|
|
885
1106
|
type: 'boolean',
|
|
886
|
-
default:
|
|
887
|
-
description: 'Whether to import the history the provider dumps on connect (up to 30 days back) into the chat. Applies to every provider.',
|
|
1107
|
+
default: false,
|
|
1108
|
+
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.',
|
|
888
1109
|
},
|
|
889
1110
|
{
|
|
890
1111
|
displayName: 'Webhook Historical Messages',
|
|
@@ -893,6 +1114,13 @@ class PilotStatus {
|
|
|
893
1114
|
default: false,
|
|
894
1115
|
description: 'Whether to DELIVER those historical messages to your webhooks. Off by default: every reconnect replays the history and your integration cannot tell it apart from new traffic. To read history use the Message → Get History operation instead.',
|
|
895
1116
|
},
|
|
1117
|
+
{
|
|
1118
|
+
displayName: 'Ignore Newsletters',
|
|
1119
|
+
name: 'ignoreNewsletters',
|
|
1120
|
+
type: 'boolean',
|
|
1121
|
+
default: false,
|
|
1122
|
+
description: 'Whether to drop WhatsApp Channel (@newsletter) posts on ingestion: no conversation, no stored message and no webhook. Not an Evolution GO field — the provider has no channel gate, so the post always arrives and can only be refused on our side.',
|
|
1123
|
+
},
|
|
896
1124
|
{
|
|
897
1125
|
displayName: 'Always Online',
|
|
898
1126
|
name: 'alwaysOnline',
|
|
@@ -957,7 +1185,7 @@ class PilotStatus {
|
|
|
957
1185
|
displayOptions: { show: { resource: ['number'], operation: ['updateSettings'] } },
|
|
958
1186
|
// `|| undefined` no fim: um `settings: {}` seria rejeitado com 400
|
|
959
1187
|
// EMPTY_PATCH pelo servidor.
|
|
960
|
-
default: '={{ (() => { const c = $parameter.numberSettings || {}; const out = {};
|
|
1188
|
+
default: '={{ (() => { const c = $parameter.numberSettings || {}; const out = {}; for (const k of ["historyImportEnabled","webhookHistoricalMessages","ignoreNewsletters"]) { if (c[k] !== undefined) out[k] = c[k]; } for (const k of ["alwaysOnline","rejectCall","readMessages","ignoreGroups","ignoreStatus"]) { const v = c[k]; if (v === "on") out[k] = true; else if (v === "off") out[k] = false; else if (v === "default") out[k] = null; } if (c.msgRejectCallReset === true) out.msgRejectCall = null; else if (c.msgRejectCall) out.msgRejectCall = c.msgRejectCall; return Object.keys(out).length ? out : undefined; })() }}',
|
|
961
1189
|
routing: { send: { type: 'body', property: 'settings' } },
|
|
962
1190
|
},
|
|
963
1191
|
// ----------------------------------
|
|
@@ -996,6 +1224,339 @@ class PilotStatus {
|
|
|
996
1224
|
required: true,
|
|
997
1225
|
},
|
|
998
1226
|
// ----------------------------------
|
|
1227
|
+
// Flow Operations
|
|
1228
|
+
// ----------------------------------
|
|
1229
|
+
//
|
|
1230
|
+
// WhatsApp Flows. Modelled on the Template resource next door — one
|
|
1231
|
+
// `operation` property whose options carry their own `routing`, plus flat
|
|
1232
|
+
// fields gated by `displayOptions` — with two departures the surface forces:
|
|
1233
|
+
//
|
|
1234
|
+
// ⛔ TWO OPERATIONS HERE ARE DESTRUCTIVE, and an n8n node is the worst place
|
|
1235
|
+
// for that: a workflow runs unattended and re-runs on every item. Publish
|
|
1236
|
+
// cannot be undone on Meta, and registering an endpoint key burns the one
|
|
1237
|
+
// Meta already holds. Both are gated behind a `confirm` boolean whose
|
|
1238
|
+
// default is FALSE, so the API refuses the unconfirmed call instead of
|
|
1239
|
+
// performing it. See the two fields at the bottom of this block.
|
|
1240
|
+
//
|
|
1241
|
+
// ⚠️ The endpoint-key pair lives under Flow and not under Number even though
|
|
1242
|
+
// its URL is `/numbers/{id}/flow-endpoint-key`: the key exists only to make
|
|
1243
|
+
// `data_exchange` Flows work, and whoever needs it is building a Flow.
|
|
1244
|
+
{
|
|
1245
|
+
displayName: 'Operation',
|
|
1246
|
+
name: 'operation',
|
|
1247
|
+
type: 'options',
|
|
1248
|
+
noDataExpression: true,
|
|
1249
|
+
displayOptions: { show: { resource: ['flow'] } },
|
|
1250
|
+
options: [
|
|
1251
|
+
{
|
|
1252
|
+
name: 'Get Many',
|
|
1253
|
+
value: 'getAll',
|
|
1254
|
+
description: 'List the Flows of the WABA behind the key\'s number, most recently updated first. Answers an ENVELOPE — {flows, total, page, pageSize, totalPages} — and not a bare array like Template: Get Many does. Meta (Cloud API) numbers only; a web number answers 422 FLOW_REQUIRES_META_NUMBER.',
|
|
1255
|
+
action: 'Get many flows',
|
|
1256
|
+
routing: { request: { method: 'GET', url: '/flows' } },
|
|
1257
|
+
},
|
|
1258
|
+
{
|
|
1259
|
+
name: 'Create',
|
|
1260
|
+
value: 'create',
|
|
1261
|
+
description: 'Create a Flow in DRAFT, or clone an existing one into a new draft. Answers 201 {id, metaFlowId}. Cloning is the ONLY way to change a published Flow — Meta never lets a published one be edited again — so Clone From Flow ID is what ties the versions of one form together.',
|
|
1262
|
+
action: 'Create a flow',
|
|
1263
|
+
routing: { request: { method: 'POST', url: '/flows' } },
|
|
1264
|
+
},
|
|
1265
|
+
{
|
|
1266
|
+
name: 'Update',
|
|
1267
|
+
value: 'update',
|
|
1268
|
+
description: 'Rename and/or recategorise a Flow that is still in DRAFT. Send Name, Categories, or both — an update carrying neither answers 400 FLOW_PATCH_EMPTY. It cannot publish and it cannot deprecate: those are operations of their own.',
|
|
1269
|
+
action: 'Update a flow',
|
|
1270
|
+
routing: {
|
|
1271
|
+
request: { method: 'PATCH', url: '=/flows/{{$parameter.flowId}}' },
|
|
1272
|
+
},
|
|
1273
|
+
},
|
|
1274
|
+
{
|
|
1275
|
+
name: 'Delete',
|
|
1276
|
+
value: 'delete',
|
|
1277
|
+
description: 'Delete a Flow that is still in DRAFT. A published Flow answers 409 FLOW_NOT_DRAFT — take it out of circulation with Deprecate instead.',
|
|
1278
|
+
action: 'Delete a flow',
|
|
1279
|
+
routing: {
|
|
1280
|
+
request: { method: 'DELETE', url: '=/flows/{{$parameter.flowId}}' },
|
|
1281
|
+
},
|
|
1282
|
+
},
|
|
1283
|
+
{
|
|
1284
|
+
name: 'Upload Flow JSON',
|
|
1285
|
+
value: 'uploadJson',
|
|
1286
|
+
description: 'Upload the Flow JSON of a Flow still in DRAFT. Reversible while the Flow is a draft — just upload another. ⚠️ Meta answers 200 WITH the list of errors when it refuses the JSON; this endpoint answers 422 FLOW_JSON_INVALID with Meta\'s own validationErrors instead, so a refused upload never looks like a saved one.',
|
|
1287
|
+
action: 'Upload flow JSON',
|
|
1288
|
+
routing: {
|
|
1289
|
+
request: { method: 'POST', url: '=/flows/{{$parameter.flowId}}/json' },
|
|
1290
|
+
},
|
|
1291
|
+
},
|
|
1292
|
+
{
|
|
1293
|
+
name: 'Publish',
|
|
1294
|
+
value: 'publish',
|
|
1295
|
+
description: '⛔ IRREVERSIBLE. Publishes the Flow on Meta, and there is NO WAY BACK: a published Flow can never be edited or unpublished, only deprecated and cloned into a new draft. A node in a workflow runs on every item and on every re-run, so Confirm Publish is required and defaults to FALSE — without it the API answers 400 FLOW_PUBLISH_CONFIRMATION_REQUIRED and nothing is published.',
|
|
1296
|
+
action: 'Publish a flow',
|
|
1297
|
+
routing: {
|
|
1298
|
+
request: { method: 'POST', url: '=/flows/{{$parameter.flowId}}/publish' },
|
|
1299
|
+
},
|
|
1300
|
+
},
|
|
1301
|
+
{
|
|
1302
|
+
name: 'Deprecate',
|
|
1303
|
+
value: 'deprecate',
|
|
1304
|
+
description: 'Take a PUBLISHED Flow out of circulation. Not the same as Delete, which only works on a draft and removes the row: this one marks a live Flow as retired. Superseded By Flow ID is optional and records the successor, closing the version chain the clone opened.',
|
|
1305
|
+
action: 'Deprecate a flow',
|
|
1306
|
+
routing: {
|
|
1307
|
+
request: { method: 'POST', url: '=/flows/{{$parameter.flowId}}/deprecate' },
|
|
1308
|
+
},
|
|
1309
|
+
},
|
|
1310
|
+
{
|
|
1311
|
+
name: 'Get Many Responses',
|
|
1312
|
+
value: 'getResponses',
|
|
1313
|
+
description: 'List the forms customers submitted to ONE Flow, newest first. Answers {responses, total, page, pageSize, totalPages}. ⚠️ Responses expire: rows past the retention window are excluded here, so a submission that is gone from the window is gone from this list too. A notice of FLOW_RESPONSES_WINDOW_TRUNCATED on the page means the Flow has more sends than one request correlates — the page is short and says so.',
|
|
1314
|
+
action: 'Get many flow responses',
|
|
1315
|
+
routing: {
|
|
1316
|
+
request: { method: 'GET', url: '=/flows/{{$parameter.flowId}}/responses' },
|
|
1317
|
+
},
|
|
1318
|
+
},
|
|
1319
|
+
{
|
|
1320
|
+
name: 'Get Endpoint Key',
|
|
1321
|
+
value: 'getEndpointKey',
|
|
1322
|
+
description: 'State of the `data_exchange` endpoint keypair of one number: {configured, publicKey, uploadedAt, endpointUrl, metaStatus}. ⚠️ metaStatus has FOUR values and UNKNOWN is NOT NOT_SET: NOT_SET is Meta saying it holds no key, UNKNOWN is us failing to ask. Never register a new key on an UNKNOWN — that is a transient Graph failure, and replacing the key breaks every data_exchange Flow on the number.',
|
|
1323
|
+
action: 'Get the flow endpoint key',
|
|
1324
|
+
routing: {
|
|
1325
|
+
request: {
|
|
1326
|
+
method: 'GET',
|
|
1327
|
+
url: '=/numbers/{{$parameter.flowEndpointKeyNumberId}}/flow-endpoint-key',
|
|
1328
|
+
},
|
|
1329
|
+
},
|
|
1330
|
+
},
|
|
1331
|
+
{
|
|
1332
|
+
name: 'Register Endpoint Key',
|
|
1333
|
+
value: 'registerEndpointKey',
|
|
1334
|
+
description: '⛔ DESTRUCTIVE WHEN A KEY IS ALREADY LIVE, and it wears the face of a creation. Meta holds exactly ONE public key per number: registering a second one does not add it, it REPLACES the first, and every `data_exchange` Flow of that number stops opening the moment Meta accepts — with no error on our side. There is no way back to the old key. Confirm Replace Endpoint Key is therefore required whenever a key of ours is live at Meta, and defaults to FALSE; without it the API answers 400 FLOW_ENDPOINT_KEY_REQUIRES_CONFIRMATION. The reply carries `replaced`, which is the only way to tell "a key now exists where none was" from "the working key is gone".',
|
|
1335
|
+
action: 'Register the flow endpoint key',
|
|
1336
|
+
routing: {
|
|
1337
|
+
request: {
|
|
1338
|
+
method: 'POST',
|
|
1339
|
+
url: '=/numbers/{{$parameter.flowEndpointKeyNumberId}}/flow-endpoint-key',
|
|
1340
|
+
},
|
|
1341
|
+
},
|
|
1342
|
+
},
|
|
1343
|
+
],
|
|
1344
|
+
default: 'getAll',
|
|
1345
|
+
},
|
|
1346
|
+
// ⚠️ ONE field shared by the six operations that address a single Flow. Whoever
|
|
1347
|
+
// adds a seventh must add it to this `displayOptions.show.operation` too:
|
|
1348
|
+
// n8n does not complain about a missing entry, the control simply does not
|
|
1349
|
+
// render and the URL comes out with an empty segment (`/flows//publish`).
|
|
1350
|
+
{
|
|
1351
|
+
displayName: 'Flow ID',
|
|
1352
|
+
name: 'flowId',
|
|
1353
|
+
type: 'string',
|
|
1354
|
+
displayOptions: {
|
|
1355
|
+
show: {
|
|
1356
|
+
resource: ['flow'],
|
|
1357
|
+
operation: [
|
|
1358
|
+
'update',
|
|
1359
|
+
'delete',
|
|
1360
|
+
'uploadJson',
|
|
1361
|
+
'publish',
|
|
1362
|
+
'deprecate',
|
|
1363
|
+
'getResponses',
|
|
1364
|
+
],
|
|
1365
|
+
},
|
|
1366
|
+
},
|
|
1367
|
+
default: '',
|
|
1368
|
+
required: true,
|
|
1369
|
+
description: 'The LOCAL id returned by Get Many (the `id` field), never Meta\'s `metaFlowId`. The two are both opaque strings, so sending the wrong one answers 404 FLOW_NOT_FOUND rather than anything that names the mistake.',
|
|
1370
|
+
},
|
|
1371
|
+
// Pagination — shared by the two operations that page.
|
|
1372
|
+
{
|
|
1373
|
+
displayName: 'Page',
|
|
1374
|
+
name: 'flowPage',
|
|
1375
|
+
type: 'number',
|
|
1376
|
+
typeOptions: { minValue: 1 },
|
|
1377
|
+
displayOptions: {
|
|
1378
|
+
show: { resource: ['flow'], operation: ['getAll', 'getResponses'] },
|
|
1379
|
+
},
|
|
1380
|
+
default: 1,
|
|
1381
|
+
routing: { send: { type: 'query', property: 'page' } },
|
|
1382
|
+
},
|
|
1383
|
+
{
|
|
1384
|
+
displayName: 'Page Size',
|
|
1385
|
+
name: 'flowPageSize',
|
|
1386
|
+
type: 'number',
|
|
1387
|
+
typeOptions: { minValue: 1, maxValue: 100 },
|
|
1388
|
+
displayOptions: {
|
|
1389
|
+
show: { resource: ['flow'], operation: ['getAll', 'getResponses'] },
|
|
1390
|
+
},
|
|
1391
|
+
default: 30,
|
|
1392
|
+
description: 'Items per page (max 100)',
|
|
1393
|
+
routing: { send: { type: 'query', property: 'pageSize' } },
|
|
1394
|
+
},
|
|
1395
|
+
// Flow: Create
|
|
1396
|
+
{
|
|
1397
|
+
displayName: 'Name',
|
|
1398
|
+
name: 'flowName',
|
|
1399
|
+
type: 'string',
|
|
1400
|
+
displayOptions: { show: { resource: ['flow'], operation: ['create'] } },
|
|
1401
|
+
default: '',
|
|
1402
|
+
required: true,
|
|
1403
|
+
routing: { send: { type: 'body', property: 'name' } },
|
|
1404
|
+
},
|
|
1405
|
+
{
|
|
1406
|
+
displayName: 'Categories',
|
|
1407
|
+
name: 'flowCategories',
|
|
1408
|
+
type: 'multiOptions',
|
|
1409
|
+
// Meta's closed list. Kept as a dropdown and not a free string because an
|
|
1410
|
+
// invalid value only fails AFTER the trip to the Graph, and Meta's message
|
|
1411
|
+
// does not say which category was refused.
|
|
1412
|
+
options: exports.FLOW_CATEGORY_OPTIONS,
|
|
1413
|
+
displayOptions: { show: { resource: ['flow'], operation: ['create'] } },
|
|
1414
|
+
default: [],
|
|
1415
|
+
required: true,
|
|
1416
|
+
description: 'At least one category. An empty list answers 400 FLOW_CATEGORY_INVALID.',
|
|
1417
|
+
routing: { send: { type: 'body', property: 'categories' } },
|
|
1418
|
+
},
|
|
1419
|
+
{
|
|
1420
|
+
displayName: 'Clone From Flow ID',
|
|
1421
|
+
name: 'flowCloneFromFlowId',
|
|
1422
|
+
type: 'string',
|
|
1423
|
+
displayOptions: { show: { resource: ['flow'], operation: ['create'] } },
|
|
1424
|
+
default: '',
|
|
1425
|
+
description: 'Optional. The LOCAL id of the Flow to clone — not its `metaFlowId`. Leave empty to create an empty draft. Cloning is the only route back from a publish, since Meta never reopens a published Flow for editing.',
|
|
1426
|
+
},
|
|
1427
|
+
{
|
|
1428
|
+
displayName: 'Clone From Flow ID',
|
|
1429
|
+
name: 'flowCloneFromFlowIdNormalized',
|
|
1430
|
+
type: 'hidden',
|
|
1431
|
+
displayOptions: { show: { resource: ['flow'], operation: ['create'] } },
|
|
1432
|
+
// `|| undefined` so an untouched field is OMITTED. `POST /v1/flows` reads
|
|
1433
|
+
// `cloneFromFlowId` when the key is present, and `""` is present: it would
|
|
1434
|
+
// be refused as a malformed id instead of meaning "no clone".
|
|
1435
|
+
default: '={{ $parameter.flowCloneFromFlowId || undefined }}',
|
|
1436
|
+
routing: { send: { type: 'body', property: 'cloneFromFlowId' } },
|
|
1437
|
+
},
|
|
1438
|
+
// Flow: Update
|
|
1439
|
+
//
|
|
1440
|
+
// ⚠️ Both fields are OPTIONAL here and both are normalized away when empty,
|
|
1441
|
+
// unlike their Create twins. PATCH accepts `name` and/or `categories` and
|
|
1442
|
+
// REFUSES any other key, so an empty control must send nothing at all: a
|
|
1443
|
+
// `name: ""` would be refused as an invalid name, and a `categories: []` as an
|
|
1444
|
+
// invalid category list — two 400s for a field the author simply left alone.
|
|
1445
|
+
{
|
|
1446
|
+
displayName: 'Name',
|
|
1447
|
+
name: 'flowUpdateName',
|
|
1448
|
+
type: 'string',
|
|
1449
|
+
displayOptions: { show: { resource: ['flow'], operation: ['update'] } },
|
|
1450
|
+
default: '',
|
|
1451
|
+
description: 'Leave empty to keep the current name',
|
|
1452
|
+
},
|
|
1453
|
+
{
|
|
1454
|
+
displayName: 'Name',
|
|
1455
|
+
name: 'flowUpdateNameNormalized',
|
|
1456
|
+
type: 'hidden',
|
|
1457
|
+
displayOptions: { show: { resource: ['flow'], operation: ['update'] } },
|
|
1458
|
+
default: '={{ $parameter.flowUpdateName || undefined }}',
|
|
1459
|
+
routing: { send: { type: 'body', property: 'name' } },
|
|
1460
|
+
},
|
|
1461
|
+
{
|
|
1462
|
+
displayName: 'Categories',
|
|
1463
|
+
name: 'flowUpdateCategories',
|
|
1464
|
+
type: 'multiOptions',
|
|
1465
|
+
options: exports.FLOW_CATEGORY_OPTIONS,
|
|
1466
|
+
displayOptions: { show: { resource: ['flow'], operation: ['update'] } },
|
|
1467
|
+
default: [],
|
|
1468
|
+
description: 'Leave empty to keep the current categories',
|
|
1469
|
+
},
|
|
1470
|
+
{
|
|
1471
|
+
displayName: 'Categories',
|
|
1472
|
+
name: 'flowUpdateCategoriesNormalized',
|
|
1473
|
+
type: 'hidden',
|
|
1474
|
+
displayOptions: { show: { resource: ['flow'], operation: ['update'] } },
|
|
1475
|
+
default: '={{ ($parameter.flowUpdateCategories || []).length ? $parameter.flowUpdateCategories : undefined }}',
|
|
1476
|
+
routing: { send: { type: 'body', property: 'categories' } },
|
|
1477
|
+
},
|
|
1478
|
+
// Flow: Upload Flow JSON
|
|
1479
|
+
{
|
|
1480
|
+
displayName: 'Flow JSON',
|
|
1481
|
+
name: 'flowJson',
|
|
1482
|
+
type: 'string',
|
|
1483
|
+
typeOptions: { rows: 8 },
|
|
1484
|
+
displayOptions: { show: { resource: ['flow'], operation: ['uploadJson'] } },
|
|
1485
|
+
default: '',
|
|
1486
|
+
required: true,
|
|
1487
|
+
description: 'The complete Flow JSON as a STRING, not as an object. Meta validates the TEXT, so re-serialising an object would move the error positions away from the file the author is fixing.',
|
|
1488
|
+
routing: { send: { type: 'body', property: 'flowJson' } },
|
|
1489
|
+
},
|
|
1490
|
+
// Flow: Publish
|
|
1491
|
+
//
|
|
1492
|
+
// ⛔ `default: false`, AND THAT IS THE WHOLE GUARD. A true default would make
|
|
1493
|
+
// every run of the workflow publish, and publishing has no undo on Meta — the
|
|
1494
|
+
// damage is permanent and the request that caused it is indistinguishable from
|
|
1495
|
+
// any other in the log. With `false` the API answers 400 and publishes nothing,
|
|
1496
|
+
// which is the only failure mode of this operation that can be retried.
|
|
1497
|
+
{
|
|
1498
|
+
displayName: 'Confirm Publish',
|
|
1499
|
+
name: 'flowPublishConfirm',
|
|
1500
|
+
type: 'boolean',
|
|
1501
|
+
displayOptions: { show: { resource: ['flow'], operation: ['publish'] } },
|
|
1502
|
+
default: false,
|
|
1503
|
+
description: 'Whether to actually publish. ⛔ IRREVERSIBLE: once published, the Flow can never be edited or unpublished on Meta — only deprecated and cloned into a new draft. Leave OFF and the API refuses with 400 FLOW_PUBLISH_CONFIRMATION_REQUIRED, having published nothing. Turn it ON only if this node is meant to publish on EVERY item and EVERY re-run.',
|
|
1504
|
+
routing: { send: { type: 'body', property: 'confirm' } },
|
|
1505
|
+
},
|
|
1506
|
+
// Flow: Deprecate
|
|
1507
|
+
{
|
|
1508
|
+
displayName: 'Superseded By Flow ID',
|
|
1509
|
+
name: 'flowSupersededByFlowId',
|
|
1510
|
+
type: 'string',
|
|
1511
|
+
displayOptions: { show: { resource: ['flow'], operation: ['deprecate'] } },
|
|
1512
|
+
default: '',
|
|
1513
|
+
description: 'Optional. The LOCAL id of the Flow that replaces this one — not its `metaFlowId`, which resolves to no row of ours and would silently end the version chain. Leave empty when nothing replaces it.',
|
|
1514
|
+
},
|
|
1515
|
+
{
|
|
1516
|
+
displayName: 'Superseded By Flow ID',
|
|
1517
|
+
name: 'flowSupersededByFlowIdNormalized',
|
|
1518
|
+
type: 'hidden',
|
|
1519
|
+
displayOptions: { show: { resource: ['flow'], operation: ['deprecate'] } },
|
|
1520
|
+
// `|| undefined` so an untouched field is OMITTED rather than sent as `""`:
|
|
1521
|
+
// the route refuses a present-but-blank successor, and absent is the only
|
|
1522
|
+
// spelling of "no successor".
|
|
1523
|
+
default: '={{ $parameter.flowSupersededByFlowId || undefined }}',
|
|
1524
|
+
routing: { send: { type: 'body', property: 'supersededByFlowId' } },
|
|
1525
|
+
},
|
|
1526
|
+
// Flow: endpoint key (both operations)
|
|
1527
|
+
{
|
|
1528
|
+
displayName: 'Number ID',
|
|
1529
|
+
name: 'flowEndpointKeyNumberId',
|
|
1530
|
+
type: 'string',
|
|
1531
|
+
displayOptions: {
|
|
1532
|
+
show: {
|
|
1533
|
+
resource: ['flow'],
|
|
1534
|
+
operation: ['getEndpointKey', 'registerEndpointKey'],
|
|
1535
|
+
},
|
|
1536
|
+
},
|
|
1537
|
+
default: '',
|
|
1538
|
+
required: true,
|
|
1539
|
+
description: 'The WhatsApp number this key belongs to. It must be the number the credential is bound to — the route CHECKS the id against the key instead of looking it up, so another number of the same tenant answers 404 FLOW_NUMBER_NOT_FOUND.',
|
|
1540
|
+
},
|
|
1541
|
+
// ⛔ `default: false`, for the same reason as Confirm Publish and with a
|
|
1542
|
+
// failure that is quieter: Meta holds ONE key per number, so a second
|
|
1543
|
+
// registration REPLACES the live one and every `data_exchange` Flow of that
|
|
1544
|
+
// number stops opening — while our side reports success. The flag is only
|
|
1545
|
+
// demanded when a key is already live, so the first registration on a number
|
|
1546
|
+
// works with it OFF; it is what stops the second, third and thousandth run of
|
|
1547
|
+
// the same node from burning the key the first one created.
|
|
1548
|
+
{
|
|
1549
|
+
displayName: 'Confirm Replace Endpoint Key',
|
|
1550
|
+
name: 'flowEndpointKeyConfirm',
|
|
1551
|
+
type: 'boolean',
|
|
1552
|
+
displayOptions: {
|
|
1553
|
+
show: { resource: ['flow'], operation: ['registerEndpointKey'] },
|
|
1554
|
+
},
|
|
1555
|
+
default: false,
|
|
1556
|
+
description: 'Whether to replace a key that is ALREADY registered with Meta. ⛔ There is no way back to the previous key, and the moment Meta accepts the new one every `data_exchange` Flow of this number stops opening for customers until the endpoint serves the new pair. Leave OFF: the first registration on a number does not need it, and with a live key the API answers 400 FLOW_ENDPOINT_KEY_REQUIRES_CONFIRMATION and replaces nothing.',
|
|
1557
|
+
routing: { send: { type: 'body', property: 'confirm' } },
|
|
1558
|
+
},
|
|
1559
|
+
// ----------------------------------
|
|
999
1560
|
// Group Operations
|
|
1000
1561
|
// ----------------------------------
|
|
1001
1562
|
{
|
|
@@ -1065,6 +1626,36 @@ class PilotStatus {
|
|
|
1065
1626
|
routing: { send: { type: 'query', property: 'tz' } },
|
|
1066
1627
|
},
|
|
1067
1628
|
// ----------------------------------
|
|
1629
|
+
// Service Window Operations (Meta's 24h customer-service window)
|
|
1630
|
+
// ----------------------------------
|
|
1631
|
+
{
|
|
1632
|
+
displayName: 'Operation',
|
|
1633
|
+
name: 'operation',
|
|
1634
|
+
type: 'options',
|
|
1635
|
+
noDataExpression: true,
|
|
1636
|
+
displayOptions: { show: { resource: ['serviceWindow'] } },
|
|
1637
|
+
options: [
|
|
1638
|
+
{
|
|
1639
|
+
name: 'Get',
|
|
1640
|
+
value: 'get',
|
|
1641
|
+
description: 'Check whether the 24h customer-service window is open for a contact. ⚠️ Branch on windowType, not on `open`: on a META number windowType is META_24H and `open` is a real constraint (outside the window only an approved template goes through); on a web/unofficial number windowType is NONE and `open` is ALWAYS true, because the Meta rule does not exist there.',
|
|
1642
|
+
action: 'Get service window state',
|
|
1643
|
+
routing: { request: { method: 'GET', url: '/service-window' } },
|
|
1644
|
+
},
|
|
1645
|
+
],
|
|
1646
|
+
default: 'get',
|
|
1647
|
+
},
|
|
1648
|
+
{
|
|
1649
|
+
displayName: 'Destination Number',
|
|
1650
|
+
name: 'serviceWindowDestination',
|
|
1651
|
+
type: 'string',
|
|
1652
|
+
description: 'Contact phone in E.164 (e.g. +5511999999999)',
|
|
1653
|
+
displayOptions: { show: { resource: ['serviceWindow'], operation: ['get'] } },
|
|
1654
|
+
default: '',
|
|
1655
|
+
required: true,
|
|
1656
|
+
routing: { send: { type: 'query', property: 'destinationNumber' } },
|
|
1657
|
+
},
|
|
1658
|
+
// ----------------------------------
|
|
1068
1659
|
// Remote Pairing Operations
|
|
1069
1660
|
// ----------------------------------
|
|
1070
1661
|
{
|
|
@@ -1125,6 +1716,40 @@ class PilotStatus {
|
|
|
1125
1716
|
action: 'Initiate a call',
|
|
1126
1717
|
routing: { request: { method: 'POST', url: '/calls' } },
|
|
1127
1718
|
},
|
|
1719
|
+
{
|
|
1720
|
+
name: 'Accept',
|
|
1721
|
+
value: 'accept',
|
|
1722
|
+
description: 'Answer an inbound (user-initiated) call, after the call.ringing webhook. Meta numbers: pass the business-side SDP answer, built from the sdpOffer that Get returns with Include SDP. Web (Pilot Status) numbers: leave SDP empty — their media is handled server-side.',
|
|
1723
|
+
action: 'Accept a call',
|
|
1724
|
+
routing: {
|
|
1725
|
+
request: { method: 'POST', url: '=/calls/{{$parameter.callId}}/accept' },
|
|
1726
|
+
},
|
|
1727
|
+
},
|
|
1728
|
+
{
|
|
1729
|
+
name: 'Reject',
|
|
1730
|
+
value: 'reject',
|
|
1731
|
+
description: 'Decline an incoming call',
|
|
1732
|
+
action: 'Reject a call',
|
|
1733
|
+
routing: {
|
|
1734
|
+
request: { method: 'POST', url: '=/calls/{{$parameter.callId}}/reject' },
|
|
1735
|
+
},
|
|
1736
|
+
},
|
|
1737
|
+
{
|
|
1738
|
+
name: 'Get',
|
|
1739
|
+
value: 'get',
|
|
1740
|
+
description: 'Fetch one call. Turn on Include SDP to also get sdpOffer/sdpAnswer, which is what you need to answer a user-initiated call on a Meta number (they are always null on web numbers).',
|
|
1741
|
+
action: 'Get a call',
|
|
1742
|
+
routing: {
|
|
1743
|
+
request: { method: 'GET', url: '=/calls/{{$parameter.callId}}' },
|
|
1744
|
+
},
|
|
1745
|
+
},
|
|
1746
|
+
{
|
|
1747
|
+
name: 'Get Many',
|
|
1748
|
+
value: 'getAll',
|
|
1749
|
+
description: "List the number's calls, newest first",
|
|
1750
|
+
action: 'Get many calls',
|
|
1751
|
+
routing: { request: { method: 'GET', url: '/calls' } },
|
|
1752
|
+
},
|
|
1128
1753
|
{
|
|
1129
1754
|
name: 'Terminate',
|
|
1130
1755
|
value: 'terminate',
|
|
@@ -1227,18 +1852,87 @@ class PilotStatus {
|
|
|
1227
1852
|
default: '={{ $parameter.callBizOpaqueCallbackData || undefined }}',
|
|
1228
1853
|
routing: { send: { type: 'body', property: 'bizOpaqueCallbackData' } },
|
|
1229
1854
|
},
|
|
1230
|
-
// Call:
|
|
1855
|
+
// Call: operations that address ONE call.
|
|
1856
|
+
//
|
|
1857
|
+
// ⚠️ Shared field: a new per-call operation that is not added to this
|
|
1858
|
+
// `displayOptions.show.operation` leaves the field invisible and the URL comes
|
|
1859
|
+
// out as `/calls//...` — with no validation error at all.
|
|
1231
1860
|
{
|
|
1232
1861
|
displayName: 'Call ID',
|
|
1233
1862
|
name: 'callId',
|
|
1234
1863
|
type: 'string',
|
|
1235
1864
|
description: 'The Pilot Status call id (call_...) OR the provider call id (Meta wacid / Evolution GO CallID)',
|
|
1236
1865
|
displayOptions: {
|
|
1237
|
-
show: {
|
|
1866
|
+
show: {
|
|
1867
|
+
resource: ['call'],
|
|
1868
|
+
operation: ['accept', 'reject', 'get', 'terminate', 'play', 'realtimeSession'],
|
|
1869
|
+
},
|
|
1238
1870
|
},
|
|
1239
1871
|
default: '',
|
|
1240
1872
|
required: true,
|
|
1241
1873
|
},
|
|
1874
|
+
// Call: Accept
|
|
1875
|
+
{
|
|
1876
|
+
displayName: 'SDP Answer',
|
|
1877
|
+
name: 'callAcceptSdp',
|
|
1878
|
+
type: 'string',
|
|
1879
|
+
typeOptions: { rows: 4 },
|
|
1880
|
+
description: 'Business-side SDP answer — REQUIRED on Meta Cloud API numbers, LEAVE EMPTY on web (Pilot Status) numbers',
|
|
1881
|
+
displayOptions: { show: { resource: ['call'], operation: ['accept'] } },
|
|
1882
|
+
default: '',
|
|
1883
|
+
},
|
|
1884
|
+
{
|
|
1885
|
+
displayName: 'SDP Answer',
|
|
1886
|
+
name: 'callAcceptSdpNormalized',
|
|
1887
|
+
type: 'hidden',
|
|
1888
|
+
displayOptions: { show: { resource: ['call'], operation: ['accept'] } },
|
|
1889
|
+
default: '={{ $parameter.callAcceptSdp || undefined }}',
|
|
1890
|
+
routing: { send: { type: 'body', property: 'sdp' } },
|
|
1891
|
+
},
|
|
1892
|
+
// Call: Get
|
|
1893
|
+
{
|
|
1894
|
+
displayName: 'Include SDP',
|
|
1895
|
+
name: 'callIncludeSdp',
|
|
1896
|
+
type: 'boolean',
|
|
1897
|
+
description: 'Whether to also return sdpOffer/sdpAnswer (needed to answer a user-initiated Meta call)',
|
|
1898
|
+
displayOptions: { show: { resource: ['call'], operation: ['get'] } },
|
|
1899
|
+
default: false,
|
|
1900
|
+
},
|
|
1901
|
+
{
|
|
1902
|
+
displayName: 'Include SDP',
|
|
1903
|
+
name: 'callIncludeSdpNormalized',
|
|
1904
|
+
type: 'hidden',
|
|
1905
|
+
displayOptions: { show: { resource: ['call'], operation: ['get'] } },
|
|
1906
|
+
default: '={{ $parameter.callIncludeSdp ? "1" : undefined }}',
|
|
1907
|
+
routing: { send: { type: 'query', property: 'includeSdp' } },
|
|
1908
|
+
},
|
|
1909
|
+
// Call: Get Many
|
|
1910
|
+
{
|
|
1911
|
+
displayName: 'Limit',
|
|
1912
|
+
name: 'callListLimit',
|
|
1913
|
+
type: 'number',
|
|
1914
|
+
typeOptions: { minValue: 1, maxValue: 100 },
|
|
1915
|
+
displayOptions: { show: { resource: ['call'], operation: ['getAll'] } },
|
|
1916
|
+
default: 25,
|
|
1917
|
+
description: 'Max number of calls to return (1-100)',
|
|
1918
|
+
routing: { send: { type: 'query', property: 'limit' } },
|
|
1919
|
+
},
|
|
1920
|
+
{
|
|
1921
|
+
displayName: 'Before',
|
|
1922
|
+
name: 'callListBefore',
|
|
1923
|
+
type: 'dateTime',
|
|
1924
|
+
displayOptions: { show: { resource: ['call'], operation: ['getAll'] } },
|
|
1925
|
+
default: '',
|
|
1926
|
+
description: 'Cursor: only calls older than this instant',
|
|
1927
|
+
},
|
|
1928
|
+
{
|
|
1929
|
+
displayName: 'Before',
|
|
1930
|
+
name: 'callListBeforeNormalized',
|
|
1931
|
+
type: 'hidden',
|
|
1932
|
+
displayOptions: { show: { resource: ['call'], operation: ['getAll'] } },
|
|
1933
|
+
default: '={{ $parameter.callListBefore ? new Date($parameter.callListBefore).toISOString() : undefined }}',
|
|
1934
|
+
routing: { send: { type: 'query', property: 'before' } },
|
|
1935
|
+
},
|
|
1242
1936
|
// Call: Play
|
|
1243
1937
|
{
|
|
1244
1938
|
displayName: 'Media URL',
|