n8n-nodes-pilot-status 2.7.0 → 2.8.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,27 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `n8n-nodes-pilot-status`.
|
|
4
4
|
|
|
5
|
+
## 2.8.0 - 2026-10-20
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- **Referral** resource — **Get Many** (`GET /v1/referrals`: Source ID, Source Type,
|
|
10
|
+
Start/End Date, Page, Page Size) and **Summary** (`GET /v1/referrals/summary`: Start/End
|
|
11
|
+
Date). Click-to-WhatsApp ad attribution; acts on one number (`chat:read`).
|
|
12
|
+
- **Ads Summary** resource — **Get** (`GET /v1/ads/summary`: WhatsApp Number ID,
|
|
13
|
+
Start/End Date). Ads volume with names and `leadCount`; `analytics:read`, workspace-wide
|
|
14
|
+
on a workspace key without a number. A resource of its own, not a Referral operation,
|
|
15
|
+
because permission and scope differ.
|
|
16
|
+
- **Ad Account** resource — **Get Many**, **Link** (`act_<digits>`), **Unlink** (soft).
|
|
17
|
+
Workspace key only, `integrations:manage`.
|
|
18
|
+
- **Lead Page** resource — **Get Many**, **Link**, **Update** (move to another number;
|
|
19
|
+
`autoSendDisabled`), **Unlink**, **Resync**. ⚠️ **Unlink is destructive**: it erases
|
|
20
|
+
every lead captured through the Page and its form configurations.
|
|
21
|
+
- **Lead Form** resource — **Get Many** and **Update** (PUT, replaces the whole config;
|
|
22
|
+
empty Consent Checkbox Key / Template ID / Free Text go out as `null`, Variable Map must
|
|
23
|
+
be a JSON object).
|
|
24
|
+
- Empty filters are omitted and dates are sent as ISO 8601 everywhere above.
|
|
25
|
+
|
|
5
26
|
## 2.7.0 - 2026-10-19
|
|
6
27
|
|
|
7
28
|
### Added
|
package/README.md
CHANGED
|
@@ -149,6 +149,39 @@ Read-only, and requires a **number-scoped API key**: a lead belongs to the numbe
|
|
|
149
149
|
|
|
150
150
|
Each lead: `{ id, leadgenId, whatsappNumberId, pageId, pageName, formId, formName, adId, adName, adsetName, campaignName, platform, isOrganic, createdAt, fullName, email, phone, fields, consentGiven, conversationId, autoSendStatus, autoSendReason, source, redacted }`, with `fields` as `{ key, label, values }`. ⚠️ `consentGiven: null` means **unknown** (no consent checkbox configured, or not answered) — never read it as a refusal. On a **RELAY_ONLY** number a lead keeps its ids, attribution and status but comes back with `redacted: true` and no name, e-mail, phone or answers, and the response carries `notice: "PII_RELAY_ONLY"`.
|
|
151
151
|
|
|
152
|
+
### 9. Referral (Click-to-WhatsApp ad attribution)
|
|
153
|
+
|
|
154
|
+
Read-only. Acts on **one number**: a number-scoped API key, or a workspace key with **WhatsApp Number ID** set in the credential (sent as `x-whatsapp-number-id`) — without it a workspace key gets `403 TENANT_SCOPE_NOT_ALLOWED`. Needs `chat:read`. In practice only official (Meta Cloud API) numbers have referrals.
|
|
155
|
+
|
|
156
|
+
- **Get Many:** `GET /v1/referrals` — inbound messages that arrived from a Meta ad or post, newest first. Meta attaches the referral to the **first** message of a conversation only, so each row amounts to one conversation started by that ad. Filters: **Source ID** (one ad/post id), **Source Type** (`ad` / `post`), **Start Date** / **End Date** (when the message happened), **Page**, **Page Size** (max 100). Answers `{ referrals, total, page, pageSize, totalPages, notice? }`; each row is a chat message with a `referral` block `{ sourceId, sourceType, sourceUrl, headline, body, mediaType, imageUrl, videoUrl, thumbnailUrl, ctwaClid, adName, adsetId, adsetName, campaignId, campaignName, namesResolvedAt }`.
|
|
157
|
+
- **Summary:** `GET /v1/referrals/summary` — traffic grouped by ad, ordered by conversations. Filters: **Start Date** / **End Date**. Answers `{ ads, total, limit, truncated, notice?, piiNotice? }`, each ad `{ sourceId, sourceType, conversations, messages, firstAt, lastAt, lastSourceUrl, lastHeadline, adName, adsetId, adsetName, campaignId, campaignName, namesResolvedAt }`. ⚠️ `conversations` counts **distinct** conversations (the lead count); `messages` counts messages. Capped at 200 ads: `truncated: true` means a **partial** answer — narrow the dates.
|
|
158
|
+
|
|
159
|
+
`sourceId` is Meta's ad id and the **stable** identity: names are editable in Meta, so never key on them. The campaign / ad set / ad names are filled only when the advertiser has shared the ad account with the Pilot Status business portfolio as a partner; `namesResolvedAt: null` = never resolved, set with names = snapshot at that time, set without names = Meta returned nothing (ad deleted or access missing). On a **RELAY_ONLY** number the ad id and names stay, while `ctwaClid`, the ad copy and the message content come back null with `redacted: true` (Summary: `lastSourceUrl` / `lastHeadline` null, `piiNotice: "PII_RELAY_ONLY"`).
|
|
160
|
+
|
|
161
|
+
### 10. Ads Summary
|
|
162
|
+
|
|
163
|
+
- **Get:** `GET /v1/ads/summary` — Click-to-WhatsApp volume per ad with the resolved campaign / ad set / ad names and `leadCount` (Meta Lead Ads leads of that ad). Filters: **WhatsApp Number ID**, **Start Date** / **End Date**. Answers `{ ads, total, limit, truncated }`. Needs `analytics:read` (not `chat:read`). A number-scoped key, or a credential with **WhatsApp Number ID**, reports that number; a workspace key without it reports the whole workspace. It is a resource of its own, not an operation of **Referral**, because both the permission and the scope differ.
|
|
164
|
+
|
|
165
|
+
### 11. Ad Account
|
|
166
|
+
|
|
167
|
+
Workspace (tenant-scoped) API key only, `integrations:manage`. Access to an ad account comes from the advertiser adding the Pilot Status portfolio (`partnerBusinessId`) as a **partner** with `ads_read` in Meta Business Manager — there is no token to enter.
|
|
168
|
+
|
|
169
|
+
- **Get Many:** `GET /v1/ads/accounts` — `{ linked, candidates, partnerBusinessId, sharingLookup }`. `linked[].sharingActive: null` means Meta could not be asked, not "revoked".
|
|
170
|
+
- **Link:** `POST /v1/ads/accounts` with **Ad Account ID** (`act_<digits>`) → `201 { link }`. Refusals: `409 AD_ACCOUNT_NOT_PROVEN`, `409 AD_ACCOUNT_NOT_SHARED`, `502 ADS_LOOKUP_UNAVAILABLE`, `503 ADS_NOT_CONFIGURED`.
|
|
171
|
+
- **Unlink:** `DELETE /v1/ads/accounts/{adAccountId}` → `{ unlinked, adAccountId }`. Soft: names already resolved stay.
|
|
172
|
+
|
|
173
|
+
### 12. Lead Page and Lead Form (Meta Lead Ads configuration)
|
|
174
|
+
|
|
175
|
+
`integrations:manage`. A credential bound to one number acts on that number's links only (`403 NUMBER_NOT_IN_GRANT` otherwise); a workspace key without one sees them all. Unknown body fields are refused with `400 UNKNOWN_FIELDS`.
|
|
176
|
+
|
|
177
|
+
- **Lead Page → Get Many:** `GET /v1/lead-pages` — `{ linked, candidates, configured, partnerBusinessId, candidatesLookup, eligibilityBlocker }`.
|
|
178
|
+
- **Lead Page → Link:** `POST /v1/lead-pages` with **Facebook Page ID** and **WhatsApp Number ID** (optional only when the credential reaches exactly one number) → `201 { link }`; the last 90 days of leads are backfilled.
|
|
179
|
+
- **Lead Page → Update:** `PATCH /v1/lead-pages/{pageLinkId}` with **New WhatsApp Number ID** → `{ link, autoSendDisabled }`. `autoSendDisabled: true` = every auto-send of the Page's forms was switched off.
|
|
180
|
+
- **Lead Page → Unlink:** `DELETE /v1/lead-pages/{pageLinkId}` → `{ unlinked, pageLinkId, deletedLeads }`. ⚠️ **Destructive:** it erases every lead captured through the Page and deletes its form configurations. There is no undo.
|
|
181
|
+
- **Lead Page → Resync:** `POST /v1/lead-pages/{pageLinkId}/resync` → `202 { started, pageLinkId, subscribedAt?, subscriptionError? }`. Within the cooldown: `429 RESYNC_COOLDOWN` with `retryAfterSeconds`.
|
|
182
|
+
- **Lead Form → Get Many:** `GET /v1/lead-pages/{pageLinkId}/forms` — `{ forms, formsTruncated, numberIsOfficial, templates }`, each form with questions, consent checkboxes and its stored `config` (`null` = never configured).
|
|
183
|
+
- **Lead Form → Update:** `PUT /v1/lead-pages/{pageLinkId}/forms/{formId}` — creates or **replaces** the whole config: **Auto-Send Enabled**, **Consent Checkbox Key**, **Template ID** (official numbers), **Free Text** (other numbers), **Variable Map (JSON)**, **Form Name**. Empty Consent Checkbox Key / Template ID / Free Text go out as `null`. ⚠️ With Auto-Send Enabled, new leads get a WhatsApp message without a human.
|
|
184
|
+
|
|
152
185
|
### 7. Phone Line (identity verification + activation audio)
|
|
153
186
|
|
|
154
187
|
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 }`.
|
|
@@ -44,6 +44,17 @@ 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
|
+
* Lead Form → Update: builds the WHOLE `PUT /v1/lead-pages/{id}/forms/{formId}` body.
|
|
49
|
+
*
|
|
50
|
+
* A preSend rather than per-field routing because the API takes `consentDisclaimerKey`,
|
|
51
|
+
* `templateId` and `freeText` as REQUIRED-but-nullable: an empty field has to go out as
|
|
52
|
+
* `null` (the PUT replaces the config, and an omitted required field is a 400), while
|
|
53
|
+
* the optional `variableMap` / `formName` are left out when empty so the server applies
|
|
54
|
+
* its own defaults. Unknown fields are refused by the API (400 UNKNOWN_FIELDS), so the
|
|
55
|
+
* body carries exactly these six names and nothing else.
|
|
56
|
+
*/
|
|
57
|
+
export declare function leadFormConfigPreSend(this: IExecuteSingleFunctions, requestOptions: IHttpRequestOptions): Promise<IHttpRequestOptions>;
|
|
47
58
|
/**
|
|
48
59
|
* The file name from a `Content-Disposition` header: RFC 5987 `filename*=` first (it is the
|
|
49
60
|
* one that can carry non-ASCII), then the plain `filename=` (quoted or not).
|
|
@@ -5,6 +5,7 @@ exports.apiBaseUrl = apiBaseUrl;
|
|
|
5
5
|
exports.resolvePhoneLineDocument = resolvePhoneLineDocument;
|
|
6
6
|
exports.phoneLineStartVerificationPreSend = phoneLineStartVerificationPreSend;
|
|
7
7
|
exports.phoneLineSubmitDocumentPreSend = phoneLineSubmitDocumentPreSend;
|
|
8
|
+
exports.leadFormConfigPreSend = leadFormConfigPreSend;
|
|
8
9
|
exports.parseContentDispositionFileName = parseContentDispositionFileName;
|
|
9
10
|
exports.phoneLineAudioToBinary = phoneLineAudioToBinary;
|
|
10
11
|
/**
|
|
@@ -109,6 +110,46 @@ async function phoneLineSubmitDocumentPreSend(requestOptions) {
|
|
|
109
110
|
ensureObjectBody(requestOptions).document = await resolvePhoneLineDocument(this);
|
|
110
111
|
return requestOptions;
|
|
111
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* Lead Form → Update: builds the WHOLE `PUT /v1/lead-pages/{id}/forms/{formId}` body.
|
|
115
|
+
*
|
|
116
|
+
* A preSend rather than per-field routing because the API takes `consentDisclaimerKey`,
|
|
117
|
+
* `templateId` and `freeText` as REQUIRED-but-nullable: an empty field has to go out as
|
|
118
|
+
* `null` (the PUT replaces the config, and an omitted required field is a 400), while
|
|
119
|
+
* the optional `variableMap` / `formName` are left out when empty so the server applies
|
|
120
|
+
* its own defaults. Unknown fields are refused by the API (400 UNKNOWN_FIELDS), so the
|
|
121
|
+
* body carries exactly these six names and nothing else.
|
|
122
|
+
*/
|
|
123
|
+
async function leadFormConfigPreSend(requestOptions) {
|
|
124
|
+
const text = (name) => { var _a; return String((_a = this.getNodeParameter(name, '')) !== null && _a !== void 0 ? _a : '').trim(); };
|
|
125
|
+
const body = {
|
|
126
|
+
consentDisclaimerKey: text('leadFormConsentDisclaimerKey') || null,
|
|
127
|
+
autoSendEnabled: this.getNodeParameter('leadFormAutoSendEnabled', false) === true,
|
|
128
|
+
templateId: text('leadFormTemplateId') || null,
|
|
129
|
+
freeText: text('leadFormFreeText') || null,
|
|
130
|
+
};
|
|
131
|
+
const rawMap = this.getNodeParameter('leadFormVariableMap', '');
|
|
132
|
+
if (typeof rawMap === 'string' ? rawMap.trim() !== '' : rawMap != null) {
|
|
133
|
+
let map = rawMap;
|
|
134
|
+
if (typeof rawMap === 'string') {
|
|
135
|
+
try {
|
|
136
|
+
map = JSON.parse(rawMap);
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
map = undefined;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (!map || typeof map !== 'object' || Array.isArray(map)) {
|
|
143
|
+
throw new Error('Pilot Status: "Variable Map (JSON)" must be a JSON object like {"1": {"source": "field", "key": "full_name"}}.');
|
|
144
|
+
}
|
|
145
|
+
body.variableMap = map;
|
|
146
|
+
}
|
|
147
|
+
const formName = text('leadFormName');
|
|
148
|
+
if (formName)
|
|
149
|
+
body.formName = formName;
|
|
150
|
+
requestOptions.body = body;
|
|
151
|
+
return requestOptions;
|
|
152
|
+
}
|
|
112
153
|
/**
|
|
113
154
|
* The file name from a `Content-Disposition` header: RFC 5987 `filename*=` first (it is the
|
|
114
155
|
* one that can carry non-ASCII), then the plain `filename=` (quoted or not).
|
|
@@ -298,6 +339,11 @@ class PilotStatus {
|
|
|
298
339
|
{ name: 'Analytics', value: 'analytics' },
|
|
299
340
|
{ name: 'Service Window', value: 'serviceWindow' },
|
|
300
341
|
{ name: 'Lead', value: 'lead' },
|
|
342
|
+
{ name: 'Referral', value: 'referral' },
|
|
343
|
+
{ name: 'Ads Summary', value: 'adsSummary' },
|
|
344
|
+
{ name: 'Ad Account', value: 'adAccount' },
|
|
345
|
+
{ name: 'Lead Page', value: 'leadPage' },
|
|
346
|
+
{ name: 'Lead Form', value: 'leadForm' },
|
|
301
347
|
{ name: 'Remote Pairing', value: 'remotePairing' },
|
|
302
348
|
{ name: 'Call', value: 'call' },
|
|
303
349
|
{ name: 'Phone Line', value: 'phoneLine' },
|
|
@@ -1972,6 +2018,453 @@ class PilotStatus {
|
|
|
1972
2018
|
routing: { send: { type: 'query', property: 'endDate' } },
|
|
1973
2019
|
},
|
|
1974
2020
|
// ----------------------------------
|
|
2021
|
+
// Referral Operations (Click-to-WhatsApp ad attribution)
|
|
2022
|
+
// ----------------------------------
|
|
2023
|
+
// Read-only. Acts on ONE number: a number-scoped key, or a workspace key whose credential
|
|
2024
|
+
// names the number (x-whatsapp-number-id) — otherwise 403 TENANT_SCOPE_NOT_ALLOWED.
|
|
2025
|
+
{
|
|
2026
|
+
displayName: 'Operation',
|
|
2027
|
+
name: 'operation',
|
|
2028
|
+
type: 'options',
|
|
2029
|
+
noDataExpression: true,
|
|
2030
|
+
displayOptions: { show: { resource: ['referral'] } },
|
|
2031
|
+
options: [
|
|
2032
|
+
{
|
|
2033
|
+
name: 'Get Many',
|
|
2034
|
+
value: 'getAll',
|
|
2035
|
+
description: 'List the inbound messages that arrived from a Click-to-WhatsApp ad or post, newest first. Meta attaches the referral to the FIRST message of a conversation only, so each row amounts to one conversation started by that ad. Answers {referrals, total, page, pageSize, totalPages, notice?}; each row carries referral {sourceId, sourceType, sourceUrl, headline, body, ctwaClid, adName, adsetName, campaignName, namesResolvedAt, ...}. sourceId is the STABLE ad id — names are editable in Meta and filled only when the advertiser shared the ad account with Pilot Status. On a RELAY_ONLY number the ad id and names stay, while ctwaClid, ad copy and content come back null with redacted=true. Acts on one number (needs chat:read).',
|
|
2036
|
+
action: 'Get many referrals',
|
|
2037
|
+
routing: { request: { method: 'GET', url: '/referrals' } },
|
|
2038
|
+
},
|
|
2039
|
+
{
|
|
2040
|
+
name: 'Summary',
|
|
2041
|
+
value: 'summary',
|
|
2042
|
+
description: 'Click-to-WhatsApp traffic grouped by ad, ordered by conversations. Answers {ads, total, limit, truncated, notice?, piiNotice?}; each ad {sourceId, sourceType, conversations, messages, firstAt, lastAt, lastSourceUrl, lastHeadline, adName, adsetId, adsetName, campaignId, campaignName, namesResolvedAt}. ⚠️ conversations counts DISTINCT conversations (the lead count); messages counts messages. Capped at 200 ads: truncated=true means a PARTIAL answer — narrow the dates. Acts on one number (needs chat:read).',
|
|
2043
|
+
action: 'Get referral summary',
|
|
2044
|
+
routing: { request: { method: 'GET', url: '/referrals/summary' } },
|
|
2045
|
+
},
|
|
2046
|
+
],
|
|
2047
|
+
default: 'getAll',
|
|
2048
|
+
},
|
|
2049
|
+
{
|
|
2050
|
+
displayName: 'Source ID',
|
|
2051
|
+
name: 'referralSourceId',
|
|
2052
|
+
type: 'string',
|
|
2053
|
+
displayOptions: { show: { resource: ['referral'], operation: ['getAll'] } },
|
|
2054
|
+
default: '',
|
|
2055
|
+
description: 'Only messages from this Meta ad or post ID (e.g. 120249828053880703)',
|
|
2056
|
+
},
|
|
2057
|
+
{
|
|
2058
|
+
displayName: 'Source Type',
|
|
2059
|
+
name: 'referralSourceType',
|
|
2060
|
+
type: 'options',
|
|
2061
|
+
displayOptions: { show: { resource: ['referral'], operation: ['getAll'] } },
|
|
2062
|
+
options: [
|
|
2063
|
+
{ name: 'Any', value: '' },
|
|
2064
|
+
{ name: 'Ad', value: 'ad' },
|
|
2065
|
+
{ name: 'Post', value: 'post' },
|
|
2066
|
+
],
|
|
2067
|
+
default: '',
|
|
2068
|
+
description: 'Only paid ads or only organic posts',
|
|
2069
|
+
},
|
|
2070
|
+
{
|
|
2071
|
+
displayName: 'Start Date',
|
|
2072
|
+
name: 'referralStartDate',
|
|
2073
|
+
type: 'dateTime',
|
|
2074
|
+
displayOptions: { show: { resource: ['referral'], operation: ['getAll', 'summary'] } },
|
|
2075
|
+
default: '',
|
|
2076
|
+
description: 'Only messages that happened at or after this instant',
|
|
2077
|
+
},
|
|
2078
|
+
{
|
|
2079
|
+
displayName: 'End Date',
|
|
2080
|
+
name: 'referralEndDate',
|
|
2081
|
+
type: 'dateTime',
|
|
2082
|
+
displayOptions: { show: { resource: ['referral'], operation: ['getAll', 'summary'] } },
|
|
2083
|
+
default: '',
|
|
2084
|
+
description: 'Only messages that happened at or before this instant. Must not precede Start Date.',
|
|
2085
|
+
},
|
|
2086
|
+
{
|
|
2087
|
+
displayName: 'Page',
|
|
2088
|
+
name: 'referralPage',
|
|
2089
|
+
type: 'number',
|
|
2090
|
+
typeOptions: { minValue: 1 },
|
|
2091
|
+
displayOptions: { show: { resource: ['referral'], operation: ['getAll'] } },
|
|
2092
|
+
default: 1,
|
|
2093
|
+
routing: { send: { type: 'query', property: 'page' } },
|
|
2094
|
+
},
|
|
2095
|
+
{
|
|
2096
|
+
displayName: 'Page Size',
|
|
2097
|
+
name: 'referralPageSize',
|
|
2098
|
+
type: 'number',
|
|
2099
|
+
typeOptions: { minValue: 1, maxValue: 100 },
|
|
2100
|
+
displayOptions: { show: { resource: ['referral'], operation: ['getAll'] } },
|
|
2101
|
+
default: 30,
|
|
2102
|
+
description: 'Items per page (max 100)',
|
|
2103
|
+
routing: { send: { type: 'query', property: 'pageSize' } },
|
|
2104
|
+
},
|
|
2105
|
+
// Empty filters are omitted rather than sent as `?sourceId=` (an empty sourceType would
|
|
2106
|
+
// answer 400 INVALID_SOURCE_TYPE), and the dates are converted to ISO 8601 — the n8n
|
|
2107
|
+
// date picker hands over another format.
|
|
2108
|
+
{
|
|
2109
|
+
displayName: 'Source ID',
|
|
2110
|
+
name: 'referralSourceIdNormalized',
|
|
2111
|
+
type: 'hidden',
|
|
2112
|
+
displayOptions: { show: { resource: ['referral'], operation: ['getAll'] } },
|
|
2113
|
+
default: '={{ $parameter.referralSourceId || undefined }}',
|
|
2114
|
+
routing: { send: { type: 'query', property: 'sourceId' } },
|
|
2115
|
+
},
|
|
2116
|
+
{
|
|
2117
|
+
displayName: 'Source Type',
|
|
2118
|
+
name: 'referralSourceTypeNormalized',
|
|
2119
|
+
type: 'hidden',
|
|
2120
|
+
displayOptions: { show: { resource: ['referral'], operation: ['getAll'] } },
|
|
2121
|
+
default: '={{ $parameter.referralSourceType || undefined }}',
|
|
2122
|
+
routing: { send: { type: 'query', property: 'sourceType' } },
|
|
2123
|
+
},
|
|
2124
|
+
{
|
|
2125
|
+
displayName: 'Start Date',
|
|
2126
|
+
name: 'referralStartDateNormalized',
|
|
2127
|
+
type: 'hidden',
|
|
2128
|
+
displayOptions: { show: { resource: ['referral'], operation: ['getAll', 'summary'] } },
|
|
2129
|
+
default: '={{ $parameter.referralStartDate ? new Date($parameter.referralStartDate).toISOString() : undefined }}',
|
|
2130
|
+
routing: { send: { type: 'query', property: 'startDate' } },
|
|
2131
|
+
},
|
|
2132
|
+
{
|
|
2133
|
+
displayName: 'End Date',
|
|
2134
|
+
name: 'referralEndDateNormalized',
|
|
2135
|
+
type: 'hidden',
|
|
2136
|
+
displayOptions: { show: { resource: ['referral'], operation: ['getAll', 'summary'] } },
|
|
2137
|
+
default: '={{ $parameter.referralEndDate ? new Date($parameter.referralEndDate).toISOString() : undefined }}',
|
|
2138
|
+
routing: { send: { type: 'query', property: 'endDate' } },
|
|
2139
|
+
},
|
|
2140
|
+
// ----------------------------------
|
|
2141
|
+
// Ads Summary (GET /v1/ads/summary)
|
|
2142
|
+
// ----------------------------------
|
|
2143
|
+
// Its own resource rather than an operation under Referral: same aggregate, different
|
|
2144
|
+
// AUTHORITY and SCOPE. Referral → Summary is `chat:read` on ONE number; this is
|
|
2145
|
+
// `analytics:read` (ANALYST included) and, on a workspace key without a number, covers
|
|
2146
|
+
// the whole workspace — plus `leadCount`. Filing it under Referral would suggest the
|
|
2147
|
+
// same permission and the same per-number scope, and neither holds.
|
|
2148
|
+
{
|
|
2149
|
+
displayName: 'Operation',
|
|
2150
|
+
name: 'operation',
|
|
2151
|
+
type: 'options',
|
|
2152
|
+
noDataExpression: true,
|
|
2153
|
+
displayOptions: { show: { resource: ['adsSummary'] } },
|
|
2154
|
+
options: [
|
|
2155
|
+
{
|
|
2156
|
+
name: 'Get',
|
|
2157
|
+
value: 'get',
|
|
2158
|
+
description: 'Click-to-WhatsApp volume per ad with resolved campaign / ad set / ad names and leadCount (Meta Lead Ads leads of that ad). Answers {ads, total, limit, truncated}. ⚠️ conversations counts DISTINCT conversations; messages counts messages. Capped at 200 ads: truncated=true means a PARTIAL answer — narrow the dates. Needs analytics:read. A number-scoped key (or a credential with WhatsApp Number ID) reports that number; a workspace key without it reports the whole workspace.',
|
|
2159
|
+
action: 'Get the ads summary',
|
|
2160
|
+
routing: { request: { method: 'GET', url: '/ads/summary' } },
|
|
2161
|
+
},
|
|
2162
|
+
],
|
|
2163
|
+
default: 'get',
|
|
2164
|
+
},
|
|
2165
|
+
{
|
|
2166
|
+
displayName: 'WhatsApp Number ID',
|
|
2167
|
+
name: 'adsSummaryWhatsappNumberId',
|
|
2168
|
+
type: 'string',
|
|
2169
|
+
displayOptions: { show: { resource: ['adsSummary'], operation: ['get'] } },
|
|
2170
|
+
default: '',
|
|
2171
|
+
description: 'Only this number. Must be within the credential\'s reach, else 403 NUMBER_NOT_IN_GRANT. Leave empty for every number the credential reaches.',
|
|
2172
|
+
},
|
|
2173
|
+
{
|
|
2174
|
+
displayName: 'Start Date',
|
|
2175
|
+
name: 'adsSummaryStartDate',
|
|
2176
|
+
type: 'dateTime',
|
|
2177
|
+
displayOptions: { show: { resource: ['adsSummary'], operation: ['get'] } },
|
|
2178
|
+
default: '',
|
|
2179
|
+
description: 'Only messages (and leads) at or after this instant',
|
|
2180
|
+
},
|
|
2181
|
+
{
|
|
2182
|
+
displayName: 'End Date',
|
|
2183
|
+
name: 'adsSummaryEndDate',
|
|
2184
|
+
type: 'dateTime',
|
|
2185
|
+
displayOptions: { show: { resource: ['adsSummary'], operation: ['get'] } },
|
|
2186
|
+
default: '',
|
|
2187
|
+
description: 'Only messages (and leads) at or before this instant. Must not precede Start Date.',
|
|
2188
|
+
},
|
|
2189
|
+
{
|
|
2190
|
+
displayName: 'WhatsApp Number ID',
|
|
2191
|
+
name: 'adsSummaryWhatsappNumberIdNormalized',
|
|
2192
|
+
type: 'hidden',
|
|
2193
|
+
displayOptions: { show: { resource: ['adsSummary'], operation: ['get'] } },
|
|
2194
|
+
default: '={{ $parameter.adsSummaryWhatsappNumberId || undefined }}',
|
|
2195
|
+
routing: { send: { type: 'query', property: 'whatsappNumberId' } },
|
|
2196
|
+
},
|
|
2197
|
+
{
|
|
2198
|
+
displayName: 'Start Date',
|
|
2199
|
+
name: 'adsSummaryStartDateNormalized',
|
|
2200
|
+
type: 'hidden',
|
|
2201
|
+
displayOptions: { show: { resource: ['adsSummary'], operation: ['get'] } },
|
|
2202
|
+
default: '={{ $parameter.adsSummaryStartDate ? new Date($parameter.adsSummaryStartDate).toISOString() : undefined }}',
|
|
2203
|
+
routing: { send: { type: 'query', property: 'startDate' } },
|
|
2204
|
+
},
|
|
2205
|
+
{
|
|
2206
|
+
displayName: 'End Date',
|
|
2207
|
+
name: 'adsSummaryEndDateNormalized',
|
|
2208
|
+
type: 'hidden',
|
|
2209
|
+
displayOptions: { show: { resource: ['adsSummary'], operation: ['get'] } },
|
|
2210
|
+
default: '={{ $parameter.adsSummaryEndDate ? new Date($parameter.adsSummaryEndDate).toISOString() : undefined }}',
|
|
2211
|
+
routing: { send: { type: 'query', property: 'endDate' } },
|
|
2212
|
+
},
|
|
2213
|
+
// ----------------------------------
|
|
2214
|
+
// Ad Account Operations (/v1/ads/accounts)
|
|
2215
|
+
// ----------------------------------
|
|
2216
|
+
// Workspace (tenant-scoped) key only, `integrations:manage` on every verb. Access to an
|
|
2217
|
+
// ad account comes from the advertiser adding the Pilot Status portfolio as a PARTNER in
|
|
2218
|
+
// Meta Business Manager — there is no token to send.
|
|
2219
|
+
{
|
|
2220
|
+
displayName: 'Operation',
|
|
2221
|
+
name: 'operation',
|
|
2222
|
+
type: 'options',
|
|
2223
|
+
noDataExpression: true,
|
|
2224
|
+
displayOptions: { show: { resource: ['adAccount'] } },
|
|
2225
|
+
options: [
|
|
2226
|
+
{
|
|
2227
|
+
name: 'Get Many',
|
|
2228
|
+
value: 'getAll',
|
|
2229
|
+
description: 'The ad accounts connected to the workspace (so campaign / ad set / ad names can be resolved) and the ones that may be connected. Answers {linked, candidates, partnerBusinessId, sharingLookup}; partnerBusinessId is the Pilot Status portfolio the advertiser adds as a PARTNER (ads_read) of the ad account in Meta Business Manager. linked[].sharingActive null means Meta could not be asked, NOT revoked. Requires a workspace (tenant-scoped) API key.',
|
|
2230
|
+
action: 'Get many ad accounts',
|
|
2231
|
+
routing: { request: { method: 'GET', url: '/ads/accounts' } },
|
|
2232
|
+
},
|
|
2233
|
+
{
|
|
2234
|
+
name: 'Link',
|
|
2235
|
+
value: 'link',
|
|
2236
|
+
description: 'Connect one ad account (act_<digits>). Answers 201 {link}. Refused with 409 AD_ACCOUNT_NOT_PROVEN (no ad of that account in this workspace\'s conversations), 409 AD_ACCOUNT_NOT_SHARED (partner grant not there yet), 502 ADS_LOOKUP_UNAVAILABLE or 503 ADS_NOT_CONFIGURED. Requires a workspace API key.',
|
|
2237
|
+
action: 'Link an ad account',
|
|
2238
|
+
routing: { request: { method: 'POST', url: '/ads/accounts' } },
|
|
2239
|
+
},
|
|
2240
|
+
{
|
|
2241
|
+
name: 'Unlink',
|
|
2242
|
+
value: 'unlink',
|
|
2243
|
+
description: 'Disconnect one ad account. Soft: names already resolved stay. Answers {unlinked, adAccountId}; 404 NOT_FOUND when it is not linked to this workspace. Requires a workspace API key.',
|
|
2244
|
+
action: 'Unlink an ad account',
|
|
2245
|
+
routing: { request: { method: 'DELETE', url: '=/ads/accounts/{{$parameter.adAccountId}}' } },
|
|
2246
|
+
},
|
|
2247
|
+
],
|
|
2248
|
+
default: 'getAll',
|
|
2249
|
+
},
|
|
2250
|
+
{
|
|
2251
|
+
displayName: 'Ad Account ID',
|
|
2252
|
+
name: 'adAccountId',
|
|
2253
|
+
type: 'string',
|
|
2254
|
+
displayOptions: { show: { resource: ['adAccount'], operation: ['link', 'unlink'] } },
|
|
2255
|
+
default: '',
|
|
2256
|
+
required: true,
|
|
2257
|
+
placeholder: 'act_1234567890',
|
|
2258
|
+
description: 'Meta ad account id, act_ followed by digits',
|
|
2259
|
+
},
|
|
2260
|
+
// The id travels in the BODY on Link and in the PATH on Unlink: the body field is a
|
|
2261
|
+
// hidden mirror shown on Link only, so the DELETE never carries a body.
|
|
2262
|
+
{
|
|
2263
|
+
displayName: 'Ad Account ID',
|
|
2264
|
+
name: 'adAccountIdBody',
|
|
2265
|
+
type: 'hidden',
|
|
2266
|
+
displayOptions: { show: { resource: ['adAccount'], operation: ['link'] } },
|
|
2267
|
+
default: '={{ $parameter.adAccountId }}',
|
|
2268
|
+
routing: { send: { type: 'body', property: 'adAccountId' } },
|
|
2269
|
+
},
|
|
2270
|
+
// ----------------------------------
|
|
2271
|
+
// Lead Page Operations (/v1/lead-pages)
|
|
2272
|
+
// ----------------------------------
|
|
2273
|
+
// `integrations:manage`. A credential bound to one number acts on that number's links
|
|
2274
|
+
// only (403 NUMBER_NOT_IN_GRANT otherwise); a workspace key without one sees them all.
|
|
2275
|
+
{
|
|
2276
|
+
displayName: 'Operation',
|
|
2277
|
+
name: 'operation',
|
|
2278
|
+
type: 'options',
|
|
2279
|
+
noDataExpression: true,
|
|
2280
|
+
displayOptions: { show: { resource: ['leadPage'] } },
|
|
2281
|
+
options: [
|
|
2282
|
+
{
|
|
2283
|
+
name: 'Get Many',
|
|
2284
|
+
value: 'getAll',
|
|
2285
|
+
description: 'The Facebook Pages linked for Meta Lead Ads capture and the Pages this workspace may link. Answers {linked, candidates, configured, partnerBusinessId, candidatesLookup, eligibilityBlocker}. linked[].subscribedAt null means Meta is NOT pushing leads (subscriptionError says why); candidates[].missingTasks empty = ready to link. eligibilityBlocker NO_OFFICIAL_NUMBER = the workspace needs an official number first.',
|
|
2286
|
+
action: 'Get many lead pages',
|
|
2287
|
+
routing: { request: { method: 'GET', url: '/lead-pages' } },
|
|
2288
|
+
},
|
|
2289
|
+
{
|
|
2290
|
+
name: 'Link',
|
|
2291
|
+
value: 'link',
|
|
2292
|
+
description: 'Link one Facebook Page to one WhatsApp number so its Lead Ads leads arrive there. Answers 201 {link}; the last 90 days of leads are backfilled on their own.',
|
|
2293
|
+
action: 'Link a lead page',
|
|
2294
|
+
routing: { request: { method: 'POST', url: '/lead-pages' } },
|
|
2295
|
+
},
|
|
2296
|
+
{
|
|
2297
|
+
name: 'Update',
|
|
2298
|
+
value: 'update',
|
|
2299
|
+
description: 'Move a Page link to another WhatsApp number. Answers {link, autoSendDisabled}; autoSendDisabled=true means every auto-send of the Page\'s forms was switched OFF (the new number sends a different kind of message) and must be reviewed.',
|
|
2300
|
+
action: 'Move a lead page to another number',
|
|
2301
|
+
routing: { request: { method: 'PATCH', url: '=/lead-pages/{{$parameter.pageLinkId}}' } },
|
|
2302
|
+
},
|
|
2303
|
+
{
|
|
2304
|
+
name: 'Unlink',
|
|
2305
|
+
value: 'unlink',
|
|
2306
|
+
description: '⚠️ DESTRUCTIVE — unlinking a Page ERASES every lead captured through it and deletes its form configurations. There is no undo. Answers {unlinked, pageLinkId, deletedLeads}.',
|
|
2307
|
+
action: 'Unlink a lead page and delete its leads',
|
|
2308
|
+
routing: { request: { method: 'DELETE', url: '=/lead-pages/{{$parameter.pageLinkId}}' } },
|
|
2309
|
+
},
|
|
2310
|
+
{
|
|
2311
|
+
name: 'Resync',
|
|
2312
|
+
value: 'resync',
|
|
2313
|
+
description: 'Re-pull the Page\'s last 90 days of leads (idempotent) and retry the subscription when it is down. Answers 202 {started, pageLinkId, subscribedAt?, subscriptionError?}; the backfill runs in the background. Inside the per-Page cooldown it fails with 429 RESYNC_COOLDOWN, whose body carries retryAfterSeconds.',
|
|
2314
|
+
action: 'Resync a lead page',
|
|
2315
|
+
routing: { request: { method: 'POST', url: '=/lead-pages/{{$parameter.pageLinkId}}/resync' } },
|
|
2316
|
+
},
|
|
2317
|
+
],
|
|
2318
|
+
default: 'getAll',
|
|
2319
|
+
},
|
|
2320
|
+
{
|
|
2321
|
+
displayName: 'Page Link ID',
|
|
2322
|
+
name: 'pageLinkId',
|
|
2323
|
+
type: 'string',
|
|
2324
|
+
displayOptions: { show: { resource: ['leadPage'], operation: ['update', 'unlink', 'resync'] } },
|
|
2325
|
+
default: '',
|
|
2326
|
+
required: true,
|
|
2327
|
+
description: 'Pilot Status id of the Page link — linked[].pageLinkId from Get Many. Not the Facebook Page ID.',
|
|
2328
|
+
},
|
|
2329
|
+
{
|
|
2330
|
+
displayName: 'Facebook Page ID',
|
|
2331
|
+
name: 'leadPagePageId',
|
|
2332
|
+
type: 'string',
|
|
2333
|
+
displayOptions: { show: { resource: ['leadPage'], operation: ['link'] } },
|
|
2334
|
+
default: '',
|
|
2335
|
+
required: true,
|
|
2336
|
+
description: 'Numeric Facebook Page id (candidates[].pageId from Get Many)',
|
|
2337
|
+
routing: { send: { type: 'body', property: 'pageId' } },
|
|
2338
|
+
},
|
|
2339
|
+
{
|
|
2340
|
+
displayName: 'WhatsApp Number ID',
|
|
2341
|
+
name: 'leadPageWhatsappNumberId',
|
|
2342
|
+
type: 'string',
|
|
2343
|
+
displayOptions: { show: { resource: ['leadPage'], operation: ['link'] } },
|
|
2344
|
+
default: '',
|
|
2345
|
+
description: 'Number that receives the Page\'s leads. May be left empty only when the credential reaches exactly one number (number-scoped key, or WhatsApp Number ID set in the credential).',
|
|
2346
|
+
},
|
|
2347
|
+
{
|
|
2348
|
+
displayName: 'WhatsApp Number ID',
|
|
2349
|
+
name: 'leadPageWhatsappNumberIdNormalized',
|
|
2350
|
+
type: 'hidden',
|
|
2351
|
+
displayOptions: { show: { resource: ['leadPage'], operation: ['link'] } },
|
|
2352
|
+
default: '={{ $parameter.leadPageWhatsappNumberId || undefined }}',
|
|
2353
|
+
routing: { send: { type: 'body', property: 'whatsappNumberId' } },
|
|
2354
|
+
},
|
|
2355
|
+
{
|
|
2356
|
+
displayName: 'New WhatsApp Number ID',
|
|
2357
|
+
name: 'leadPageMoveWhatsappNumberId',
|
|
2358
|
+
type: 'string',
|
|
2359
|
+
displayOptions: { show: { resource: ['leadPage'], operation: ['update'] } },
|
|
2360
|
+
default: '',
|
|
2361
|
+
required: true,
|
|
2362
|
+
description: 'Number the Page\'s leads should go to from now on',
|
|
2363
|
+
routing: { send: { type: 'body', property: 'whatsappNumberId' } },
|
|
2364
|
+
},
|
|
2365
|
+
// ----------------------------------
|
|
2366
|
+
// Lead Form Operations (/v1/lead-pages/{pageLinkId}/forms)
|
|
2367
|
+
// ----------------------------------
|
|
2368
|
+
{
|
|
2369
|
+
displayName: 'Operation',
|
|
2370
|
+
name: 'operation',
|
|
2371
|
+
type: 'options',
|
|
2372
|
+
noDataExpression: true,
|
|
2373
|
+
displayOptions: { show: { resource: ['leadForm'] } },
|
|
2374
|
+
options: [
|
|
2375
|
+
{
|
|
2376
|
+
name: 'Get Many',
|
|
2377
|
+
value: 'getAll',
|
|
2378
|
+
description: 'The linked Page\'s Instant Forms, live from Meta, with their questions, consent checkboxes and stored config (null = never configured), plus the APPROVED templates the link\'s number can auto-send. Answers {forms, formsTruncated, numberIsOfficial, templates}. consentAvailable=false means the checkbox list is UNKNOWN, not empty.',
|
|
2379
|
+
action: 'Get many lead forms',
|
|
2380
|
+
routing: {
|
|
2381
|
+
request: { method: 'GET', url: '=/lead-pages/{{$parameter.leadFormPageLinkId}}/forms' },
|
|
2382
|
+
},
|
|
2383
|
+
},
|
|
2384
|
+
{
|
|
2385
|
+
name: 'Update',
|
|
2386
|
+
value: 'update',
|
|
2387
|
+
description: 'Create or REPLACE one form\'s config (every field is rewritten). ⚠️ With Auto-Send Enabled, new leads get a WhatsApp message WITHOUT a human: an official number sends the Template ID (APPROVED template), the others send the Free Text. Answers {config}.',
|
|
2388
|
+
action: 'Update a lead form configuration',
|
|
2389
|
+
routing: {
|
|
2390
|
+
request: {
|
|
2391
|
+
method: 'PUT',
|
|
2392
|
+
url: '=/lead-pages/{{$parameter.leadFormPageLinkId}}/forms/{{$parameter.leadFormFormId}}',
|
|
2393
|
+
},
|
|
2394
|
+
send: { preSend: [leadFormConfigPreSend] },
|
|
2395
|
+
},
|
|
2396
|
+
},
|
|
2397
|
+
],
|
|
2398
|
+
default: 'getAll',
|
|
2399
|
+
},
|
|
2400
|
+
{
|
|
2401
|
+
displayName: 'Page Link ID',
|
|
2402
|
+
name: 'leadFormPageLinkId',
|
|
2403
|
+
type: 'string',
|
|
2404
|
+
displayOptions: { show: { resource: ['leadForm'] } },
|
|
2405
|
+
default: '',
|
|
2406
|
+
required: true,
|
|
2407
|
+
description: 'Pilot Status id of the Page link — linked[].pageLinkId from Lead Page → Get Many',
|
|
2408
|
+
},
|
|
2409
|
+
{
|
|
2410
|
+
displayName: 'Form ID',
|
|
2411
|
+
name: 'leadFormFormId',
|
|
2412
|
+
type: 'string',
|
|
2413
|
+
displayOptions: { show: { resource: ['leadForm'], operation: ['update'] } },
|
|
2414
|
+
default: '',
|
|
2415
|
+
required: true,
|
|
2416
|
+
description: 'Numeric Meta Instant Form id (forms[].formId from Get Many)',
|
|
2417
|
+
},
|
|
2418
|
+
{
|
|
2419
|
+
displayName: 'Auto-Send Enabled',
|
|
2420
|
+
name: 'leadFormAutoSendEnabled',
|
|
2421
|
+
type: 'boolean',
|
|
2422
|
+
displayOptions: { show: { resource: ['leadForm'], operation: ['update'] } },
|
|
2423
|
+
default: false,
|
|
2424
|
+
description: 'Whether new leads of this form get an automatic WhatsApp message',
|
|
2425
|
+
},
|
|
2426
|
+
{
|
|
2427
|
+
displayName: 'Consent Checkbox Key',
|
|
2428
|
+
name: 'leadFormConsentDisclaimerKey',
|
|
2429
|
+
type: 'string',
|
|
2430
|
+
displayOptions: { show: { resource: ['leadForm'], operation: ['update'] } },
|
|
2431
|
+
default: '',
|
|
2432
|
+
description: 'Key of the consent checkbox (forms[].consentCheckboxes[].key) whose answer gates the auto-send. Empty sends null.',
|
|
2433
|
+
},
|
|
2434
|
+
{
|
|
2435
|
+
displayName: 'Template ID',
|
|
2436
|
+
name: 'leadFormTemplateId',
|
|
2437
|
+
type: 'string',
|
|
2438
|
+
displayOptions: { show: { resource: ['leadForm'], operation: ['update'] } },
|
|
2439
|
+
default: '',
|
|
2440
|
+
description: 'APPROVED template to auto-send (official numbers only; templates[] from Get Many). Empty sends null.',
|
|
2441
|
+
},
|
|
2442
|
+
{
|
|
2443
|
+
displayName: 'Free Text',
|
|
2444
|
+
name: 'leadFormFreeText',
|
|
2445
|
+
type: 'string',
|
|
2446
|
+
typeOptions: { rows: 4 },
|
|
2447
|
+
displayOptions: { show: { resource: ['leadForm'], operation: ['update'] } },
|
|
2448
|
+
default: '',
|
|
2449
|
+
description: 'Message to auto-send on a non-official number, with {{placeholders}} (max 4096). Empty sends null.',
|
|
2450
|
+
},
|
|
2451
|
+
{
|
|
2452
|
+
displayName: 'Variable Map (JSON)',
|
|
2453
|
+
name: 'leadFormVariableMap',
|
|
2454
|
+
type: 'json',
|
|
2455
|
+
displayOptions: { show: { resource: ['leadForm'], operation: ['update'] } },
|
|
2456
|
+
default: '',
|
|
2457
|
+
description: 'Value of each template / free-text variable: {"1": {"source": "field", "key": "full_name"}, "2": {"source": "static", "value": "Acme"}}. Empty leaves it out (the API stores {}).',
|
|
2458
|
+
},
|
|
2459
|
+
{
|
|
2460
|
+
displayName: 'Form Name',
|
|
2461
|
+
name: 'leadFormName',
|
|
2462
|
+
type: 'string',
|
|
2463
|
+
displayOptions: { show: { resource: ['leadForm'], operation: ['update'] } },
|
|
2464
|
+
default: '',
|
|
2465
|
+
description: 'Optional display label (max 255)',
|
|
2466
|
+
},
|
|
2467
|
+
// ----------------------------------
|
|
1975
2468
|
// Remote Pairing Operations
|
|
1976
2469
|
// ----------------------------------
|
|
1977
2470
|
{
|