@pilot-status/sdk 0.15.0 → 0.17.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 +54 -0
- package/README.md +48 -1
- package/dist/client.d.ts +9 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +12 -0
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/resources/ads.d.ts +40 -0
- package/dist/resources/ads.d.ts.map +1 -0
- package/dist/resources/ads.js +67 -0
- package/dist/resources/ads.js.map +1 -0
- package/dist/resources/lead-pages.d.ts +44 -0
- package/dist/resources/lead-pages.d.ts.map +1 -0
- package/dist/resources/lead-pages.js +87 -0
- package/dist/resources/lead-pages.js.map +1 -0
- package/dist/resources/messages.d.ts +13 -2
- package/dist/resources/messages.d.ts.map +1 -1
- package/dist/resources/messages.js +23 -1
- package/dist/resources/messages.js.map +1 -1
- package/dist/resources/referrals.d.ts +32 -0
- package/dist/resources/referrals.d.ts.map +1 -0
- package/dist/resources/referrals.js +55 -0
- package/dist/resources/referrals.js.map +1 -0
- package/dist/resources/workspace.d.ts +8 -10
- package/dist/resources/workspace.d.ts.map +1 -1
- package/dist/resources/workspace.js +8 -10
- package/dist/resources/workspace.js.map +1 -1
- package/dist/types.d.ts +401 -7
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +3 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/resources/messages.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/resources/messages.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAqBzC,MAAM,OAAO,gBAAgB;IAClB,KAAK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AAK,EAAE,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { HttpClient } from "../http.js";
|
|
2
|
+
import type { ReferralListParams, ReferralListResult, ReferralSummaryParams, ReferralSummaryResult } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Click-to-WhatsApp (CTWA) ad attribution (`GET /v1/referrals`): inbound messages of one
|
|
5
|
+
* number that arrived from a Meta ad or post. In practice only official (Meta Cloud API)
|
|
6
|
+
* numbers have referrals.
|
|
7
|
+
*
|
|
8
|
+
* Acts on ONE number: a number-scoped key, or an account-wide key sent with
|
|
9
|
+
* `whatsappNumberId` (the `x-whatsapp-number-id` header) — without it an account-wide key
|
|
10
|
+
* gets 403 `TENANT_SCOPE_NOT_ALLOWED`. Needs `chat:read`.
|
|
11
|
+
*/
|
|
12
|
+
export declare class ReferralsResource {
|
|
13
|
+
#private;
|
|
14
|
+
constructor(http: HttpClient);
|
|
15
|
+
/**
|
|
16
|
+
* Ad-sourced inbound messages, newest first. Meta attaches the referral to the FIRST
|
|
17
|
+
* message of a conversation only, so each row amounts to one conversation started by
|
|
18
|
+
* that ad.
|
|
19
|
+
*
|
|
20
|
+
* On a RELAY_ONLY number a row keeps `referral.sourceId`/`sourceType` and the resolved
|
|
21
|
+
* names, while `ctwaClid`, the ad copy and the message content come back `null` with
|
|
22
|
+
* `redacted: true`; the page then carries `notice`.
|
|
23
|
+
*/
|
|
24
|
+
list(params?: ReferralListParams): Promise<ReferralListResult>;
|
|
25
|
+
/**
|
|
26
|
+
* CTWA traffic grouped by ad/post, ordered by distinct conversations desc. Capped at
|
|
27
|
+
* 200 ads: when `truncated` is `true` the answer is PARTIAL — narrow the window with
|
|
28
|
+
* `startDate`/`endDate`.
|
|
29
|
+
*/
|
|
30
|
+
summary(params?: ReferralSummaryParams): Promise<ReferralSummaryResult>;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=referrals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"referrals.d.ts","sourceRoot":"","sources":["../../src/resources/referrals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAErB;;;;;;;;GAQG;AACH,qBAAa,iBAAiB;;gBAGhB,IAAI,EAAE,UAAU;IAI5B;;;;;;;;OAQG;IACG,IAAI,CAAC,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAepE;;;;OAIG;IACG,OAAO,CAAC,MAAM,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAU9E"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { compact } from "../internal.js";
|
|
2
|
+
/**
|
|
3
|
+
* Click-to-WhatsApp (CTWA) ad attribution (`GET /v1/referrals`): inbound messages of one
|
|
4
|
+
* number that arrived from a Meta ad or post. In practice only official (Meta Cloud API)
|
|
5
|
+
* numbers have referrals.
|
|
6
|
+
*
|
|
7
|
+
* Acts on ONE number: a number-scoped key, or an account-wide key sent with
|
|
8
|
+
* `whatsappNumberId` (the `x-whatsapp-number-id` header) — without it an account-wide key
|
|
9
|
+
* gets 403 `TENANT_SCOPE_NOT_ALLOWED`. Needs `chat:read`.
|
|
10
|
+
*/
|
|
11
|
+
export class ReferralsResource {
|
|
12
|
+
#http;
|
|
13
|
+
constructor(http) {
|
|
14
|
+
this.#http = http;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Ad-sourced inbound messages, newest first. Meta attaches the referral to the FIRST
|
|
18
|
+
* message of a conversation only, so each row amounts to one conversation started by
|
|
19
|
+
* that ad.
|
|
20
|
+
*
|
|
21
|
+
* On a RELAY_ONLY number a row keeps `referral.sourceId`/`sourceType` and the resolved
|
|
22
|
+
* names, while `ctwaClid`, the ad copy and the message content come back `null` with
|
|
23
|
+
* `redacted: true`; the page then carries `notice`.
|
|
24
|
+
*/
|
|
25
|
+
async list(params) {
|
|
26
|
+
return this.#http.requestJson({
|
|
27
|
+
method: "GET",
|
|
28
|
+
path: "/v1/referrals",
|
|
29
|
+
query: compact({
|
|
30
|
+
sourceId: params?.sourceId,
|
|
31
|
+
sourceType: params?.sourceType,
|
|
32
|
+
startDate: params?.startDate,
|
|
33
|
+
endDate: params?.endDate,
|
|
34
|
+
page: params?.page,
|
|
35
|
+
pageSize: params?.pageSize,
|
|
36
|
+
}),
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* CTWA traffic grouped by ad/post, ordered by distinct conversations desc. Capped at
|
|
41
|
+
* 200 ads: when `truncated` is `true` the answer is PARTIAL — narrow the window with
|
|
42
|
+
* `startDate`/`endDate`.
|
|
43
|
+
*/
|
|
44
|
+
async summary(params) {
|
|
45
|
+
return this.#http.requestJson({
|
|
46
|
+
method: "GET",
|
|
47
|
+
path: "/v1/referrals/summary",
|
|
48
|
+
query: compact({
|
|
49
|
+
startDate: params?.startDate,
|
|
50
|
+
endDate: params?.endDate,
|
|
51
|
+
}),
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=referrals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"referrals.js","sourceRoot":"","sources":["../../src/resources/referrals.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAQzC;;;;;;;;GAQG;AACH,MAAM,OAAO,iBAAiB;IACnB,KAAK,CAAa;IAE3B,YAAY,IAAgB;QAC1B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,IAAI,CAAC,MAA2B;QACpC,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAqB;YAChD,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,eAAe;YACrB,KAAK,EAAE,OAAO,CAAC;gBACb,QAAQ,EAAE,MAAM,EAAE,QAAQ;gBAC1B,UAAU,EAAE,MAAM,EAAE,UAAU;gBAC9B,SAAS,EAAE,MAAM,EAAE,SAAS;gBAC5B,OAAO,EAAE,MAAM,EAAE,OAAO;gBACxB,IAAI,EAAE,MAAM,EAAE,IAAI;gBAClB,QAAQ,EAAE,MAAM,EAAE,QAAQ;aAC3B,CAAC;SACH,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,OAAO,CAAC,MAA8B;QAC1C,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAwB;YACnD,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,uBAAuB;YAC7B,KAAK,EAAE,OAAO,CAAC;gBACb,SAAS,EAAE,MAAM,EAAE,SAAS;gBAC5B,OAAO,EAAE,MAAM,EAAE,OAAO;aACzB,CAAC;SACH,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -26,18 +26,16 @@ export declare class WorkspaceMembersResource {
|
|
|
26
26
|
* `requestJson` hands the parsed body straight back. Without the unwrap below,
|
|
27
27
|
* this method resolved to that object while claiming to be an array, so the
|
|
28
28
|
* first `.map()` a caller wrote threw `map is not a function`. Use
|
|
29
|
-
* {@link listWithSeats} when
|
|
29
|
+
* {@link listWithSeats} when `seatsUsed` matters.
|
|
30
30
|
*/
|
|
31
31
|
list(): Promise<WorkspaceMember[]>;
|
|
32
32
|
/**
|
|
33
|
-
* The same call as {@link list}, returning the route's body verbatim so
|
|
34
|
-
*
|
|
33
|
+
* The same call as {@link list}, returning the route's body verbatim so
|
|
34
|
+
* `seatsUsed` / `seatLimit` are not thrown away.
|
|
35
35
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* invites still inside their window — an invite holds its seat, otherwise the
|
|
40
|
-
* cap would be bypassable by mass-inviting.
|
|
36
|
+
* Members are unlimited on every plan: `seatLimit` is `null` and inviting is
|
|
37
|
+
* never refused for capacity. `seatsUsed` is informational — ACTIVE members
|
|
38
|
+
* plus PENDING invites still inside their window.
|
|
41
39
|
*/
|
|
42
40
|
listWithSeats(): Promise<WorkspaceMemberList>;
|
|
43
41
|
}
|
|
@@ -49,8 +47,8 @@ export declare class WorkspaceResource {
|
|
|
49
47
|
/**
|
|
50
48
|
* `GET /v1/workspace` — `{ id, name, plan, seatsUsed, seatLimit }`.
|
|
51
49
|
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
50
|
+
* Members are unlimited on every plan, so `seatLimit` is `null`. `seatsUsed` is
|
|
51
|
+
* informational: ACTIVE members plus PENDING invites still inside their window.
|
|
54
52
|
*/
|
|
55
53
|
get(): Promise<WorkspaceDetail>;
|
|
56
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../src/resources/workspace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEzF;;;;;;;;;;GAUG;AACH,qBAAa,wBAAwB;;gBAGrB,IAAI,EAAE,UAAU;IAI5B;;;;;;;;;;;;;OAaG;IACG,IAAI,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;IAKxC
|
|
1
|
+
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../src/resources/workspace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEzF;;;;;;;;;;GAUG;AACH,qBAAa,wBAAwB;;gBAGrB,IAAI,EAAE,UAAU;IAI5B;;;;;;;;;;;;;OAaG;IACG,IAAI,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;IAKxC;;;;;;;OAOG;IACG,aAAa,IAAI,OAAO,CAAC,mBAAmB,CAAC;CAMtD;AAED,wDAAwD;AACxD,qBAAa,iBAAiB;;IAE1B,QAAQ,CAAC,OAAO,EAAE,wBAAwB,CAAC;gBAE/B,IAAI,EAAE,UAAU;IAK5B;;;;;OAKG;IACG,GAAG,IAAI,OAAO,CAAC,eAAe,CAAC;CAMxC"}
|
|
@@ -26,21 +26,19 @@ export class WorkspaceMembersResource {
|
|
|
26
26
|
* `requestJson` hands the parsed body straight back. Without the unwrap below,
|
|
27
27
|
* this method resolved to that object while claiming to be an array, so the
|
|
28
28
|
* first `.map()` a caller wrote threw `map is not a function`. Use
|
|
29
|
-
* {@link listWithSeats} when
|
|
29
|
+
* {@link listWithSeats} when `seatsUsed` matters.
|
|
30
30
|
*/
|
|
31
31
|
async list() {
|
|
32
32
|
const page = await this.listWithSeats();
|
|
33
33
|
return page.members;
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
|
-
* The same call as {@link list}, returning the route's body verbatim so
|
|
37
|
-
*
|
|
36
|
+
* The same call as {@link list}, returning the route's body verbatim so
|
|
37
|
+
* `seatsUsed` / `seatLimit` are not thrown away.
|
|
38
38
|
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* invites still inside their window — an invite holds its seat, otherwise the
|
|
43
|
-
* cap would be bypassable by mass-inviting.
|
|
39
|
+
* Members are unlimited on every plan: `seatLimit` is `null` and inviting is
|
|
40
|
+
* never refused for capacity. `seatsUsed` is informational — ACTIVE members
|
|
41
|
+
* plus PENDING invites still inside their window.
|
|
44
42
|
*/
|
|
45
43
|
async listWithSeats() {
|
|
46
44
|
return this.#http.requestJson({
|
|
@@ -60,8 +58,8 @@ export class WorkspaceResource {
|
|
|
60
58
|
/**
|
|
61
59
|
* `GET /v1/workspace` — `{ id, name, plan, seatsUsed, seatLimit }`.
|
|
62
60
|
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
61
|
+
* Members are unlimited on every plan, so `seatLimit` is `null`. `seatsUsed` is
|
|
62
|
+
* informational: ACTIVE members plus PENDING invites still inside their window.
|
|
65
63
|
*/
|
|
66
64
|
async get() {
|
|
67
65
|
return this.#http.requestJson({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../src/resources/workspace.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,MAAM,OAAO,wBAAwB;IACxB,KAAK,CAAa;IAE3B,YAAY,IAAgB;QACxB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACtB,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,IAAI;QACN,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;QACxC,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../src/resources/workspace.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,MAAM,OAAO,wBAAwB;IACxB,KAAK,CAAa;IAE3B,YAAY,IAAgB;QACxB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACtB,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,IAAI;QACN,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;QACxC,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,aAAa;QACf,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAsB;YAC/C,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,uBAAuB;SAChC,CAAC,CAAC;IACP,CAAC;CACJ;AAED,wDAAwD;AACxD,MAAM,OAAO,iBAAiB;IACjB,KAAK,CAAa;IAClB,OAAO,CAA2B;IAE3C,YAAY,IAAgB;QACxB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,OAAO,GAAG,IAAI,wBAAwB,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,GAAG;QACL,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAkB;YAC3C,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,eAAe;SACxB,CAAC,CAAC;IACP,CAAC;CACJ"}
|
package/dist/types.d.ts
CHANGED
|
@@ -185,6 +185,27 @@ export type SendMessageInput = {
|
|
|
185
185
|
*/
|
|
186
186
|
markRead?: boolean;
|
|
187
187
|
};
|
|
188
|
+
/**
|
|
189
|
+
* Per-call options of `messages.send()` — they travel as HTTP headers, never in the body.
|
|
190
|
+
*/
|
|
191
|
+
export type SendMessageOptions = {
|
|
192
|
+
/**
|
|
193
|
+
* Sent as the `Idempotency-Key` header (optional; ≤255 chars, no control characters,
|
|
194
|
+
* else 400 `IDEMPOTENCY_KEY_INVALID`). Generate it ONCE per logical message and REUSE
|
|
195
|
+
* THE SAME KEY when retrying after a timeout or network error. Scope is tenant +
|
|
196
|
+
* WhatsApp number + key, for 24 hours:
|
|
197
|
+
*
|
|
198
|
+
* - same key + same body → the stored response of the first accepted (2xx) call is
|
|
199
|
+
* returned and nothing is sent again (response header `Idempotent-Replayed: true`);
|
|
200
|
+
* - same key + DIFFERENT body → 409 `IDEMPOTENCY_KEY_REUSED`;
|
|
201
|
+
* - same key while the first call is still running → 409 `IDEMPOTENCY_KEY_IN_USE`;
|
|
202
|
+
* - only 2xx responses are remembered: an error frees the key, so you can fix the
|
|
203
|
+
* request and retry with the same key.
|
|
204
|
+
*
|
|
205
|
+
* Omitted, the send behaves exactly as before (no deduplication).
|
|
206
|
+
*/
|
|
207
|
+
idempotencyKey?: string;
|
|
208
|
+
};
|
|
188
209
|
export type SendMessageAccepted = {
|
|
189
210
|
id: string;
|
|
190
211
|
correlationId: string;
|
|
@@ -607,6 +628,12 @@ export type ChatHistoryMessage = {
|
|
|
607
628
|
providerTimestamp: string;
|
|
608
629
|
/** When we ingested it. */
|
|
609
630
|
createdAt: string;
|
|
631
|
+
/**
|
|
632
|
+
* Click-to-WhatsApp provenance: set on the FIRST inbound message of a conversation
|
|
633
|
+
* that started from a Meta ad or post, `null` on every other message. See
|
|
634
|
+
* {@link ChatReferral} and `referrals.list()`.
|
|
635
|
+
*/
|
|
636
|
+
referral?: ChatReferral | null;
|
|
610
637
|
/**
|
|
611
638
|
* Present (and `true`) when the number's PII policy hides this row's content:
|
|
612
639
|
* text, media and peer identity come back `null` but the envelope is kept.
|
|
@@ -1226,6 +1253,365 @@ export type LeadGetResult = {
|
|
|
1226
1253
|
lead: Lead;
|
|
1227
1254
|
notice?: string;
|
|
1228
1255
|
};
|
|
1256
|
+
/**
|
|
1257
|
+
* Click-to-WhatsApp (CTWA) provenance of an inbound message.
|
|
1258
|
+
*
|
|
1259
|
+
* ⚠️ A COPY of `ChatReferralDTO` in the monorepo (`apps/backend/src/lib/chat/referral.ts`);
|
|
1260
|
+
* nothing links them at build time.
|
|
1261
|
+
*
|
|
1262
|
+
* Redaction is SPLIT, not all-or-nothing: on a redacted row `sourceId`/`sourceType` and
|
|
1263
|
+
* the resolved names stay (they identify a creative and the advertiser's own labels, not
|
|
1264
|
+
* a person), while `ctwaClid` and the ad copy come back `null` and `redacted: true` is set.
|
|
1265
|
+
*/
|
|
1266
|
+
export type ChatReferral = {
|
|
1267
|
+
/**
|
|
1268
|
+
* Meta's AD (or post) id — the STABLE identity of the ad. Names are editable in Meta,
|
|
1269
|
+
* so group and match ads by this id, never by name.
|
|
1270
|
+
*/
|
|
1271
|
+
sourceId: string | null;
|
|
1272
|
+
/** `"ad"` | `"post"`, as Meta reports it. */
|
|
1273
|
+
sourceType: string | null;
|
|
1274
|
+
sourceUrl: string | null;
|
|
1275
|
+
headline: string | null;
|
|
1276
|
+
body: string | null;
|
|
1277
|
+
mediaType: string | null;
|
|
1278
|
+
imageUrl: string | null;
|
|
1279
|
+
videoUrl: string | null;
|
|
1280
|
+
thumbnailUrl: string | null;
|
|
1281
|
+
/** Per-click identifier tied to the person — `null` on a redacted row. */
|
|
1282
|
+
ctwaClid: string | null;
|
|
1283
|
+
/**
|
|
1284
|
+
* Names resolved through Meta's Marketing API — only for ad accounts the advertiser
|
|
1285
|
+
* has shared with the Pilot Status business portfolio as a partner (`ads_read`).
|
|
1286
|
+
* `null` when unresolved; see {@link namesResolvedAt}.
|
|
1287
|
+
*/
|
|
1288
|
+
adName: string | null;
|
|
1289
|
+
adsetId: string | null;
|
|
1290
|
+
adsetName: string | null;
|
|
1291
|
+
campaignId: string | null;
|
|
1292
|
+
campaignName: string | null;
|
|
1293
|
+
/**
|
|
1294
|
+
* ISO-8601. Three states: `null` = never resolved (ad account not shared yet, or the
|
|
1295
|
+
* click just arrived); set WITH names = a snapshot taken at that instant; set WITHOUT
|
|
1296
|
+
* names = Meta returned nothing (ad deleted, or the grant is missing / revoked).
|
|
1297
|
+
*/
|
|
1298
|
+
namesResolvedAt: string | null;
|
|
1299
|
+
redacted?: true;
|
|
1300
|
+
};
|
|
1301
|
+
export type ReferralListParams = {
|
|
1302
|
+
/** Only this ad/post id. */
|
|
1303
|
+
sourceId?: string;
|
|
1304
|
+
/** Only paid ads or organic posts. Any other value answers 400 `INVALID_SOURCE_TYPE`. */
|
|
1305
|
+
sourceType?: "ad" | "post";
|
|
1306
|
+
/** ISO 8601. Filters `providerTimestamp`, i.e. when the message happened. */
|
|
1307
|
+
startDate?: string;
|
|
1308
|
+
/** ISO 8601. Must be >= `startDate`, else 400 `INVALID_DATE_RANGE`. */
|
|
1309
|
+
endDate?: string;
|
|
1310
|
+
page?: number;
|
|
1311
|
+
/** Default 30, max 100. */
|
|
1312
|
+
pageSize?: number;
|
|
1313
|
+
};
|
|
1314
|
+
/** An inbound message that arrived from a Click-to-WhatsApp ad or post. */
|
|
1315
|
+
export type ReferralMessage = Omit<ChatHistoryMessage, "referral"> & {
|
|
1316
|
+
referral: ChatReferral;
|
|
1317
|
+
};
|
|
1318
|
+
export type ReferralListResult = {
|
|
1319
|
+
/**
|
|
1320
|
+
* Newest first. Meta attaches the referral to the FIRST message of a conversation
|
|
1321
|
+
* only, so each row amounts to one conversation started by that ad.
|
|
1322
|
+
*/
|
|
1323
|
+
referrals: ReferralMessage[];
|
|
1324
|
+
total: number;
|
|
1325
|
+
page: number;
|
|
1326
|
+
pageSize: number;
|
|
1327
|
+
totalPages: number;
|
|
1328
|
+
/** Only on RELAY_ONLY numbers (`"PII_RELAY_ONLY"`), explaining the redacted rows. */
|
|
1329
|
+
notice?: string;
|
|
1330
|
+
};
|
|
1331
|
+
export type ReferralSummaryParams = {
|
|
1332
|
+
/** ISO 8601. Filters `providerTimestamp`, i.e. when the message happened. */
|
|
1333
|
+
startDate?: string;
|
|
1334
|
+
/** ISO 8601. Must be >= `startDate`, else 400 `INVALID_DATE_RANGE`. */
|
|
1335
|
+
endDate?: string;
|
|
1336
|
+
};
|
|
1337
|
+
/** Click-to-WhatsApp traffic of one ad/post. */
|
|
1338
|
+
export type ReferralSummaryAd = {
|
|
1339
|
+
/** Meta's AD (or post) id — the grouping key. */
|
|
1340
|
+
sourceId: string;
|
|
1341
|
+
sourceType: string | null;
|
|
1342
|
+
/**
|
|
1343
|
+
* DISTINCT conversations — the lead count. Two messages in one conversation are
|
|
1344
|
+
* 1 conversation and 2 `messages`.
|
|
1345
|
+
*/
|
|
1346
|
+
conversations: number;
|
|
1347
|
+
messages: number;
|
|
1348
|
+
/** ISO-8601. */
|
|
1349
|
+
firstAt: string;
|
|
1350
|
+
/** ISO-8601. */
|
|
1351
|
+
lastAt: string;
|
|
1352
|
+
/** From the newest message for this ad (ad copy can be edited). `null` on a RELAY_ONLY number. */
|
|
1353
|
+
lastSourceUrl: string | null;
|
|
1354
|
+
/** From the newest message for this ad. `null` on a RELAY_ONLY number. */
|
|
1355
|
+
lastHeadline: string | null;
|
|
1356
|
+
adName: string | null;
|
|
1357
|
+
adsetId: string | null;
|
|
1358
|
+
adsetName: string | null;
|
|
1359
|
+
campaignId: string | null;
|
|
1360
|
+
campaignName: string | null;
|
|
1361
|
+
/** Same three states as {@link ChatReferral.namesResolvedAt}. */
|
|
1362
|
+
namesResolvedAt: string | null;
|
|
1363
|
+
};
|
|
1364
|
+
export type ReferralSummaryResult = {
|
|
1365
|
+
/** Ordered by `conversations` desc, then `lastAt` desc. */
|
|
1366
|
+
ads: ReferralSummaryAd[];
|
|
1367
|
+
/** Number of entries in `ads`. */
|
|
1368
|
+
total: number;
|
|
1369
|
+
/** The cap on `ads` (200). */
|
|
1370
|
+
limit: number;
|
|
1371
|
+
/**
|
|
1372
|
+
* `true` when more ads matched than `limit`: the answer is PARTIAL. Narrow the window
|
|
1373
|
+
* with `startDate`/`endDate`.
|
|
1374
|
+
*/
|
|
1375
|
+
truncated: boolean;
|
|
1376
|
+
/** Present when `truncated`. */
|
|
1377
|
+
notice?: string;
|
|
1378
|
+
/**
|
|
1379
|
+
* `"PII_RELAY_ONLY"` on a RELAY_ONLY number: counts and names stay correct,
|
|
1380
|
+
* `lastSourceUrl`/`lastHeadline` are `null`.
|
|
1381
|
+
*/
|
|
1382
|
+
piiNotice?: string;
|
|
1383
|
+
};
|
|
1384
|
+
/** An ad account connected to this workspace. */
|
|
1385
|
+
export type LinkedAdAccount = {
|
|
1386
|
+
/** `act_<digits>`. */
|
|
1387
|
+
adAccountId: string;
|
|
1388
|
+
adAccountName: string | null;
|
|
1389
|
+
/** ISO-8601. */
|
|
1390
|
+
linkedAt: string;
|
|
1391
|
+
/**
|
|
1392
|
+
* Whether the partner grant is still in place on Meta's side. `null` = we could not
|
|
1393
|
+
* ask Meta (see `sharingLookup`), NOT "revoked".
|
|
1394
|
+
*/
|
|
1395
|
+
sharingActive: boolean | null;
|
|
1396
|
+
};
|
|
1397
|
+
/**
|
|
1398
|
+
* An ad account shared with the Pilot Status portfolio that provably belongs to this
|
|
1399
|
+
* workspace's own ad traffic, not linked yet. A new workspace gets none — it links by
|
|
1400
|
+
* sending its own `act_` id.
|
|
1401
|
+
*/
|
|
1402
|
+
export type AdAccountCandidate = {
|
|
1403
|
+
adAccountId: string;
|
|
1404
|
+
adAccountName: string | null;
|
|
1405
|
+
/** Meta's numeric account status, passed through (1 = active). */
|
|
1406
|
+
accountStatus: number | null;
|
|
1407
|
+
};
|
|
1408
|
+
export type AdAccountListResult = {
|
|
1409
|
+
linked: LinkedAdAccount[];
|
|
1410
|
+
candidates: AdAccountCandidate[];
|
|
1411
|
+
/**
|
|
1412
|
+
* The Pilot Status business portfolio id — the one the advertiser adds as a PARTNER
|
|
1413
|
+
* (with `ads_read`) of their ad account in Meta Business Manager. `null` when the ads
|
|
1414
|
+
* integration is not configured on this installation.
|
|
1415
|
+
*/
|
|
1416
|
+
partnerBusinessId: string | null;
|
|
1417
|
+
/** `"ok"`, `"unavailable"` (Meta lookup failed) or `"not_configured"`. */
|
|
1418
|
+
sharingLookup: "ok" | "unavailable" | "not_configured";
|
|
1419
|
+
};
|
|
1420
|
+
export type AdAccountLinkResult = {
|
|
1421
|
+
link: {
|
|
1422
|
+
adAccountId: string;
|
|
1423
|
+
adAccountName: string | null;
|
|
1424
|
+
linkedAt: string;
|
|
1425
|
+
};
|
|
1426
|
+
};
|
|
1427
|
+
export type AdAccountUnlinkResult = {
|
|
1428
|
+
unlinked: true;
|
|
1429
|
+
adAccountId: string;
|
|
1430
|
+
};
|
|
1431
|
+
export type AdsSummaryParams = {
|
|
1432
|
+
/**
|
|
1433
|
+
* Restrict to one number. Must be inside the credential's reach, else
|
|
1434
|
+
* 403 `NUMBER_NOT_IN_GRANT`.
|
|
1435
|
+
*/
|
|
1436
|
+
whatsappNumberId?: string;
|
|
1437
|
+
/** ISO 8601. Filters the message time (and the lead's creation time for `leadCount`). */
|
|
1438
|
+
startDate?: string;
|
|
1439
|
+
/** ISO 8601. Must be >= `startDate`, else 400 `INVALID_DATE_RANGE`. */
|
|
1440
|
+
endDate?: string;
|
|
1441
|
+
};
|
|
1442
|
+
/** Click-to-WhatsApp volume of one ad, with its Lead Ads lead count. */
|
|
1443
|
+
export type AdsSummaryAd = ReferralSummaryAd & {
|
|
1444
|
+
/** Leads (Meta Lead Ads) attributed to this ad in the same window. */
|
|
1445
|
+
leadCount: number;
|
|
1446
|
+
};
|
|
1447
|
+
export type AdsSummaryResult = {
|
|
1448
|
+
/** Ordered by `conversations` desc. */
|
|
1449
|
+
ads: AdsSummaryAd[];
|
|
1450
|
+
total: number;
|
|
1451
|
+
/** The cap on `ads` (200). */
|
|
1452
|
+
limit: number;
|
|
1453
|
+
/** `true` = PARTIAL answer; narrow `startDate`/`endDate`. */
|
|
1454
|
+
truncated: boolean;
|
|
1455
|
+
};
|
|
1456
|
+
/** A Facebook Page linked to a WhatsApp number for Meta Lead Ads capture. */
|
|
1457
|
+
export type LeadPageLink = {
|
|
1458
|
+
/** OUR id of the link — the `{pageLinkId}` of the other calls. */
|
|
1459
|
+
pageLinkId: string;
|
|
1460
|
+
pageId: string;
|
|
1461
|
+
pageName: string;
|
|
1462
|
+
whatsappNumberId: string;
|
|
1463
|
+
/** ISO-8601. `null` = Meta is NOT pushing leads for this Page, whatever the link says. */
|
|
1464
|
+
subscribedAt: string | null;
|
|
1465
|
+
/**
|
|
1466
|
+
* Why the subscription is not working: `META_PERMISSION_MISSING`, `META_NOT_FOUND`,
|
|
1467
|
+
* `META_UNAVAILABLE`, `META_NOT_CONFIRMED`, `PAGE_ACCESS_MISSING`, `META_ERROR`,
|
|
1468
|
+
* `NO_OFFICIAL_NUMBER`, `PAGE_NOT_SHARED`, `PAGE_BUSINESS_MISMATCH`. Typed as `string`:
|
|
1469
|
+
* the set can grow.
|
|
1470
|
+
*/
|
|
1471
|
+
subscriptionError: string | null;
|
|
1472
|
+
/** ISO-8601. */
|
|
1473
|
+
linkedAt: string;
|
|
1474
|
+
leadsCount: number;
|
|
1475
|
+
};
|
|
1476
|
+
export type LeadPageCandidate = {
|
|
1477
|
+
pageId: string;
|
|
1478
|
+
pageName: string | null;
|
|
1479
|
+
/** Page tasks our system user still lacks. Empty = ready to link; `null` = could not ask. */
|
|
1480
|
+
missingTasks: string[] | null;
|
|
1481
|
+
};
|
|
1482
|
+
export type LeadPageListResult = {
|
|
1483
|
+
/** Active links, within the credential's number reach. */
|
|
1484
|
+
linked: LeadPageLink[];
|
|
1485
|
+
candidates: LeadPageCandidate[];
|
|
1486
|
+
/** Whether the Lead Ads integration is configured on this installation. */
|
|
1487
|
+
configured: boolean;
|
|
1488
|
+
/** The portfolio the advertiser shares the Page with in Meta Business Manager. */
|
|
1489
|
+
partnerBusinessId: string | null;
|
|
1490
|
+
/** `"ok"`, `"unavailable"` (Meta lookup failed) or `"not_configured"`. */
|
|
1491
|
+
candidatesLookup: "ok" | "unavailable" | "not_configured";
|
|
1492
|
+
/**
|
|
1493
|
+
* `"NO_OFFICIAL_NUMBER"` when the workspace has no official number to prove Page
|
|
1494
|
+
* ownership with (so `candidates` is empty by design), else `null`.
|
|
1495
|
+
*/
|
|
1496
|
+
eligibilityBlocker: string | null;
|
|
1497
|
+
};
|
|
1498
|
+
export type LeadPageLinkInput = {
|
|
1499
|
+
/** The numeric Facebook Page id. */
|
|
1500
|
+
pageId: string;
|
|
1501
|
+
/**
|
|
1502
|
+
* The number that receives the Page's leads. May be omitted only when the credential
|
|
1503
|
+
* reaches exactly one number (a number-bound key, or `whatsappNumberId` on the client).
|
|
1504
|
+
*/
|
|
1505
|
+
whatsappNumberId?: string;
|
|
1506
|
+
};
|
|
1507
|
+
export type LeadPageLinkResult = {
|
|
1508
|
+
link: LeadPageLink;
|
|
1509
|
+
};
|
|
1510
|
+
export type LeadPageUpdateInput = {
|
|
1511
|
+
whatsappNumberId: string;
|
|
1512
|
+
};
|
|
1513
|
+
export type LeadPageUpdateResult = {
|
|
1514
|
+
link: LeadPageLink;
|
|
1515
|
+
/**
|
|
1516
|
+
* `true` = the new number sends a different kind of message (or sits on another WABA)
|
|
1517
|
+
* and every auto-send of this Page's forms was switched OFF.
|
|
1518
|
+
*/
|
|
1519
|
+
autoSendDisabled: boolean;
|
|
1520
|
+
};
|
|
1521
|
+
export type LeadPageUnlinkResult = {
|
|
1522
|
+
unlinked: true;
|
|
1523
|
+
pageLinkId: string;
|
|
1524
|
+
/** Leads of this Page that were ERASED by the unlink. */
|
|
1525
|
+
deletedLeads: number;
|
|
1526
|
+
};
|
|
1527
|
+
export type LeadPageResyncResult = {
|
|
1528
|
+
started: true;
|
|
1529
|
+
pageLinkId: string;
|
|
1530
|
+
/** Present only when the `leadgen` subscription was retried on this call. */
|
|
1531
|
+
subscribedAt?: string | null;
|
|
1532
|
+
/** Present only when the `leadgen` subscription was retried on this call. */
|
|
1533
|
+
subscriptionError?: string | null;
|
|
1534
|
+
};
|
|
1535
|
+
/** Where an auto-send variable takes its value from. */
|
|
1536
|
+
export type LeadVariableSource = {
|
|
1537
|
+
source: "field";
|
|
1538
|
+
key: string;
|
|
1539
|
+
} | {
|
|
1540
|
+
source: "static";
|
|
1541
|
+
value: string;
|
|
1542
|
+
};
|
|
1543
|
+
/** The stored lead configuration of one Instant Form. */
|
|
1544
|
+
export type LeadFormConfig = {
|
|
1545
|
+
formId: string;
|
|
1546
|
+
formName: string | null;
|
|
1547
|
+
consentDisclaimerKey: string | null;
|
|
1548
|
+
autoSendEnabled: boolean;
|
|
1549
|
+
templateId: string | null;
|
|
1550
|
+
freeText: string | null;
|
|
1551
|
+
variableMap: Record<string, LeadVariableSource>;
|
|
1552
|
+
/** ISO-8601. */
|
|
1553
|
+
updatedAt: string;
|
|
1554
|
+
};
|
|
1555
|
+
export type LeadFormQuestion = {
|
|
1556
|
+
key: string;
|
|
1557
|
+
/** Falls back to `key`. */
|
|
1558
|
+
label: string;
|
|
1559
|
+
/** `FULL_NAME`, `EMAIL`, `PHONE`, `CUSTOM`, … */
|
|
1560
|
+
type: string | null;
|
|
1561
|
+
options: {
|
|
1562
|
+
key: string;
|
|
1563
|
+
value: string;
|
|
1564
|
+
}[];
|
|
1565
|
+
};
|
|
1566
|
+
export type LeadForm = {
|
|
1567
|
+
formId: string;
|
|
1568
|
+
formName: string | null;
|
|
1569
|
+
status: string | null;
|
|
1570
|
+
questions: LeadFormQuestion[];
|
|
1571
|
+
consentCheckboxes: {
|
|
1572
|
+
key: string;
|
|
1573
|
+
text: string | null;
|
|
1574
|
+
}[];
|
|
1575
|
+
/** `false` = Meta did not return the consent checkboxes: the list is UNKNOWN, not empty. */
|
|
1576
|
+
consentAvailable: boolean;
|
|
1577
|
+
/** `null` = this form was never configured. */
|
|
1578
|
+
config: LeadFormConfig | null;
|
|
1579
|
+
};
|
|
1580
|
+
export type LeadFormListResult = {
|
|
1581
|
+
/** Live from Meta. */
|
|
1582
|
+
forms: LeadForm[];
|
|
1583
|
+
/** `true` when the Page has more forms than were read. */
|
|
1584
|
+
formsTruncated: boolean;
|
|
1585
|
+
/** Official (Cloud API) numbers auto-send templates only; the others, free text only. */
|
|
1586
|
+
numberIsOfficial: boolean;
|
|
1587
|
+
/** APPROVED templates the link's number can auto-send. Empty on a non-official number. */
|
|
1588
|
+
templates: {
|
|
1589
|
+
id: string;
|
|
1590
|
+
name: string;
|
|
1591
|
+
variables: string[];
|
|
1592
|
+
}[];
|
|
1593
|
+
};
|
|
1594
|
+
/**
|
|
1595
|
+
* `PUT /v1/lead-pages/{pageLinkId}/forms/{formId}` — create or REPLACE the whole config.
|
|
1596
|
+
* ⚠️ A config the API accepts WILL message new leads without a human when
|
|
1597
|
+
* `autoSendEnabled` is `true`.
|
|
1598
|
+
*/
|
|
1599
|
+
export type LeadFormConfigInput = {
|
|
1600
|
+
/** Key of the consent checkbox that gates the auto-send, or `null`. */
|
|
1601
|
+
consentDisclaimerKey: string | null;
|
|
1602
|
+
autoSendEnabled: boolean;
|
|
1603
|
+
/** An APPROVED template (official numbers), or `null`. */
|
|
1604
|
+
templateId: string | null;
|
|
1605
|
+
/** Free text with `{{placeholders}}` (non-official numbers), max 4096, or `null`. */
|
|
1606
|
+
freeText: string | null;
|
|
1607
|
+
/** Value of each template / free-text variable. Defaults to `{}`. */
|
|
1608
|
+
variableMap?: Record<string, LeadVariableSource>;
|
|
1609
|
+
/** Display label, max 255. */
|
|
1610
|
+
formName?: string | null;
|
|
1611
|
+
};
|
|
1612
|
+
export type LeadFormConfigResult = {
|
|
1613
|
+
config: LeadFormConfig;
|
|
1614
|
+
};
|
|
1229
1615
|
/**
|
|
1230
1616
|
* `"META_24H"` = Meta's rule genuinely applies. `"NONE"` = web/unofficial number,
|
|
1231
1617
|
* where the restriction does not exist and `open` is always `true`.
|
|
@@ -1442,9 +1828,16 @@ export type WorkspaceDetail = {
|
|
|
1442
1828
|
/** `null` while the tenant has no name set — the route sends `tenant?.name ?? null`. */
|
|
1443
1829
|
name: string | null;
|
|
1444
1830
|
plan: string;
|
|
1445
|
-
/**
|
|
1831
|
+
/**
|
|
1832
|
+
* Informational: ACTIVE members plus PENDING invites still inside their window.
|
|
1833
|
+
* Nothing caps it — members are unlimited on every plan.
|
|
1834
|
+
*/
|
|
1446
1835
|
seatsUsed: number;
|
|
1447
|
-
|
|
1836
|
+
/**
|
|
1837
|
+
* `null` = unlimited, which is what the API sends on every plan. Typed `number | null`
|
|
1838
|
+
* only because servers that predate unlimited members sent a number.
|
|
1839
|
+
*/
|
|
1840
|
+
seatLimit: number | null;
|
|
1448
1841
|
};
|
|
1449
1842
|
/**
|
|
1450
1843
|
* An active member or a pending invite — the same list, discriminated by `status`.
|
|
@@ -1473,19 +1866,20 @@ export type WorkspaceMember = {
|
|
|
1473
1866
|
joinedAt: string | null;
|
|
1474
1867
|
/** `null` once the invite has been accepted (the token is burned on acceptance). */
|
|
1475
1868
|
inviteExpiresAt: string | null;
|
|
1476
|
-
/** `true` when the invite lapsed: the row survives but
|
|
1869
|
+
/** `true` when the invite lapsed: the row survives but no longer counts in `seatsUsed`. */
|
|
1477
1870
|
inviteExpired: boolean;
|
|
1478
1871
|
};
|
|
1479
1872
|
/**
|
|
1480
1873
|
* The literal body of `GET /v1/workspace/members` — an ENVELOPE, not a bare
|
|
1481
|
-
* array. `seatsUsed`/`seatLimit` are the same
|
|
1482
|
-
* reports
|
|
1483
|
-
*
|
|
1874
|
+
* array. `seatsUsed`/`seatLimit` are the same values `GET /v1/workspace`
|
|
1875
|
+
* reports: `seatsUsed` is informational and `seatLimit` is `null` (unlimited
|
|
1876
|
+
* members, on every plan).
|
|
1484
1877
|
*/
|
|
1485
1878
|
export type WorkspaceMemberList = {
|
|
1486
1879
|
members: WorkspaceMember[];
|
|
1487
1880
|
seatsUsed: number;
|
|
1488
|
-
seatLimit
|
|
1881
|
+
/** `null` = unlimited. See {@link WorkspaceDetail.seatLimit}. */
|
|
1882
|
+
seatLimit: number | null;
|
|
1489
1883
|
};
|
|
1490
1884
|
/**
|
|
1491
1885
|
* Meta's closed set. A value outside it only fails AFTER the trip to the Graph,
|