n8n-nodes-pilot-status 2.8.0 → 2.10.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,54 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `n8n-nodes-pilot-status`.
|
|
4
4
|
|
|
5
|
+
## 2.10.0 - 2026-10-27
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- **Message → Send: Media Filename** additional field, sent as `mediaFilename` — the file
|
|
10
|
+
name the recipient sees for a document (1–240 chars; `/` and `\` become `_`). Works on
|
|
11
|
+
a direct document send and on a template whose approved header is a Document, with or
|
|
12
|
+
without a Media URL; any other header type is rejected with
|
|
13
|
+
`MEDIA_FILENAME_REQUIRES_DOCUMENT_HEADER`. With a Media URL and no Media Type, setting
|
|
14
|
+
it sends the media as a document instead of the `image` default.
|
|
15
|
+
- **Phone Line Webhook** resource — the `phone_line.*` event subscriptions, a registry
|
|
16
|
+
separate from the number webhooks of `/v1/webhooks`. Workspace (tenant-scoped) key only,
|
|
17
|
+
`phone_lines:webhooks` (ADMIN and up).
|
|
18
|
+
- **Create** — `POST /v1/phone-lines/webhooks` (URL, Events, optional Name). The answer
|
|
19
|
+
carries the `plwh_...` signing **secret, shown only this once**. Not idempotent. An
|
|
20
|
+
empty Name is omitted from the body.
|
|
21
|
+
- **Get Many** — `GET /v1/phone-lines/webhooks` → `{ webhooks, events }` as one item.
|
|
22
|
+
- **Get** — `GET /v1/phone-lines/webhooks/{id}`.
|
|
23
|
+
- **Update** — `PATCH /v1/phone-lines/webhooks/{id}`: only the fields added under Update
|
|
24
|
+
Fields (Name, URL, Events, Active) are sent; Active off pauses the webhook.
|
|
25
|
+
- **Delete** — `DELETE /v1/phone-lines/webhooks/{id}`, also deletes the delivery history.
|
|
26
|
+
- **Get Deliveries** — `GET /v1/phone-lines/webhooks/{id}/deliveries?limit=` (1–200,
|
|
27
|
+
default 50), never the payload.
|
|
28
|
+
- **Get Delivery** — `GET /v1/phone-lines/webhooks/{id}/deliveries/{deliveryId}`, with
|
|
29
|
+
the exact signed `payload` string; a `phone_line.code_received` payload carries the
|
|
30
|
+
activation code.
|
|
31
|
+
- Ids are URL-encoded in the path.
|
|
32
|
+
|
|
33
|
+
### Not included
|
|
34
|
+
|
|
35
|
+
- The Pilot Status Trigger still does not offer `phone_line.*` events: its Automatic mode
|
|
36
|
+
registers in the numbers registry, which never delivers them. Point a phone-line webhook
|
|
37
|
+
created here at a regular Webhook node instead.
|
|
38
|
+
|
|
39
|
+
## 2.9.0 - 2026-10-25
|
|
40
|
+
|
|
41
|
+
### Added
|
|
42
|
+
|
|
43
|
+
- **Message → Send → Additional Fields → Idempotency Key** (string, optional). Sent as the
|
|
44
|
+
`Idempotency-Key` header, never in the body; blank or left out, the request is unchanged.
|
|
45
|
+
Within 24 hours (per workspace + number + key) the same key with the same body returns the
|
|
46
|
+
stored response of the first accepted (2xx) call and sends nothing again
|
|
47
|
+
(`Idempotent-Replayed: true`); same key + different body → `409 IDEMPOTENCY_KEY_REUSED`;
|
|
48
|
+
first call still running → `409 IDEMPOTENCY_KEY_IN_USE`; invalid key (>255 chars or
|
|
49
|
+
control characters) → `400 IDEMPOTENCY_KEY_INVALID`. Only 2xx responses are remembered,
|
|
50
|
+
so after an error the same key can be retried with corrected input. Map it from your own
|
|
51
|
+
data (e.g. an order id) so that n8n's Retry On Fail reuses it.
|
|
52
|
+
|
|
5
53
|
## 2.8.0 - 2026-10-20
|
|
6
54
|
|
|
7
55
|
### Added
|
package/README.md
CHANGED
|
@@ -90,7 +90,7 @@ Webhook payload notes:
|
|
|
90
90
|
The **Pilot Status** node provides several resources and operations to manage your account and send messages.
|
|
91
91
|
|
|
92
92
|
### 1. Message
|
|
93
|
-
- **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). Add **Mark Read** (switched off) under Additional Fields to reply without marking the conversation read — e.g. an AI agent answering while a human should still see it unread; leave it out to follow the number's **Mark Read On Send** setting. Meta Cloud API numbers only (no "typing" indicator either); on Evolution numbers turn off **Read Messages** instead. Note that **Send Typing Indicator** on a Meta number also marks read.
|
|
93
|
+
- **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). Add **Mark Read** (switched off) under Additional Fields to reply without marking the conversation read — e.g. an AI agent answering while a human should still see it unread; leave it out to follow the number's **Mark Read On Send** setting. Meta Cloud API numbers only (no "typing" indicator either); on Evolution numbers turn off **Read Messages** instead. Note that **Send Typing Indicator** on a Meta number also marks read. Add **Idempotency Key** under Additional Fields to make retries safe: it is sent as the `Idempotency-Key` header (never in the body), and within 24 hours the same key with the same body returns the first accepted response instead of sending again (`Idempotent-Replayed: true`). Map it from your own data (e.g. an order id) so a retry reuses it. Same key + different body → `409 IDEMPOTENCY_KEY_REUSED`; first call still running → `409 IDEMPOTENCY_KEY_IN_USE`; invalid key → `400 IDEMPOTENCY_KEY_INVALID`. Only 2xx responses are remembered, so after an error you can fix the input and retry with the same key.
|
|
94
94
|
- **Get Status:** Retrieve the current status of a specific message using either its Pilot Status message id or WhatsApp provider id.
|
|
95
95
|
- **Get History:** Read the conversation history of the number, newest first — both directions, every provider, including messages imported from the device on connect. Filters by **Start Date** / **End Date** over the *provider* timestamp (when the message happened, not when it was ingested). This is how you fetch old messages: the webhook does not replay history by default. Requires a number-scoped API key.
|
|
96
96
|
- **Get Many:** 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. Filters: Direction, Status (comma-separated), Page, Page Size. For date/search/template filters use the HTTP Request node.
|
|
@@ -199,7 +199,21 @@ Requires a **workspace (tenant-scoped) API key** — a number-scoped key is refu
|
|
|
199
199
|
- **Binary Field** (default): the name of a binary property of the input item (e.g. the output of *Read/Write Files from Disk*, *HTTP Request* or a form upload). It is sent as `data:<mimeType>;base64,<data>`.
|
|
200
200
|
- **Data URI**: a ready `data:<mime>;base64,...` string.
|
|
201
201
|
|
|
202
|
-
> Phone-line webhooks (`phone_line.*`) live in a **separate registry** with their own `plwh_...` secret, and the **Pilot Status Trigger does not register them**: its Automatic mode creates subscriptions in the numbers webhook registry, which never delivers `phone_line.*`. To receive them, create the phone-line webhook in the dashboard and point it at a regular n8n *Webhook* node (verify `x-pilot-status-signature`, HMAC-SHA256 of the raw body).
|
|
202
|
+
> Phone-line webhooks (`phone_line.*`) live in a **separate registry** with their own `plwh_...` secret, and the **Pilot Status Trigger does not register them**: its Automatic mode creates subscriptions in the numbers webhook registry, which never delivers `phone_line.*`. To receive them, create the phone-line webhook (in the dashboard or with **Phone Line Webhook → Create** below) and point it at a regular n8n *Webhook* node (verify `x-pilot-status-signature`, HMAC-SHA256 of the raw body).
|
|
203
|
+
|
|
204
|
+
### 13. Phone Line Webhook (`phone_line.*` event subscriptions)
|
|
205
|
+
|
|
206
|
+
A registry **separate** from the number webhooks of `/v1/webhooks`: a phone-line webhook receives only `phone_line.*` events, and never a number event. Requires a **workspace (tenant-scoped) API key** with `phone_lines:webhooks` (**ADMIN** and up). Errors come back as `{ error, code }`; another workspace's webhook (or an unknown id) is `404 WEBHOOK_NOT_FOUND`.
|
|
207
|
+
|
|
208
|
+
Events: `phone_line.purchased`, `phone_line.audio_received`, `phone_line.code_received`, `phone_line.code_failed`, `phone_line.renewed`, `phone_line.payment_failed`, `phone_line.suspended`, `phone_line.returned`, `phone_line.canceled`, `phone_line.verification_updated`, or `*` (**All Phone Line Events**, including future ones).
|
|
209
|
+
|
|
210
|
+
- **Create:** `POST /v1/phone-lines/webhooks` with **URL** (https, public — an internal or private destination is `400 WEBHOOK_URL_REFUSED`), **Events** (at least one) and an optional **Name** (max 100 characters; left empty, the URL's hostname). Answers `201 { webhook: { id, name, url, events, active, secret, createdAt } }`. ⛔ The `plwh_...` **secret is shown only in this response, never again** — store it right away; it signs every delivery. **Not idempotent**: running it twice creates two webhooks with two secrets. An empty Name is left out of the body, never sent as `""` or `null`.
|
|
211
|
+
- **Get Many:** `GET /v1/phone-lines/webhooks` → `{ webhooks, events }` as **one item** (like every other Get Many of this node): `webhooks` oldest first, each `{ id, name, url, events, active, lastDeliveryAt, lastStatusCode, createdAt }`; `events` is the subscribable catalogue. Never the secrets.
|
|
212
|
+
- **Get:** `GET /v1/phone-lines/webhooks/{id}` → `{ webhook }` (same shape, no secret).
|
|
213
|
+
- **Update:** `PATCH /v1/phone-lines/webhooks/{id}` with only the fields added under **Update Fields** — **Name**, **URL**, **Events** (replaces the list) and **Active** (off **pauses** the webhook without deleting it). Fields not added stay unchanged; a blank Name/URL or an empty Events selection is ignored rather than sent. Answers `{ webhook }`; the secret does not change.
|
|
214
|
+
- **Delete:** `DELETE /v1/phone-lines/webhooks/{id}` → `{ ok: true }`. ⚠️ Also deletes the webhook's **delivery history**. No undo.
|
|
215
|
+
- **Get Deliveries:** `GET /v1/phone-lines/webhooks/{id}/deliveries?limit=` (**Limit** 1–200, default 50) → `{ deliveries }`, newest first, each `{ id, event, status (PENDING|DELIVERED|FAILED), attempts, responseStatus, lastError, createdAt, deliveredAt }`. Never the payload.
|
|
216
|
+
- **Get Delivery:** `GET /v1/phone-lines/webhooks/{id}/deliveries/{deliveryId}` → `{ delivery }` with `durationMs`, `responseBody` and `payload` — the **exact signed JSON string** that was sent (parse it yourself; it is a string so the signature can be re-checked byte for byte). ⛔ A `phone_line.code_received` payload carries the **activation code** — treat this output as a credential.
|
|
203
217
|
|
|
204
218
|
---
|
|
205
219
|
|
|
@@ -44,6 +44,28 @@ export declare function resolvePhoneLineDocument(ctx: IExecuteSingleFunctions):
|
|
|
44
44
|
export declare function phoneLineStartVerificationPreSend(this: IExecuteSingleFunctions, requestOptions: IHttpRequestOptions): Promise<IHttpRequestOptions>;
|
|
45
45
|
/** Submit Document: the body is exactly `{ document }`. No Idempotency-Key on this route. */
|
|
46
46
|
export declare function phoneLineSubmitDocumentPreSend(this: IExecuteSingleFunctions, requestOptions: IHttpRequestOptions): Promise<IHttpRequestOptions>;
|
|
47
|
+
/**
|
|
48
|
+
* The events a phone-line webhook subscribes to (`/v1/phone-lines/webhooks`). A registry of
|
|
49
|
+
* its own: these never reach the number webhooks of `/v1/webhooks`, and the number events
|
|
50
|
+
* never reach these. `*` subscribes to every phone-line event, present and future.
|
|
51
|
+
*/
|
|
52
|
+
export declare const PHONE_LINE_WEBHOOK_EVENT_OPTIONS: INodePropertyOptions[];
|
|
53
|
+
/**
|
|
54
|
+
* Phone Line Webhook → Create: builds the WHOLE `POST /v1/phone-lines/webhooks` body.
|
|
55
|
+
*
|
|
56
|
+
* The API is strict: an unknown field is 400 UNKNOWN_FIELDS and a `null` or wrong-typed
|
|
57
|
+
* one is 400 INVALID_FIELD_TYPE. So the body carries exactly `url`, `events` and — only when
|
|
58
|
+
* it is not blank — `name` (a missing name becomes the URL's hostname on the server).
|
|
59
|
+
*/
|
|
60
|
+
export declare function phoneLineWebhookCreatePreSend(this: IExecuteSingleFunctions, requestOptions: IHttpRequestOptions): Promise<IHttpRequestOptions>;
|
|
61
|
+
/**
|
|
62
|
+
* Phone Line Webhook → Update: builds the `PATCH /v1/phone-lines/webhooks/{id}` body from
|
|
63
|
+
* the "Update Fields" collection. Only the fields the user ADDED are sent — an absent field
|
|
64
|
+
* is left unchanged by the API — and a blank text field or an empty event list is treated
|
|
65
|
+
* as "not added" rather than sent (the API would refuse an empty list with 400, and a
|
|
66
|
+
* `null` with 400 INVALID_FIELD_TYPE). `active: false` is sent as is: it pauses the webhook.
|
|
67
|
+
*/
|
|
68
|
+
export declare function phoneLineWebhookUpdatePreSend(this: IExecuteSingleFunctions, requestOptions: IHttpRequestOptions): Promise<IHttpRequestOptions>;
|
|
47
69
|
/**
|
|
48
70
|
* Lead Form → Update: builds the WHOLE `PUT /v1/lead-pages/{id}/forms/{formId}` body.
|
|
49
71
|
*
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PilotStatus = exports.DEFAULT_BASE_URL = exports.FLOW_CATEGORY_OPTIONS = exports.GO_TRISTATE = void 0;
|
|
3
|
+
exports.PilotStatus = exports.PHONE_LINE_WEBHOOK_EVENT_OPTIONS = exports.DEFAULT_BASE_URL = exports.FLOW_CATEGORY_OPTIONS = exports.GO_TRISTATE = void 0;
|
|
4
4
|
exports.apiBaseUrl = apiBaseUrl;
|
|
5
5
|
exports.resolvePhoneLineDocument = resolvePhoneLineDocument;
|
|
6
6
|
exports.phoneLineStartVerificationPreSend = phoneLineStartVerificationPreSend;
|
|
7
7
|
exports.phoneLineSubmitDocumentPreSend = phoneLineSubmitDocumentPreSend;
|
|
8
|
+
exports.phoneLineWebhookCreatePreSend = phoneLineWebhookCreatePreSend;
|
|
9
|
+
exports.phoneLineWebhookUpdatePreSend = phoneLineWebhookUpdatePreSend;
|
|
8
10
|
exports.leadFormConfigPreSend = leadFormConfigPreSend;
|
|
9
11
|
exports.parseContentDispositionFileName = parseContentDispositionFileName;
|
|
10
12
|
exports.phoneLineAudioToBinary = phoneLineAudioToBinary;
|
|
@@ -110,6 +112,89 @@ async function phoneLineSubmitDocumentPreSend(requestOptions) {
|
|
|
110
112
|
ensureObjectBody(requestOptions).document = await resolvePhoneLineDocument(this);
|
|
111
113
|
return requestOptions;
|
|
112
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* The events a phone-line webhook subscribes to (`/v1/phone-lines/webhooks`). A registry of
|
|
117
|
+
* its own: these never reach the number webhooks of `/v1/webhooks`, and the number events
|
|
118
|
+
* never reach these. `*` subscribes to every phone-line event, present and future.
|
|
119
|
+
*/
|
|
120
|
+
exports.PHONE_LINE_WEBHOOK_EVENT_OPTIONS = [
|
|
121
|
+
{ name: 'All Phone Line Events', value: '*', description: 'Every phone_line.* event, including future ones' },
|
|
122
|
+
{ name: 'Activation Audio Received', value: 'phone_line.audio_received' },
|
|
123
|
+
{
|
|
124
|
+
name: 'Activation Code Received',
|
|
125
|
+
value: 'phone_line.code_received',
|
|
126
|
+
description: 'The payload carries the activation code — treat it as a credential',
|
|
127
|
+
},
|
|
128
|
+
{ name: 'Activation Code Failed', value: 'phone_line.code_failed' },
|
|
129
|
+
{ name: 'Line Canceled', value: 'phone_line.canceled' },
|
|
130
|
+
{ name: 'Line Payment Failed', value: 'phone_line.payment_failed' },
|
|
131
|
+
{ name: 'Line Purchased', value: 'phone_line.purchased' },
|
|
132
|
+
{ name: 'Line Renewed', value: 'phone_line.renewed' },
|
|
133
|
+
{ name: 'Line Returned', value: 'phone_line.returned' },
|
|
134
|
+
{ name: 'Line Suspended', value: 'phone_line.suspended' },
|
|
135
|
+
{ name: 'Verification Updated', value: 'phone_line.verification_updated' },
|
|
136
|
+
];
|
|
137
|
+
/**
|
|
138
|
+
* A multiOptions value as a clean list. An expression may hand over a comma-separated
|
|
139
|
+
* string instead of an array; blanks and duplicates are dropped.
|
|
140
|
+
*/
|
|
141
|
+
function toEventList(raw) {
|
|
142
|
+
const list = Array.isArray(raw) ? raw : typeof raw === 'string' ? raw.split(',') : [];
|
|
143
|
+
return [...new Set(list.map((e) => String(e).trim()).filter((e) => e !== ''))];
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Phone Line Webhook → Create: builds the WHOLE `POST /v1/phone-lines/webhooks` body.
|
|
147
|
+
*
|
|
148
|
+
* The API is strict: an unknown field is 400 UNKNOWN_FIELDS and a `null` or wrong-typed
|
|
149
|
+
* one is 400 INVALID_FIELD_TYPE. So the body carries exactly `url`, `events` and — only when
|
|
150
|
+
* it is not blank — `name` (a missing name becomes the URL's hostname on the server).
|
|
151
|
+
*/
|
|
152
|
+
async function phoneLineWebhookCreatePreSend(requestOptions) {
|
|
153
|
+
var _a, _b;
|
|
154
|
+
const url = String((_a = this.getNodeParameter('phoneLineWebhookUrl', '')) !== null && _a !== void 0 ? _a : '').trim();
|
|
155
|
+
if (!url)
|
|
156
|
+
throw new Error('Pilot Status: "URL" is required to create a phone line webhook.');
|
|
157
|
+
const events = toEventList(this.getNodeParameter('phoneLineWebhookEvents', []));
|
|
158
|
+
if (events.length === 0) {
|
|
159
|
+
throw new Error('Pilot Status: choose at least one event in "Events" (or "All Phone Line Events") to create a phone line webhook.');
|
|
160
|
+
}
|
|
161
|
+
const body = { url, events };
|
|
162
|
+
const name = String((_b = this.getNodeParameter('phoneLineWebhookName', '')) !== null && _b !== void 0 ? _b : '').trim();
|
|
163
|
+
if (name)
|
|
164
|
+
body.name = name;
|
|
165
|
+
requestOptions.body = body;
|
|
166
|
+
return requestOptions;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Phone Line Webhook → Update: builds the `PATCH /v1/phone-lines/webhooks/{id}` body from
|
|
170
|
+
* the "Update Fields" collection. Only the fields the user ADDED are sent — an absent field
|
|
171
|
+
* is left unchanged by the API — and a blank text field or an empty event list is treated
|
|
172
|
+
* as "not added" rather than sent (the API would refuse an empty list with 400, and a
|
|
173
|
+
* `null` with 400 INVALID_FIELD_TYPE). `active: false` is sent as is: it pauses the webhook.
|
|
174
|
+
*/
|
|
175
|
+
async function phoneLineWebhookUpdatePreSend(requestOptions) {
|
|
176
|
+
const raw = this.getNodeParameter('phoneLineWebhookUpdateFields', {});
|
|
177
|
+
const fields = raw && typeof raw === 'object' ? raw : {};
|
|
178
|
+
const body = {};
|
|
179
|
+
const name = typeof fields.name === 'string' ? fields.name.trim() : '';
|
|
180
|
+
if (name)
|
|
181
|
+
body.name = name;
|
|
182
|
+
const url = typeof fields.url === 'string' ? fields.url.trim() : '';
|
|
183
|
+
if (url)
|
|
184
|
+
body.url = url;
|
|
185
|
+
if (fields.events !== undefined) {
|
|
186
|
+
const events = toEventList(fields.events);
|
|
187
|
+
if (events.length > 0)
|
|
188
|
+
body.events = events;
|
|
189
|
+
}
|
|
190
|
+
if (typeof fields.active === 'boolean')
|
|
191
|
+
body.active = fields.active;
|
|
192
|
+
if (Object.keys(body).length === 0) {
|
|
193
|
+
throw new Error('Pilot Status: add at least one field under "Update Fields" (Name, URL, Events or Active) to update a phone line webhook.');
|
|
194
|
+
}
|
|
195
|
+
requestOptions.body = body;
|
|
196
|
+
return requestOptions;
|
|
197
|
+
}
|
|
113
198
|
/**
|
|
114
199
|
* Lead Form → Update: builds the WHOLE `PUT /v1/lead-pages/{id}/forms/{formId}` body.
|
|
115
200
|
*
|
|
@@ -347,6 +432,7 @@ class PilotStatus {
|
|
|
347
432
|
{ name: 'Remote Pairing', value: 'remotePairing' },
|
|
348
433
|
{ name: 'Call', value: 'call' },
|
|
349
434
|
{ name: 'Phone Line', value: 'phoneLine' },
|
|
435
|
+
{ name: 'Phone Line Webhook', value: 'phoneLineWebhook' },
|
|
350
436
|
],
|
|
351
437
|
default: 'message',
|
|
352
438
|
},
|
|
@@ -370,7 +456,7 @@ class PilotStatus {
|
|
|
370
456
|
send: {
|
|
371
457
|
preSend: [
|
|
372
458
|
async function (requestOptions) {
|
|
373
|
-
var _a, _b;
|
|
459
|
+
var _a, _b, _c;
|
|
374
460
|
const destinationType = this.getNodeParameter('sendDestinationType') || 'phone';
|
|
375
461
|
if (!requestOptions.body || typeof requestOptions.body !== 'object') {
|
|
376
462
|
requestOptions.body = {};
|
|
@@ -457,6 +543,18 @@ class PilotStatus {
|
|
|
457
543
|
requestOptions.body[campo] = valor;
|
|
458
544
|
}
|
|
459
545
|
}
|
|
546
|
+
// Optional Idempotency-Key: a HEADER, never a body field. Blank or
|
|
547
|
+
// absent leaves the request exactly as before (no deduplication).
|
|
548
|
+
const additional = this.getNodeParameter('additionalFields', {});
|
|
549
|
+
const idempotencyKey = typeof (additional === null || additional === void 0 ? void 0 : additional.idempotencyKey) === 'string'
|
|
550
|
+
? additional.idempotencyKey.trim()
|
|
551
|
+
: '';
|
|
552
|
+
if (idempotencyKey) {
|
|
553
|
+
requestOptions.headers = {
|
|
554
|
+
...((_c = requestOptions.headers) !== null && _c !== void 0 ? _c : {}),
|
|
555
|
+
'Idempotency-Key': idempotencyKey,
|
|
556
|
+
};
|
|
557
|
+
}
|
|
460
558
|
return requestOptions;
|
|
461
559
|
},
|
|
462
560
|
],
|
|
@@ -682,6 +780,13 @@ class PilotStatus {
|
|
|
682
780
|
default: '',
|
|
683
781
|
description: 'Optional expiration limit for the message delivery (ISO8601)',
|
|
684
782
|
},
|
|
783
|
+
{
|
|
784
|
+
displayName: 'Idempotency Key',
|
|
785
|
+
name: 'idempotencyKey',
|
|
786
|
+
type: 'string',
|
|
787
|
+
default: '',
|
|
788
|
+
description: 'Optional. Sent as the Idempotency-Key header (max 255 characters, no control characters), never in the body. REUSE THE SAME KEY when retrying the same message: within 24 hours (per workspace + number + key) the API returns the first accepted response instead of sending again (Idempotent-Replayed: true). Map it from your own data (e.g. an order id) — a key that changes on every run makes retries unsafe. Same key with a DIFFERENT body → 409 IDEMPOTENCY_KEY_REUSED; first call still running → 409 IDEMPOTENCY_KEY_IN_USE; invalid key → 400 IDEMPOTENCY_KEY_INVALID. Only successful (2xx) responses are remembered, so after an error you can fix the input and retry with the same key.',
|
|
789
|
+
},
|
|
685
790
|
{
|
|
686
791
|
displayName: 'Labels',
|
|
687
792
|
name: 'labels',
|
|
@@ -733,6 +838,14 @@ class PilotStatus {
|
|
|
733
838
|
default: 'image',
|
|
734
839
|
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).',
|
|
735
840
|
},
|
|
841
|
+
{
|
|
842
|
+
displayName: 'Media Filename',
|
|
843
|
+
name: 'mediaFilename',
|
|
844
|
+
type: 'string',
|
|
845
|
+
default: '',
|
|
846
|
+
placeholder: 'invoice-1234.pdf',
|
|
847
|
+
description: 'File name the recipient sees for a document (1–240 characters; "/" and "\\" become "_"). Works on a direct document send (Media URL with Media Type Document, no template or text) and on a template whose approved header is a Document, with or without a Media URL. Any other header type is rejected with MEDIA_FILENAME_REQUIRES_DOCUMENT_HEADER. When set with a Media URL and no Media Type, the media is sent as a document.',
|
|
848
|
+
},
|
|
736
849
|
{
|
|
737
850
|
displayName: 'Buttons (JSON)',
|
|
738
851
|
name: 'buttons',
|
|
@@ -916,9 +1029,20 @@ class PilotStatus {
|
|
|
916
1029
|
name: 'mediaTypeNormalized',
|
|
917
1030
|
type: 'hidden',
|
|
918
1031
|
displayOptions: { show: { resource: ['message'], operation: ['send'] } },
|
|
919
|
-
|
|
1032
|
+
// A file name only makes sense on a document, so it flips the default kind:
|
|
1033
|
+
// "image" would make the API reject the send.
|
|
1034
|
+
default: '={{ $parameter.additionalFields?.media ? ($parameter.additionalFields.mediaType || ($parameter.additionalFields.mediaFilename ? "document" : "image")) : undefined }}',
|
|
920
1035
|
routing: { send: { type: 'body', property: 'mediaType' } },
|
|
921
1036
|
},
|
|
1037
|
+
{
|
|
1038
|
+
displayName: 'Media Filename',
|
|
1039
|
+
name: 'mediaFilenameNormalized',
|
|
1040
|
+
type: 'hidden',
|
|
1041
|
+
displayOptions: { show: { resource: ['message'], operation: ['send'] } },
|
|
1042
|
+
// Also valid WITHOUT a Media URL: a template with a DOCUMENT header names its file.
|
|
1043
|
+
default: '={{ $parameter.additionalFields?.mediaFilename || undefined }}',
|
|
1044
|
+
routing: { send: { type: 'body', property: 'mediaFilename' } },
|
|
1045
|
+
},
|
|
922
1046
|
{
|
|
923
1047
|
displayName: 'Buttons',
|
|
924
1048
|
name: 'buttonsNormalized',
|
|
@@ -3055,6 +3179,203 @@ class PilotStatus {
|
|
|
3055
3179
|
default: 'data',
|
|
3056
3180
|
required: true,
|
|
3057
3181
|
},
|
|
3182
|
+
// ----------------------------------
|
|
3183
|
+
// Phone Line Webhook Operations (/v1/phone-lines/webhooks) — a registry SEPARATE from the
|
|
3184
|
+
// number webhooks of /v1/webhooks: these receive phone_line.* events only. TENANT-SCOPED
|
|
3185
|
+
// API key only; permission phone_lines:webhooks (ADMIN and up).
|
|
3186
|
+
// ----------------------------------
|
|
3187
|
+
{
|
|
3188
|
+
displayName: 'Operation',
|
|
3189
|
+
name: 'operation',
|
|
3190
|
+
type: 'options',
|
|
3191
|
+
noDataExpression: true,
|
|
3192
|
+
displayOptions: { show: { resource: ['phoneLineWebhook'] } },
|
|
3193
|
+
options: [
|
|
3194
|
+
{
|
|
3195
|
+
name: 'Create',
|
|
3196
|
+
value: 'create',
|
|
3197
|
+
description: 'Register a webhook that receives phone_line.* events. Answers 201 {webhook} with the plwh_ signing SECRET — shown ONLY in this response, never again: store it now. Not idempotent: running it twice creates two webhooks with two secrets.',
|
|
3198
|
+
action: 'Create a phone line webhook',
|
|
3199
|
+
routing: {
|
|
3200
|
+
request: { method: 'POST', url: '/phone-lines/webhooks' },
|
|
3201
|
+
send: { preSend: [phoneLineWebhookCreatePreSend] },
|
|
3202
|
+
},
|
|
3203
|
+
},
|
|
3204
|
+
{
|
|
3205
|
+
name: 'Delete',
|
|
3206
|
+
value: 'delete',
|
|
3207
|
+
description: 'Delete a phone line webhook AND its delivery history. There is no undo. Answers {ok: true}.',
|
|
3208
|
+
action: 'Delete a phone line webhook',
|
|
3209
|
+
routing: {
|
|
3210
|
+
request: {
|
|
3211
|
+
method: 'DELETE',
|
|
3212
|
+
url: '=/phone-lines/webhooks/{{encodeURIComponent($parameter.phoneLineWebhookId)}}',
|
|
3213
|
+
},
|
|
3214
|
+
},
|
|
3215
|
+
},
|
|
3216
|
+
{
|
|
3217
|
+
name: 'Get',
|
|
3218
|
+
value: 'get',
|
|
3219
|
+
description: 'One phone line webhook: {webhook} with id, name, url, events, active, lastDeliveryAt, lastStatusCode, createdAt. Never the secret. Another workspace\'s webhook is 404 WEBHOOK_NOT_FOUND.',
|
|
3220
|
+
action: 'Get a phone line webhook',
|
|
3221
|
+
routing: {
|
|
3222
|
+
request: {
|
|
3223
|
+
method: 'GET',
|
|
3224
|
+
url: '=/phone-lines/webhooks/{{encodeURIComponent($parameter.phoneLineWebhookId)}}',
|
|
3225
|
+
},
|
|
3226
|
+
},
|
|
3227
|
+
},
|
|
3228
|
+
{
|
|
3229
|
+
name: 'Get Many',
|
|
3230
|
+
value: 'getAll',
|
|
3231
|
+
description: 'Every phone line webhook of the workspace (oldest first) and the subscribable event catalogue. Answers {webhooks, events}. Never the secrets.',
|
|
3232
|
+
action: 'Get many phone line webhooks',
|
|
3233
|
+
routing: { request: { method: 'GET', url: '/phone-lines/webhooks' } },
|
|
3234
|
+
},
|
|
3235
|
+
{
|
|
3236
|
+
name: 'Update',
|
|
3237
|
+
value: 'update',
|
|
3238
|
+
description: 'Change only the fields added under Update Fields; the others stay as they are. Active off PAUSES the webhook. Answers {webhook}; the secret does not change.',
|
|
3239
|
+
action: 'Update a phone line webhook',
|
|
3240
|
+
routing: {
|
|
3241
|
+
request: {
|
|
3242
|
+
method: 'PATCH',
|
|
3243
|
+
url: '=/phone-lines/webhooks/{{encodeURIComponent($parameter.phoneLineWebhookId)}}',
|
|
3244
|
+
},
|
|
3245
|
+
send: { preSend: [phoneLineWebhookUpdatePreSend] },
|
|
3246
|
+
},
|
|
3247
|
+
},
|
|
3248
|
+
{
|
|
3249
|
+
name: 'Get Deliveries',
|
|
3250
|
+
value: 'getDeliveries',
|
|
3251
|
+
description: 'The webhook\'s latest deliveries, newest first: {deliveries} with event, status (PENDING, DELIVERED, FAILED), attempts, responseStatus, lastError, createdAt, deliveredAt. Never the payload — use Get Delivery for that.',
|
|
3252
|
+
action: 'Get the deliveries of a phone line webhook',
|
|
3253
|
+
routing: {
|
|
3254
|
+
request: {
|
|
3255
|
+
method: 'GET',
|
|
3256
|
+
url: '=/phone-lines/webhooks/{{encodeURIComponent($parameter.phoneLineWebhookId)}}/deliveries',
|
|
3257
|
+
},
|
|
3258
|
+
},
|
|
3259
|
+
},
|
|
3260
|
+
{
|
|
3261
|
+
name: 'Get Delivery',
|
|
3262
|
+
value: 'getDelivery',
|
|
3263
|
+
description: 'One delivery with durationMs, responseBody and the payload: the EXACT signed JSON string that was sent. A phone_line.code_received payload carries the activation code — treat the output as a credential.',
|
|
3264
|
+
action: 'Get a delivery of a phone line webhook',
|
|
3265
|
+
routing: {
|
|
3266
|
+
request: {
|
|
3267
|
+
method: 'GET',
|
|
3268
|
+
url: '=/phone-lines/webhooks/{{encodeURIComponent($parameter.phoneLineWebhookId)}}/deliveries/{{encodeURIComponent($parameter.phoneLineWebhookDeliveryId)}}',
|
|
3269
|
+
},
|
|
3270
|
+
},
|
|
3271
|
+
},
|
|
3272
|
+
],
|
|
3273
|
+
default: 'getAll',
|
|
3274
|
+
},
|
|
3275
|
+
{
|
|
3276
|
+
displayName: 'Webhook ID',
|
|
3277
|
+
name: 'phoneLineWebhookId',
|
|
3278
|
+
type: 'string',
|
|
3279
|
+
description: 'Pilot Status id of the phone line webhook — webhooks[].id from Get Many',
|
|
3280
|
+
displayOptions: {
|
|
3281
|
+
show: {
|
|
3282
|
+
resource: ['phoneLineWebhook'],
|
|
3283
|
+
operation: ['delete', 'get', 'update', 'getDeliveries', 'getDelivery'],
|
|
3284
|
+
},
|
|
3285
|
+
},
|
|
3286
|
+
default: '',
|
|
3287
|
+
required: true,
|
|
3288
|
+
},
|
|
3289
|
+
{
|
|
3290
|
+
displayName: 'Delivery ID',
|
|
3291
|
+
name: 'phoneLineWebhookDeliveryId',
|
|
3292
|
+
type: 'string',
|
|
3293
|
+
description: 'deliveries[].id from Get Deliveries',
|
|
3294
|
+
displayOptions: { show: { resource: ['phoneLineWebhook'], operation: ['getDelivery'] } },
|
|
3295
|
+
default: '',
|
|
3296
|
+
required: true,
|
|
3297
|
+
},
|
|
3298
|
+
// Phone Line Webhook: Create. The body is built by phoneLineWebhookCreatePreSend.
|
|
3299
|
+
{
|
|
3300
|
+
displayName: 'URL',
|
|
3301
|
+
name: 'phoneLineWebhookUrl',
|
|
3302
|
+
type: 'string',
|
|
3303
|
+
placeholder: 'https://example.com/phone-line-hook',
|
|
3304
|
+
description: 'HTTPS URL that receives the events. Must be public: an internal or private destination is refused (400 WEBHOOK_URL_REFUSED).',
|
|
3305
|
+
displayOptions: { show: { resource: ['phoneLineWebhook'], operation: ['create'] } },
|
|
3306
|
+
default: '',
|
|
3307
|
+
required: true,
|
|
3308
|
+
},
|
|
3309
|
+
{
|
|
3310
|
+
displayName: 'Events',
|
|
3311
|
+
name: 'phoneLineWebhookEvents',
|
|
3312
|
+
type: 'multiOptions',
|
|
3313
|
+
options: exports.PHONE_LINE_WEBHOOK_EVENT_OPTIONS,
|
|
3314
|
+
description: 'Phone line events delivered to the URL. At least one is required.',
|
|
3315
|
+
displayOptions: { show: { resource: ['phoneLineWebhook'], operation: ['create'] } },
|
|
3316
|
+
default: [],
|
|
3317
|
+
required: true,
|
|
3318
|
+
},
|
|
3319
|
+
{
|
|
3320
|
+
displayName: 'Name',
|
|
3321
|
+
name: 'phoneLineWebhookName',
|
|
3322
|
+
type: 'string',
|
|
3323
|
+
description: 'Optional label (max 100 characters). Left empty, the URL\'s hostname is used.',
|
|
3324
|
+
displayOptions: { show: { resource: ['phoneLineWebhook'], operation: ['create'] } },
|
|
3325
|
+
default: '',
|
|
3326
|
+
},
|
|
3327
|
+
// Phone Line Webhook: Update. The body is built by phoneLineWebhookUpdatePreSend.
|
|
3328
|
+
{
|
|
3329
|
+
displayName: 'Update Fields',
|
|
3330
|
+
name: 'phoneLineWebhookUpdateFields',
|
|
3331
|
+
type: 'collection',
|
|
3332
|
+
placeholder: 'Add Field',
|
|
3333
|
+
displayOptions: { show: { resource: ['phoneLineWebhook'], operation: ['update'] } },
|
|
3334
|
+
default: {},
|
|
3335
|
+
options: [
|
|
3336
|
+
{
|
|
3337
|
+
displayName: 'Active',
|
|
3338
|
+
name: 'active',
|
|
3339
|
+
type: 'boolean',
|
|
3340
|
+
default: true,
|
|
3341
|
+
description: 'Whether the webhook receives events. Off pauses it without deleting it.',
|
|
3342
|
+
},
|
|
3343
|
+
{
|
|
3344
|
+
displayName: 'Events',
|
|
3345
|
+
name: 'events',
|
|
3346
|
+
type: 'multiOptions',
|
|
3347
|
+
options: exports.PHONE_LINE_WEBHOOK_EVENT_OPTIONS,
|
|
3348
|
+
default: [],
|
|
3349
|
+
description: 'REPLACES the subscribed events. An empty selection is ignored.',
|
|
3350
|
+
},
|
|
3351
|
+
{
|
|
3352
|
+
displayName: 'Name',
|
|
3353
|
+
name: 'name',
|
|
3354
|
+
type: 'string',
|
|
3355
|
+
default: '',
|
|
3356
|
+
description: 'New label (max 100 characters). A blank value is ignored.',
|
|
3357
|
+
},
|
|
3358
|
+
{
|
|
3359
|
+
displayName: 'URL',
|
|
3360
|
+
name: 'url',
|
|
3361
|
+
type: 'string',
|
|
3362
|
+
default: '',
|
|
3363
|
+
placeholder: 'https://example.com/phone-line-hook',
|
|
3364
|
+
description: 'New HTTPS public URL. A blank value is ignored.',
|
|
3365
|
+
},
|
|
3366
|
+
],
|
|
3367
|
+
},
|
|
3368
|
+
// Phone Line Webhook: Get Deliveries
|
|
3369
|
+
{
|
|
3370
|
+
displayName: 'Limit',
|
|
3371
|
+
name: 'phoneLineWebhookDeliveriesLimit',
|
|
3372
|
+
type: 'number',
|
|
3373
|
+
typeOptions: { minValue: 1, maxValue: 200 },
|
|
3374
|
+
description: 'Max number of results to return',
|
|
3375
|
+
displayOptions: { show: { resource: ['phoneLineWebhook'], operation: ['getDeliveries'] } },
|
|
3376
|
+
default: 50,
|
|
3377
|
+
routing: { send: { type: 'query', property: 'limit' } },
|
|
3378
|
+
},
|
|
3058
3379
|
],
|
|
3059
3380
|
};
|
|
3060
3381
|
}
|