n8n-nodes-pilot-status 2.2.1 → 2.3.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,38 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `n8n-nodes-pilot-status`.
|
|
4
4
|
|
|
5
|
+
## 2.3.0 - 2026-10-03
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- **Phone Line resource** — the identity verification required to buy a phone line, and
|
|
10
|
+
the activation audio:
|
|
11
|
+
- **Get Verification** — `GET /v1/phone-lines/verification`.
|
|
12
|
+
- **Start Verification** — `POST /v1/phone-lines/verification` (CPF/CNPJ, document
|
|
13
|
+
number, contact email, contact WhatsApp, document). **Idempotency Key is a required
|
|
14
|
+
field**, sent as the `Idempotency-Key` header: reuse the same key when retrying the same
|
|
15
|
+
submission, so a retry returns the verification already created instead of starting a
|
|
16
|
+
second one. It has no default on purpose — a value that changes on every run would make
|
|
17
|
+
every retry a new submission.
|
|
18
|
+
- **Send Contact Code** / **Confirm Contact** — `POST
|
|
19
|
+
/v1/phone-lines/verification/contact/{whatsapp|email}/send|confirm`.
|
|
20
|
+
- **Submit Document** — `POST /v1/phone-lines/verification/document`.
|
|
21
|
+
- **Download Activation Audio** — `GET /v1/phone-lines/activations/{activationId}/audio`,
|
|
22
|
+
output as **n8n binary data** (MIME type from `Content-Type`, file name from
|
|
23
|
+
`Content-Disposition`). The JSON part carries only metadata
|
|
24
|
+
(`activationId`, `contentType`, `contentLength`, `fileName`); the bytes never go into
|
|
25
|
+
JSON, because the recording speaks the activation code.
|
|
26
|
+
- The document can come from a **binary field** of the input item (sent as
|
|
27
|
+
`data:<mimeType>;base64,<data>`) or from a ready **data URI** string.
|
|
28
|
+
- Requires a workspace (tenant-scoped) API key; verification operations need the OWNER role.
|
|
29
|
+
|
|
30
|
+
### Not included
|
|
31
|
+
|
|
32
|
+
- `phone_line.*` webhook events are **not** in the Pilot Status Trigger. They are delivered by
|
|
33
|
+
a separate registry (own `plwh_...` secret) that the Trigger's Automatic registration does
|
|
34
|
+
not use; listing them there would offer events the subscription it creates can never
|
|
35
|
+
receive. Use a regular Webhook node for them (see the README).
|
|
36
|
+
|
|
5
37
|
## 2.2.1 - 2026-09-29
|
|
6
38
|
|
|
7
39
|
### Fixed
|
package/README.md
CHANGED
|
@@ -136,6 +136,25 @@ The **Pilot Status** node provides several resources and operations to manage yo
|
|
|
136
136
|
### 5. Service Window
|
|
137
137
|
- **Get:** Whether the Meta 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.
|
|
138
138
|
|
|
139
|
+
### 7. Phone Line (identity verification + activation audio)
|
|
140
|
+
|
|
141
|
+
Requires a **workspace (tenant-scoped) API key** — a number-scoped key is refused. The verification operations need the **OWNER** role (`phone_lines:purchase`); the audio needs `phone_lines:read`. Errors come back as `{ error, code }`.
|
|
142
|
+
|
|
143
|
+
- **Get Verification:** The workspace verification state — `status` (`NONE`, `PENDING_CONTACT`, `NEEDS_DOCUMENT`, `IN_REVIEW`, `APPROVED`, `REJECTED`), `canPurchase`, and `verification.contact.requiredChannels` / `confirmedChannels` / `pendingChannels` (UPPERCASE there: `EMAIL`, `WHATSAPP`). Personal data comes back masked.
|
|
144
|
+
- **Start Verification:** `POST /v1/phone-lines/verification` with Document Type (`CPF`/`CNPJ`), Document Number, Contact Email, Contact WhatsApp (with country + area code) and the document (PDF/JPG/PNG/WEBP, up to 10 MB). Codes go out to the required channels on their own.
|
|
145
|
+
- **Idempotency Key (required)** is sent as the `Idempotency-Key` header. ⚠️ **Reuse the same key when retrying the same submission** — the API then answers with the verification it already created (`200`, `Idempotent-Replayed: true`) instead of starting another. Map it from your own data (e.g. an id of the input item); a key that changes on every run makes retries unsafe. Same key + different body → `409 IDEMPOTENCY_KEY_REUSED`; while the first request is still running → `409 IDEMPOTENCY_KEY_IN_USE`.
|
|
146
|
+
- While `PENDING_CONTACT`, a new start **replaces** the current one (the old codes stop working). Limit: 10 submissions per hour per workspace (`429 RATE_LIMITED`).
|
|
147
|
+
- **Send Contact Code:** Resend a code on a channel (`whatsapp` or `email`). Codes expire in 10 minutes; 60 s cooldown per channel (`429 CONTACT_CODE_COOLDOWN`).
|
|
148
|
+
- **Confirm Contact:** Confirm a channel with the received **Code**. The last required channel may move the verification to `APPROVED` or `IN_REVIEW`. 5 wrong attempts lock the code (`429 CONTACT_CODE_TOO_MANY_ATTEMPTS`).
|
|
149
|
+
- **Submit Document:** Send a new document when `document.status` is `UNREADABLE`/`UNCLEAR` or the status is `NEEDS_DOCUMENT`. Same file rules and hourly limit as the start; no idempotency key.
|
|
150
|
+
- **Download Activation Audio:** The recording of an activation call (`activationId` from the `phone_line.audio_received` / `phone_line.code_received` webhook), returned as **n8n binary data** in the field set by *Put Output File in Field* (default `data`), with the MIME type from `Content-Type` and the file name from `Content-Disposition`. The JSON part carries only `{ activationId, contentType, contentLength, fileName }`. ⛔ The recording **speaks the activation code** — treat the file as a credential (do not post it to chats or logs). An unknown id, a line from another workspace, a missing recording or a returned/canceled line all answer `404 ACTIVATION_NOT_FOUND`.
|
|
151
|
+
|
|
152
|
+
**Document input — two options (Document Source):**
|
|
153
|
+
- **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>`.
|
|
154
|
+
- **Data URI**: a ready `data:<mime>;base64,...` string.
|
|
155
|
+
|
|
156
|
+
> 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).
|
|
157
|
+
|
|
139
158
|
---
|
|
140
159
|
|
|
141
160
|
## 💡 Use Case Examples
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ILoadOptionsFunctions, INodePropertyOptions, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
1
|
+
import { IExecuteSingleFunctions, IHttpRequestOptions, ILoadOptionsFunctions, IN8nHttpFullResponse, INodeExecutionData, INodePropertyOptions, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
2
|
/**
|
|
3
3
|
* Tri-estado dos `advancedSettings` do Evolution GO. A API distingue `true`,
|
|
4
4
|
* `false` e `null` (= volta ao default do provider), e o `type: 'boolean'` do
|
|
@@ -27,6 +27,41 @@ export declare const DEFAULT_BASE_URL = "https://pilotstatus.com.br";
|
|
|
27
27
|
* staging — the author saw one list while the workflow called a different API.
|
|
28
28
|
*/
|
|
29
29
|
export declare function apiBaseUrl(ctx: ILoadOptionsFunctions): Promise<string>;
|
|
30
|
+
/**
|
|
31
|
+
* Resolves the verification document into the `data:<mime>;base64,<...>` string the API
|
|
32
|
+
* takes, from either of the two n8n idioms: a data URI typed/mapped into the field, or a
|
|
33
|
+
* binary property of the input item (the output of Read Binary File, HTTP Request, ...).
|
|
34
|
+
*
|
|
35
|
+
* The bytes go into the REQUEST body only — nothing here copies them to the output item.
|
|
36
|
+
*/
|
|
37
|
+
export declare function resolvePhoneLineDocument(ctx: IExecuteSingleFunctions): Promise<string>;
|
|
38
|
+
/**
|
|
39
|
+
* Start Verification: sets the REQUIRED `Idempotency-Key` header and the `document` body
|
|
40
|
+
* field. The key is the only thing that makes a retry safe — the backend answers a replay
|
|
41
|
+
* of the same key + same body with the state it already created (200,
|
|
42
|
+
* `Idempotent-Replayed: true`) instead of starting a second verification.
|
|
43
|
+
*/
|
|
44
|
+
export declare function phoneLineStartVerificationPreSend(this: IExecuteSingleFunctions, requestOptions: IHttpRequestOptions): Promise<IHttpRequestOptions>;
|
|
45
|
+
/** Submit Document: the body is exactly `{ document }`. No Idempotency-Key on this route. */
|
|
46
|
+
export declare function phoneLineSubmitDocumentPreSend(this: IExecuteSingleFunctions, requestOptions: IHttpRequestOptions): Promise<IHttpRequestOptions>;
|
|
47
|
+
/**
|
|
48
|
+
* The file name from a `Content-Disposition` header: RFC 5987 `filename*=` first (it is the
|
|
49
|
+
* one that can carry non-ASCII), then the plain `filename=` (quoted or not).
|
|
50
|
+
*/
|
|
51
|
+
export declare function parseContentDispositionFileName(header: unknown): string | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Download Activation Audio: turns the raw response into an n8n BINARY item.
|
|
54
|
+
*
|
|
55
|
+
* ⛔ The recording SPEAKS the activation code — it is a credential. The bytes go to
|
|
56
|
+
* `item.binary[<property>]` only and NEVER into `item.json`; the JSON part carries only
|
|
57
|
+
* metadata. The RoutingNode starts this item as `{ json: <Buffer> }`, which is why the
|
|
58
|
+
* item is rebuilt from scratch instead of being patched.
|
|
59
|
+
*
|
|
60
|
+
* The request runs with `ignoreHttpStatusErrors` so that a 404 (an arraybuffer of JSON)
|
|
61
|
+
* is decoded here and reported with the API's own `code`, instead of n8n printing a
|
|
62
|
+
* byte array.
|
|
63
|
+
*/
|
|
64
|
+
export declare function phoneLineAudioToBinary(this: IExecuteSingleFunctions, _items: INodeExecutionData[], response: IN8nHttpFullResponse): Promise<INodeExecutionData[]>;
|
|
30
65
|
export declare class PilotStatus implements INodeType {
|
|
31
66
|
methods: {
|
|
32
67
|
loadOptions: {
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PilotStatus = exports.DEFAULT_BASE_URL = exports.FLOW_CATEGORY_OPTIONS = exports.GO_TRISTATE = void 0;
|
|
4
4
|
exports.apiBaseUrl = apiBaseUrl;
|
|
5
|
+
exports.resolvePhoneLineDocument = resolvePhoneLineDocument;
|
|
6
|
+
exports.phoneLineStartVerificationPreSend = phoneLineStartVerificationPreSend;
|
|
7
|
+
exports.phoneLineSubmitDocumentPreSend = phoneLineSubmitDocumentPreSend;
|
|
8
|
+
exports.parseContentDispositionFileName = parseContentDispositionFileName;
|
|
9
|
+
exports.phoneLineAudioToBinary = phoneLineAudioToBinary;
|
|
5
10
|
/**
|
|
6
11
|
* Tri-estado dos `advancedSettings` do Evolution GO. A API distingue `true`,
|
|
7
12
|
* `false` e `null` (= volta ao default do provider), e o `type: 'boolean'` do
|
|
@@ -48,6 +53,136 @@ async function apiBaseUrl(ctx) {
|
|
|
48
53
|
const root = (credentials === null || credentials === void 0 ? void 0 : credentials.baseUrl) || exports.DEFAULT_BASE_URL;
|
|
49
54
|
return `${root.replace(/\/+$/, '')}/v1`;
|
|
50
55
|
}
|
|
56
|
+
// ----------------------------------
|
|
57
|
+
// Phone Line helpers
|
|
58
|
+
// ----------------------------------
|
|
59
|
+
/** The shape every verification `document` field must have on the wire. */
|
|
60
|
+
const DATA_URI_PREFIX = /^data:[^;,]+;base64,/i;
|
|
61
|
+
/**
|
|
62
|
+
* Resolves the verification document into the `data:<mime>;base64,<...>` string the API
|
|
63
|
+
* takes, from either of the two n8n idioms: a data URI typed/mapped into the field, or a
|
|
64
|
+
* binary property of the input item (the output of Read Binary File, HTTP Request, ...).
|
|
65
|
+
*
|
|
66
|
+
* The bytes go into the REQUEST body only — nothing here copies them to the output item.
|
|
67
|
+
*/
|
|
68
|
+
async function resolvePhoneLineDocument(ctx) {
|
|
69
|
+
const source = ctx.getNodeParameter('phoneLineDocumentSource', 'dataUri');
|
|
70
|
+
if (source === 'binary') {
|
|
71
|
+
const property = String(ctx.getNodeParameter('phoneLineDocumentBinaryProperty', '')).trim();
|
|
72
|
+
if (!property) {
|
|
73
|
+
throw new Error('Pilot Status: "Input Binary Field" is empty — name the binary property of the input item that holds the document (usually "data").');
|
|
74
|
+
}
|
|
75
|
+
const meta = ctx.helpers.assertBinaryData(property);
|
|
76
|
+
const bytes = await ctx.helpers.getBinaryDataBuffer(property);
|
|
77
|
+
return `data:${meta.mimeType};base64,${bytes.toString('base64')}`;
|
|
78
|
+
}
|
|
79
|
+
const raw = String(ctx.getNodeParameter('phoneLineDocumentDataUri', '')).trim();
|
|
80
|
+
if (!DATA_URI_PREFIX.test(raw)) {
|
|
81
|
+
throw new Error('Pilot Status: "Document (Data URI)" must be a data URI like "data:application/pdf;base64,...". To send a file from a previous node, set Document Source to "Binary Field".');
|
|
82
|
+
}
|
|
83
|
+
return raw;
|
|
84
|
+
}
|
|
85
|
+
function ensureObjectBody(requestOptions) {
|
|
86
|
+
if (!requestOptions.body || typeof requestOptions.body !== 'object') {
|
|
87
|
+
requestOptions.body = {};
|
|
88
|
+
}
|
|
89
|
+
return requestOptions.body;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Start Verification: sets the REQUIRED `Idempotency-Key` header and the `document` body
|
|
93
|
+
* field. The key is the only thing that makes a retry safe — the backend answers a replay
|
|
94
|
+
* of the same key + same body with the state it already created (200,
|
|
95
|
+
* `Idempotent-Replayed: true`) instead of starting a second verification.
|
|
96
|
+
*/
|
|
97
|
+
async function phoneLineStartVerificationPreSend(requestOptions) {
|
|
98
|
+
var _a;
|
|
99
|
+
const key = String(this.getNodeParameter('phoneLineIdempotencyKey', '')).trim();
|
|
100
|
+
if (!key) {
|
|
101
|
+
throw new Error('Pilot Status: "Idempotency Key" is required to start a verification. Use a value that stays the SAME when this item is retried (e.g. an id from your own data).');
|
|
102
|
+
}
|
|
103
|
+
requestOptions.headers = { ...((_a = requestOptions.headers) !== null && _a !== void 0 ? _a : {}), 'Idempotency-Key': key };
|
|
104
|
+
ensureObjectBody(requestOptions).document = await resolvePhoneLineDocument(this);
|
|
105
|
+
return requestOptions;
|
|
106
|
+
}
|
|
107
|
+
/** Submit Document: the body is exactly `{ document }`. No Idempotency-Key on this route. */
|
|
108
|
+
async function phoneLineSubmitDocumentPreSend(requestOptions) {
|
|
109
|
+
ensureObjectBody(requestOptions).document = await resolvePhoneLineDocument(this);
|
|
110
|
+
return requestOptions;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* The file name from a `Content-Disposition` header: RFC 5987 `filename*=` first (it is the
|
|
114
|
+
* one that can carry non-ASCII), then the plain `filename=` (quoted or not).
|
|
115
|
+
*/
|
|
116
|
+
function parseContentDispositionFileName(header) {
|
|
117
|
+
var _a, _b;
|
|
118
|
+
if (typeof header !== 'string')
|
|
119
|
+
return undefined;
|
|
120
|
+
const extended = /filename\*\s*=\s*([^']*)'[^']*'([^;]+)/i.exec(header);
|
|
121
|
+
if (extended) {
|
|
122
|
+
try {
|
|
123
|
+
return decodeURIComponent(extended[2].trim());
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
// Malformed percent-encoding: fall through to the plain parameter.
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
const plain = /filename\s*=\s*(?:"([^"]*)"|([^;]+))/i.exec(header);
|
|
130
|
+
const name = ((_b = (_a = plain === null || plain === void 0 ? void 0 : plain[1]) !== null && _a !== void 0 ? _a : plain === null || plain === void 0 ? void 0 : plain[2]) !== null && _b !== void 0 ? _b : '').trim();
|
|
131
|
+
return name || undefined;
|
|
132
|
+
}
|
|
133
|
+
function headerValue(headers, name) {
|
|
134
|
+
for (const [key, value] of Object.entries(headers !== null && headers !== void 0 ? headers : {})) {
|
|
135
|
+
if (key.toLowerCase() === name)
|
|
136
|
+
return Array.isArray(value) ? String(value[0]) : String(value);
|
|
137
|
+
}
|
|
138
|
+
return undefined;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Download Activation Audio: turns the raw response into an n8n BINARY item.
|
|
142
|
+
*
|
|
143
|
+
* ⛔ The recording SPEAKS the activation code — it is a credential. The bytes go to
|
|
144
|
+
* `item.binary[<property>]` only and NEVER into `item.json`; the JSON part carries only
|
|
145
|
+
* metadata. The RoutingNode starts this item as `{ json: <Buffer> }`, which is why the
|
|
146
|
+
* item is rebuilt from scratch instead of being patched.
|
|
147
|
+
*
|
|
148
|
+
* The request runs with `ignoreHttpStatusErrors` so that a 404 (an arraybuffer of JSON)
|
|
149
|
+
* is decoded here and reported with the API's own `code`, instead of n8n printing a
|
|
150
|
+
* byte array.
|
|
151
|
+
*/
|
|
152
|
+
async function phoneLineAudioToBinary(_items, response) {
|
|
153
|
+
var _a, _b, _c;
|
|
154
|
+
const raw = response.body;
|
|
155
|
+
const bytes = Buffer.isBuffer(raw) ? raw : Buffer.from(raw);
|
|
156
|
+
if (response.statusCode >= 400) {
|
|
157
|
+
let detail = `HTTP ${response.statusCode}`;
|
|
158
|
+
try {
|
|
159
|
+
const parsed = JSON.parse(bytes.toString('utf8'));
|
|
160
|
+
detail = `${(_a = parsed.code) !== null && _a !== void 0 ? _a : `HTTP ${response.statusCode}`}: ${(_b = parsed.error) !== null && _b !== void 0 ? _b : ''}`.trim();
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
// Not JSON (a proxy page, an empty body): the status code is all there is.
|
|
164
|
+
}
|
|
165
|
+
throw new Error(`Pilot Status: could not download the activation audio — ${detail}`);
|
|
166
|
+
}
|
|
167
|
+
const activationId = String(this.getNodeParameter('phoneLineActivationId', ''));
|
|
168
|
+
const property = String(this.getNodeParameter('phoneLineAudioBinaryProperty', 'data')).trim() || 'data';
|
|
169
|
+
const contentType = (_c = headerValue(response.headers, 'content-type')) !== null && _c !== void 0 ? _c : 'application/octet-stream';
|
|
170
|
+
const fileName = parseContentDispositionFileName(headerValue(response.headers, 'content-disposition'));
|
|
171
|
+
const binary = await this.helpers.prepareBinaryData(bytes, fileName, contentType);
|
|
172
|
+
if (fileName)
|
|
173
|
+
binary.fileName = fileName;
|
|
174
|
+
return [
|
|
175
|
+
{
|
|
176
|
+
json: {
|
|
177
|
+
activationId,
|
|
178
|
+
contentType,
|
|
179
|
+
contentLength: bytes.length,
|
|
180
|
+
fileName: fileName !== null && fileName !== void 0 ? fileName : null,
|
|
181
|
+
},
|
|
182
|
+
binary: { [property]: binary },
|
|
183
|
+
},
|
|
184
|
+
];
|
|
185
|
+
}
|
|
51
186
|
class PilotStatus {
|
|
52
187
|
constructor() {
|
|
53
188
|
this.methods = {
|
|
@@ -164,6 +299,7 @@ class PilotStatus {
|
|
|
164
299
|
{ name: 'Service Window', value: 'serviceWindow' },
|
|
165
300
|
{ name: 'Remote Pairing', value: 'remotePairing' },
|
|
166
301
|
{ name: 'Call', value: 'call' },
|
|
302
|
+
{ name: 'Phone Line', value: 'phoneLine' },
|
|
167
303
|
],
|
|
168
304
|
default: 'message',
|
|
169
305
|
},
|
|
@@ -2020,6 +2156,240 @@ class PilotStatus {
|
|
|
2020
2156
|
default: '={{ $parameter.callPermissionText || undefined }}',
|
|
2021
2157
|
routing: { send: { type: 'body', property: 'text' } },
|
|
2022
2158
|
},
|
|
2159
|
+
// ----------------------------------
|
|
2160
|
+
// Phone Line Operations — identity verification (needed to buy a line) and the
|
|
2161
|
+
// activation audio. TENANT-SCOPED API key only; verification needs the OWNER role.
|
|
2162
|
+
// ----------------------------------
|
|
2163
|
+
{
|
|
2164
|
+
displayName: 'Operation',
|
|
2165
|
+
name: 'operation',
|
|
2166
|
+
type: 'options',
|
|
2167
|
+
noDataExpression: true,
|
|
2168
|
+
displayOptions: { show: { resource: ['phoneLine'] } },
|
|
2169
|
+
options: [
|
|
2170
|
+
{
|
|
2171
|
+
name: 'Get Verification',
|
|
2172
|
+
value: 'getVerification',
|
|
2173
|
+
description: 'Read the workspace identity verification: status (NONE, PENDING_CONTACT, NEEDS_DOCUMENT, IN_REVIEW, APPROVED, REJECTED), canPurchase, and which contact channels are still pending',
|
|
2174
|
+
action: 'Get the phone line verification',
|
|
2175
|
+
routing: { request: { method: 'GET', url: '/phone-lines/verification' } },
|
|
2176
|
+
},
|
|
2177
|
+
{
|
|
2178
|
+
name: 'Start Verification',
|
|
2179
|
+
value: 'startVerification',
|
|
2180
|
+
description: 'Start the identity verification required to buy a phone line (CPF/CNPJ + contacts + document). Codes are sent to the required contact channels. While PENDING_CONTACT a new start REPLACES the current one. Limited to 10 submissions per hour per workspace.',
|
|
2181
|
+
action: 'Start a phone line verification',
|
|
2182
|
+
routing: {
|
|
2183
|
+
request: { method: 'POST', url: '/phone-lines/verification' },
|
|
2184
|
+
send: { preSend: [phoneLineStartVerificationPreSend] },
|
|
2185
|
+
},
|
|
2186
|
+
},
|
|
2187
|
+
{
|
|
2188
|
+
name: 'Send Contact Code',
|
|
2189
|
+
value: 'sendContactCode',
|
|
2190
|
+
description: 'Send a NEW code to a required contact channel (resend). Codes expire in 10 minutes; a new code can be requested 60 seconds after the previous one.',
|
|
2191
|
+
action: 'Send a contact verification code',
|
|
2192
|
+
routing: {
|
|
2193
|
+
request: {
|
|
2194
|
+
method: 'POST',
|
|
2195
|
+
url: '=/phone-lines/verification/contact/{{$parameter.phoneLineChannel}}/send',
|
|
2196
|
+
},
|
|
2197
|
+
},
|
|
2198
|
+
},
|
|
2199
|
+
{
|
|
2200
|
+
name: 'Confirm Contact',
|
|
2201
|
+
value: 'confirmContact',
|
|
2202
|
+
description: 'Confirm a contact channel with the code received. Confirming the last required channel may move the verification to APPROVED or IN_REVIEW.',
|
|
2203
|
+
action: 'Confirm a contact channel',
|
|
2204
|
+
routing: {
|
|
2205
|
+
request: {
|
|
2206
|
+
method: 'POST',
|
|
2207
|
+
url: '=/phone-lines/verification/contact/{{$parameter.phoneLineChannel}}/confirm',
|
|
2208
|
+
},
|
|
2209
|
+
},
|
|
2210
|
+
},
|
|
2211
|
+
{
|
|
2212
|
+
name: 'Submit Document',
|
|
2213
|
+
value: 'submitDocument',
|
|
2214
|
+
description: 'Send a new identity document when the current one was UNREADABLE/UNCLEAR or the verification is NEEDS_DOCUMENT. Same file rules and the same 10/hour limit as Start Verification.',
|
|
2215
|
+
action: 'Submit a verification document',
|
|
2216
|
+
routing: {
|
|
2217
|
+
request: { method: 'POST', url: '/phone-lines/verification/document' },
|
|
2218
|
+
send: { preSend: [phoneLineSubmitDocumentPreSend] },
|
|
2219
|
+
},
|
|
2220
|
+
},
|
|
2221
|
+
{
|
|
2222
|
+
name: 'Download Activation Audio',
|
|
2223
|
+
value: 'downloadActivationAudio',
|
|
2224
|
+
description: 'Download the recording of an activation call as n8n binary data. The recording SPEAKS the activation code — treat the file as a credential.',
|
|
2225
|
+
action: 'Download an activation audio',
|
|
2226
|
+
routing: {
|
|
2227
|
+
request: {
|
|
2228
|
+
method: 'GET',
|
|
2229
|
+
url: '=/phone-lines/activations/{{encodeURIComponent($parameter.phoneLineActivationId)}}/audio',
|
|
2230
|
+
encoding: 'arraybuffer',
|
|
2231
|
+
ignoreHttpStatusErrors: true,
|
|
2232
|
+
headers: { Accept: 'audio/*, application/json' },
|
|
2233
|
+
},
|
|
2234
|
+
output: { postReceive: [phoneLineAudioToBinary] },
|
|
2235
|
+
},
|
|
2236
|
+
},
|
|
2237
|
+
],
|
|
2238
|
+
default: 'getVerification',
|
|
2239
|
+
},
|
|
2240
|
+
// Phone Line: Start Verification
|
|
2241
|
+
{
|
|
2242
|
+
displayName: 'Idempotency Key',
|
|
2243
|
+
name: 'phoneLineIdempotencyKey',
|
|
2244
|
+
type: 'string',
|
|
2245
|
+
description: 'Sent as the Idempotency-Key header (max 255 characters). REUSE THE SAME KEY when retrying the same submission: the API then returns the verification it already created instead of starting another. Use a value tied to your own data (e.g. an id of the input item) — a key that changes on every run makes retries unsafe. The same key with a DIFFERENT body is refused (409 IDEMPOTENCY_KEY_REUSED).',
|
|
2246
|
+
displayOptions: { show: { resource: ['phoneLine'], operation: ['startVerification'] } },
|
|
2247
|
+
default: '',
|
|
2248
|
+
required: true,
|
|
2249
|
+
},
|
|
2250
|
+
{
|
|
2251
|
+
displayName: 'Document Type',
|
|
2252
|
+
name: 'phoneLineDocumentType',
|
|
2253
|
+
type: 'options',
|
|
2254
|
+
options: [
|
|
2255
|
+
{ name: 'CPF', value: 'CPF' },
|
|
2256
|
+
{ name: 'CNPJ', value: 'CNPJ' },
|
|
2257
|
+
],
|
|
2258
|
+
displayOptions: { show: { resource: ['phoneLine'], operation: ['startVerification'] } },
|
|
2259
|
+
default: 'CNPJ',
|
|
2260
|
+
required: true,
|
|
2261
|
+
routing: { send: { type: 'body', property: 'documentType' } },
|
|
2262
|
+
},
|
|
2263
|
+
{
|
|
2264
|
+
displayName: 'Document Number',
|
|
2265
|
+
name: 'phoneLineDocumentNumber',
|
|
2266
|
+
type: 'string',
|
|
2267
|
+
description: 'The CPF or CNPJ number (with or without punctuation)',
|
|
2268
|
+
displayOptions: { show: { resource: ['phoneLine'], operation: ['startVerification'] } },
|
|
2269
|
+
default: '',
|
|
2270
|
+
required: true,
|
|
2271
|
+
routing: { send: { type: 'body', property: 'documentNumber' } },
|
|
2272
|
+
},
|
|
2273
|
+
{
|
|
2274
|
+
displayName: 'Contact Email',
|
|
2275
|
+
name: 'phoneLineContactEmail',
|
|
2276
|
+
type: 'string',
|
|
2277
|
+
placeholder: 'name@email.com',
|
|
2278
|
+
description: 'Email that receives a confirmation code',
|
|
2279
|
+
displayOptions: { show: { resource: ['phoneLine'], operation: ['startVerification'] } },
|
|
2280
|
+
default: '',
|
|
2281
|
+
required: true,
|
|
2282
|
+
routing: { send: { type: 'body', property: 'contactEmail' } },
|
|
2283
|
+
},
|
|
2284
|
+
{
|
|
2285
|
+
displayName: 'Contact WhatsApp',
|
|
2286
|
+
name: 'phoneLineContactWhatsapp',
|
|
2287
|
+
type: 'string',
|
|
2288
|
+
placeholder: '+55 11 99999-8888',
|
|
2289
|
+
description: 'WhatsApp number with country and area code, which receives a confirmation code',
|
|
2290
|
+
displayOptions: { show: { resource: ['phoneLine'], operation: ['startVerification'] } },
|
|
2291
|
+
default: '',
|
|
2292
|
+
required: true,
|
|
2293
|
+
routing: { send: { type: 'body', property: 'contactWhatsapp' } },
|
|
2294
|
+
},
|
|
2295
|
+
// Phone Line: the document (Start Verification + Submit Document).
|
|
2296
|
+
//
|
|
2297
|
+
// ⚠️ Shared fields: an operation left out of `displayOptions.show.operation` makes the
|
|
2298
|
+
// preSend read the defaults and fail with a message about a field the user cannot see.
|
|
2299
|
+
{
|
|
2300
|
+
displayName: 'Document Source',
|
|
2301
|
+
name: 'phoneLineDocumentSource',
|
|
2302
|
+
type: 'options',
|
|
2303
|
+
options: [
|
|
2304
|
+
{
|
|
2305
|
+
name: 'Binary Field',
|
|
2306
|
+
value: 'binary',
|
|
2307
|
+
description: 'A file from a previous node (Read Binary File, HTTP Request, form upload...)',
|
|
2308
|
+
},
|
|
2309
|
+
{ name: 'Data URI', value: 'dataUri', description: 'A "data:<mime>;base64,..." string' },
|
|
2310
|
+
],
|
|
2311
|
+
description: 'Identity document: PDF, JPG, PNG or WEBP, up to 10 MB',
|
|
2312
|
+
displayOptions: {
|
|
2313
|
+
show: { resource: ['phoneLine'], operation: ['startVerification', 'submitDocument'] },
|
|
2314
|
+
},
|
|
2315
|
+
default: 'binary',
|
|
2316
|
+
},
|
|
2317
|
+
{
|
|
2318
|
+
displayName: 'Input Binary Field',
|
|
2319
|
+
name: 'phoneLineDocumentBinaryProperty',
|
|
2320
|
+
type: 'string',
|
|
2321
|
+
description: 'Name of the binary property of the input item that holds the document. Sent as data:<mimeType>;base64,<data>.',
|
|
2322
|
+
displayOptions: {
|
|
2323
|
+
show: {
|
|
2324
|
+
resource: ['phoneLine'],
|
|
2325
|
+
operation: ['startVerification', 'submitDocument'],
|
|
2326
|
+
phoneLineDocumentSource: ['binary'],
|
|
2327
|
+
},
|
|
2328
|
+
},
|
|
2329
|
+
default: 'data',
|
|
2330
|
+
required: true,
|
|
2331
|
+
},
|
|
2332
|
+
{
|
|
2333
|
+
displayName: 'Document (Data URI)',
|
|
2334
|
+
name: 'phoneLineDocumentDataUri',
|
|
2335
|
+
type: 'string',
|
|
2336
|
+
typeOptions: { rows: 2 },
|
|
2337
|
+
placeholder: 'data:application/pdf;base64,JVBERi0...',
|
|
2338
|
+
displayOptions: {
|
|
2339
|
+
show: {
|
|
2340
|
+
resource: ['phoneLine'],
|
|
2341
|
+
operation: ['startVerification', 'submitDocument'],
|
|
2342
|
+
phoneLineDocumentSource: ['dataUri'],
|
|
2343
|
+
},
|
|
2344
|
+
},
|
|
2345
|
+
default: '',
|
|
2346
|
+
required: true,
|
|
2347
|
+
},
|
|
2348
|
+
// Phone Line: Send Contact Code + Confirm Contact
|
|
2349
|
+
{
|
|
2350
|
+
displayName: 'Channel',
|
|
2351
|
+
name: 'phoneLineChannel',
|
|
2352
|
+
type: 'options',
|
|
2353
|
+
options: [
|
|
2354
|
+
{ name: 'WhatsApp', value: 'whatsapp' },
|
|
2355
|
+
{ name: 'Email', value: 'email' },
|
|
2356
|
+
],
|
|
2357
|
+
description: 'The contact channel. Only channels listed in requiredChannels can be used.',
|
|
2358
|
+
displayOptions: {
|
|
2359
|
+
show: { resource: ['phoneLine'], operation: ['sendContactCode', 'confirmContact'] },
|
|
2360
|
+
},
|
|
2361
|
+
default: 'whatsapp',
|
|
2362
|
+
required: true,
|
|
2363
|
+
},
|
|
2364
|
+
{
|
|
2365
|
+
displayName: 'Code',
|
|
2366
|
+
name: 'phoneLineContactCode',
|
|
2367
|
+
type: 'string',
|
|
2368
|
+
description: 'The code received on the channel (5 wrong attempts lock it; request a new one with Send Contact Code)',
|
|
2369
|
+
displayOptions: { show: { resource: ['phoneLine'], operation: ['confirmContact'] } },
|
|
2370
|
+
default: '',
|
|
2371
|
+
required: true,
|
|
2372
|
+
routing: { send: { type: 'body', property: 'code' } },
|
|
2373
|
+
},
|
|
2374
|
+
// Phone Line: Download Activation Audio
|
|
2375
|
+
{
|
|
2376
|
+
displayName: 'Activation ID',
|
|
2377
|
+
name: 'phoneLineActivationId',
|
|
2378
|
+
type: 'string',
|
|
2379
|
+
description: 'The activationId from the phone_line.audio_received / phone_line.code_received webhook',
|
|
2380
|
+
displayOptions: { show: { resource: ['phoneLine'], operation: ['downloadActivationAudio'] } },
|
|
2381
|
+
default: '',
|
|
2382
|
+
required: true,
|
|
2383
|
+
},
|
|
2384
|
+
{
|
|
2385
|
+
displayName: 'Put Output File in Field',
|
|
2386
|
+
name: 'phoneLineAudioBinaryProperty',
|
|
2387
|
+
type: 'string',
|
|
2388
|
+
description: 'Name of the binary property the audio file is written to',
|
|
2389
|
+
displayOptions: { show: { resource: ['phoneLine'], operation: ['downloadActivationAudio'] } },
|
|
2390
|
+
default: 'data',
|
|
2391
|
+
required: true,
|
|
2392
|
+
},
|
|
2023
2393
|
],
|
|
2024
2394
|
};
|
|
2025
2395
|
}
|