@pilot-status/sdk 0.15.0 → 0.16.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 +38 -0
- package/README.md +37 -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/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 +380 -7
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,44 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@pilot-status/sdk`.
|
|
4
4
|
|
|
5
|
+
## 0.16.0 - 2026-10-20
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- **`referrals.list()` / `referrals.summary()`** — `GET /v1/referrals` and
|
|
10
|
+
`GET /v1/referrals/summary`, Click-to-WhatsApp ad attribution. `list` filters by
|
|
11
|
+
`sourceId`, `sourceType` (`"ad"` | `"post"`), `startDate`, `endDate`, `page`, `pageSize`
|
|
12
|
+
(max 100) and returns the inbound messages that started a conversation from an ad, each
|
|
13
|
+
with a `referral` block (`ChatReferral`: `sourceId`, ad copy, `ctwaClid`, resolved
|
|
14
|
+
`campaignName` / `adsetName` / `adName` and `namesResolvedAt`). `summary` groups by ad
|
|
15
|
+
(`conversations` = DISTINCT conversations, `messages`), capped at 200 ads with
|
|
16
|
+
`truncated`, `notice?` and `piiNotice?`. `sourceId` is the stable identity; names are
|
|
17
|
+
filled only when the advertiser shared the ad account with Pilot Status. Acts on one
|
|
18
|
+
number and needs `chat:read`: a number-scoped key, or an account-wide key with
|
|
19
|
+
`whatsappNumberId` (else 403 `TENANT_SCOPE_NOT_ALLOWED`).
|
|
20
|
+
- **`ads`** — `listAccounts()` (`GET /v1/ads/accounts`), `linkAccount(adAccountId)`
|
|
21
|
+
(`POST`, 201), `unlinkAccount(adAccountId)` (`DELETE`, soft) — account-wide key,
|
|
22
|
+
`integrations:manage`; and `summary({ whatsappNumberId?, startDate?, endDate? })`
|
|
23
|
+
(`GET /v1/ads/summary`, `analytics:read`): ads volume with names and `leadCount`,
|
|
24
|
+
workspace-wide on an account-wide key without a number.
|
|
25
|
+
- **`leadPages`** — `list()`, `link({ pageId, whatsappNumberId? })` (201), `update(id,
|
|
26
|
+
{ whatsappNumberId })` (→ `autoSendDisabled`), `unlink(id)`, `listForms(id)`,
|
|
27
|
+
`updateForm(id, formId, config)` (PUT, replaces the whole config), `resync(id)` (202;
|
|
28
|
+
429 `RESYNC_COOLDOWN` with `retryAfterSeconds`). `integrations:manage`; a credential
|
|
29
|
+
bound to one number sees only its links. ⚠️ `unlink` ERASES every lead captured through
|
|
30
|
+
the Page (`deletedLeads`) and its form configs.
|
|
31
|
+
- Types for all of the above, and an optional `referral` on `ChatHistoryMessage` (the
|
|
32
|
+
history endpoint already returned it).
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
|
|
36
|
+
- **`seatLimit` is now `number | null`** on `WorkspaceDetail` (`workspace.get()`) and
|
|
37
|
+
`WorkspaceMemberList` (`workspace.members.listWithSeats()`). Members are unlimited on
|
|
38
|
+
every plan: the API sends `seatLimit: null` and no longer answers 409
|
|
39
|
+
`SEAT_LIMIT_REACHED`. `seatsUsed` stays, as information only (ACTIVE members plus PENDING
|
|
40
|
+
invites in their window). TypeScript callers that did arithmetic on `seatLimit` now have
|
|
41
|
+
to handle `null`.
|
|
42
|
+
|
|
5
43
|
## 0.15.0 - 2026-10-19
|
|
6
44
|
|
|
7
45
|
### Added
|
package/README.md
CHANGED
|
@@ -83,7 +83,7 @@ for (const k of keys) {
|
|
|
83
83
|
|
|
84
84
|
```ts
|
|
85
85
|
const ws = await client.workspace.get();
|
|
86
|
-
console.log(ws.seatsUsed
|
|
86
|
+
console.log(ws.seatsUsed); // informational: members are unlimited, `ws.seatLimit` is null
|
|
87
87
|
|
|
88
88
|
const members = await client.workspace.members.list(); // ACTIVE + PENDING
|
|
89
89
|
```
|
|
@@ -275,6 +275,42 @@ const { lead } = await client.leads.get(leads[0].id); // 404 LEAD_NOT_FOUND for
|
|
|
275
275
|
// On a RELAY_ONLY number a lead keeps ids, attribution and status, with `redacted: true`
|
|
276
276
|
// and fullName/email/phone/fields blanked; the response then carries `notice`.
|
|
277
277
|
|
|
278
|
+
// Click-to-WhatsApp ad attribution (`chat:read`). Acts on ONE number: a number-scoped key,
|
|
279
|
+
// or an account-wide key with `whatsappNumberId` set (else 403 TENANT_SCOPE_NOT_ALLOWED).
|
|
280
|
+
// Filters: sourceId, sourceType ("ad" | "post"), startDate, endDate, page, pageSize.
|
|
281
|
+
const { referrals } = await client.referrals.list({ sourceType: "ad", pageSize: 100 });
|
|
282
|
+
// Each row is the FIRST inbound of a conversation started by the ad; `referral.sourceId`
|
|
283
|
+
// is the stable ad id, `referral.campaignName`/`adsetName`/`adName` are filled only when
|
|
284
|
+
// the advertiser shared the ad account with Pilot Status (see `namesResolvedAt`).
|
|
285
|
+
const { ads, truncated } = await client.referrals.summary({ startDate: "2026-10-01T00:00:00Z" });
|
|
286
|
+
// `conversations` = distinct conversations (the lead count), `messages` = messages.
|
|
287
|
+
// Capped at 200 ads: `truncated: true` means a PARTIAL answer — narrow the dates.
|
|
288
|
+
|
|
289
|
+
// Ads configuration. Ad accounts (account-wide key, `integrations:manage`): access comes
|
|
290
|
+
// from the advertiser adding `partnerBusinessId` as a PARTNER (ads_read) of the ad account.
|
|
291
|
+
const { linked, candidates, partnerBusinessId } = await client.ads.listAccounts();
|
|
292
|
+
await client.ads.linkAccount("act_1234567890"); // 409 AD_ACCOUNT_NOT_PROVEN / AD_ACCOUNT_NOT_SHARED
|
|
293
|
+
await client.ads.unlinkAccount("act_1234567890");
|
|
294
|
+
// Ads volume with names and `leadCount` (`analytics:read`). An account-wide key without
|
|
295
|
+
// `whatsappNumberId` reports the whole workspace; the param narrows it to one number.
|
|
296
|
+
const report = await client.ads.summary({ startDate: "2026-10-01T00:00:00Z" });
|
|
297
|
+
|
|
298
|
+
// Lead Ads Pages and Instant Forms (`integrations:manage`).
|
|
299
|
+
const pages = await client.leadPages.list();
|
|
300
|
+
const { link } = await client.leadPages.link({ pageId: "1234567890", whatsappNumberId: "wn_1" });
|
|
301
|
+
const { autoSendDisabled } = await client.leadPages.update(link.pageLinkId, { whatsappNumberId: "wn_2" });
|
|
302
|
+
await client.leadPages.resync(link.pageLinkId); // 202; 429 RESYNC_COOLDOWN carries retryAfterSeconds
|
|
303
|
+
const { forms, templates } = await client.leadPages.listForms(link.pageLinkId);
|
|
304
|
+
await client.leadPages.updateForm(link.pageLinkId, forms[0].formId, {
|
|
305
|
+
consentDisclaimerKey: null,
|
|
306
|
+
autoSendEnabled: true, // new leads get a WhatsApp message without a human
|
|
307
|
+
templateId: templates[0].id, // official numbers; others use `freeText`
|
|
308
|
+
freeText: null,
|
|
309
|
+
variableMap: { "1": { source: "field", key: "full_name" } },
|
|
310
|
+
});
|
|
311
|
+
// ⚠️ unlink ERASES every lead captured through the Page and its form configs.
|
|
312
|
+
const { deletedLeads } = await client.leadPages.unlink(link.pageLinkId);
|
|
313
|
+
|
|
278
314
|
// Can I send free-form right now?
|
|
279
315
|
const w = await client.serviceWindow.get("+5511999999999");
|
|
280
316
|
// Branch on windowType, not on `open`: web numbers always report open: true
|
package/dist/client.d.ts
CHANGED
|
@@ -5,6 +5,9 @@ import { CallsResource } from "./resources/calls.js";
|
|
|
5
5
|
import { ChatwootResource } from "./resources/chatwoot.js";
|
|
6
6
|
import { ConversationsResource } from "./resources/conversations.js";
|
|
7
7
|
import { LeadsResource } from "./resources/leads.js";
|
|
8
|
+
import { ReferralsResource } from "./resources/referrals.js";
|
|
9
|
+
import { AdsResource } from "./resources/ads.js";
|
|
10
|
+
import { LeadPagesResource } from "./resources/lead-pages.js";
|
|
8
11
|
import { EmbedResource } from "./resources/embed.js";
|
|
9
12
|
import { FlowsResource } from "./resources/flows.js";
|
|
10
13
|
import { MessagesResource } from "./resources/messages.js";
|
|
@@ -62,6 +65,12 @@ export declare class PilotStatusClient {
|
|
|
62
65
|
readonly conversations: ConversationsResource;
|
|
63
66
|
/** Meta Lead Ads leads (`/v1/leads`) — number-scoped key only. */
|
|
64
67
|
readonly leads: LeadsResource;
|
|
68
|
+
/** Click-to-WhatsApp ad attribution (`/v1/referrals`) — acts on one number. */
|
|
69
|
+
readonly referrals: ReferralsResource;
|
|
70
|
+
/** Meta ad accounts and the ads volume report (`/v1/ads/*`). */
|
|
71
|
+
readonly ads: AdsResource;
|
|
72
|
+
/** Meta Lead Ads Pages and Instant Form configuration (`/v1/lead-pages/*`). */
|
|
73
|
+
readonly leadPages: LeadPagesResource;
|
|
65
74
|
readonly serviceWindow: ServiceWindowResource;
|
|
66
75
|
readonly meta: MetaResource;
|
|
67
76
|
readonly webhooks: WebhooksResource;
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,eAAe,EA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AE,mBAAmB,CAAC;IAC1C,QAAQ,CAAC,aAAa,EAAE,qBAAqB,CAAC;IAC9C,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,qBAAqB,CAAC;IAC9C,kEAAkE;IAClE,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,+EAA+E;IAC/E,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC;IACtC,gEAAgE;IAChE,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC;IAC1B,+EAA+E;IAC/E,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC;IACtC,QAAQ,CAAC,aAAa,EAAE,qBAAqB,CAAC;IAC9C,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,YAAY,EAAE,oBAAoB,CAAC;IAC5C,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC;IACtC,kEAAkE;IAClE,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAC;gBAI5B,OAAO,EAAE,wBAAwB;IAkD7C;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,gBAAgB,EAAE,MAAM,GAAG,iBAAiB;CAGxD"}
|
package/dist/client.js
CHANGED
|
@@ -5,6 +5,9 @@ import { CallsResource } from "./resources/calls.js";
|
|
|
5
5
|
import { ChatwootResource } from "./resources/chatwoot.js";
|
|
6
6
|
import { ConversationsResource } from "./resources/conversations.js";
|
|
7
7
|
import { LeadsResource } from "./resources/leads.js";
|
|
8
|
+
import { ReferralsResource } from "./resources/referrals.js";
|
|
9
|
+
import { AdsResource } from "./resources/ads.js";
|
|
10
|
+
import { LeadPagesResource } from "./resources/lead-pages.js";
|
|
8
11
|
import { EmbedResource } from "./resources/embed.js";
|
|
9
12
|
import { FlowsResource } from "./resources/flows.js";
|
|
10
13
|
import { MessagesResource } from "./resources/messages.js";
|
|
@@ -39,6 +42,12 @@ export class PilotStatusClient {
|
|
|
39
42
|
conversations;
|
|
40
43
|
/** Meta Lead Ads leads (`/v1/leads`) — number-scoped key only. */
|
|
41
44
|
leads;
|
|
45
|
+
/** Click-to-WhatsApp ad attribution (`/v1/referrals`) — acts on one number. */
|
|
46
|
+
referrals;
|
|
47
|
+
/** Meta ad accounts and the ads volume report (`/v1/ads/*`). */
|
|
48
|
+
ads;
|
|
49
|
+
/** Meta Lead Ads Pages and Instant Form configuration (`/v1/lead-pages/*`). */
|
|
50
|
+
leadPages;
|
|
42
51
|
serviceWindow;
|
|
43
52
|
meta;
|
|
44
53
|
webhooks;
|
|
@@ -79,6 +88,9 @@ export class PilotStatusClient {
|
|
|
79
88
|
this.calls = new CallsResource(http);
|
|
80
89
|
this.conversations = new ConversationsResource(http);
|
|
81
90
|
this.leads = new LeadsResource(http);
|
|
91
|
+
this.referrals = new ReferralsResource(http);
|
|
92
|
+
this.ads = new AdsResource(http);
|
|
93
|
+
this.leadPages = new LeadPagesResource(http);
|
|
82
94
|
this.serviceWindow = new ServiceWindowResource(http);
|
|
83
95
|
this.meta = new MetaResource(http);
|
|
84
96
|
this.webhooks = new WebhooksResource(http);
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CA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,CAAC;IACvE,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export { NUMBER_STATUS_FAILURE_CODES, KNOWN_MESSAGE_ORIGINS } from "./types.js";
|
|
|
10
10
|
export { flowJsonValidationErrors } from "./resources/flows.js";
|
|
11
11
|
/** Phone lines: the resource classes, the `data:` URI helper and the `Content-Disposition` parser. */
|
|
12
12
|
export { PhoneLinesResource, PhoneLineVerificationResource, toDataUri, parseContentDispositionFileName, } from "./resources/phone-lines.js";
|
|
13
|
-
export type { MessageStatus, Button, ButtonType, MarketingOptions, SendMessageInput, SendMessageHeader, SendMessageAccepted, MessageDetails, MessageMetaPricing, MessageLogDirection, MessageLogEntry, KnownMessageOrigin, MessageListParams, MessageListResult, GroupMessagesParams, GroupMessagesResult, UnreadMessagesParams, UnreadMessagesResult, MarkReadResult, TypingState, TypingInput, TypingResult, DashboardStats, ApiKeyCreated, ApiKeyListItem, ApiKeyListResult, NumberApiKeyReveal, RegeneratedNumberKey, WhatsAppNumberInstance, WhatsAppNumberListItem, NumberListItemApiKeyRef, NumberCoexistence, CreateNumberInput, CreateNumberResult, CreateMetaNumberInput, CheckNumbersInput, CheckNumbersResult, NumberConnectResult, NumberStatusResult, NumberStatusFailureCode, NumberDetail, NumberSettings, NumberSettingsInput, NumberSettingsSync, NumberPiiInput, NumberLogoutResult, NumberRestoreResult, NumberPurgeResult, NumberPayResult, NumberPayErrorBody, UpdateNumberInput, UpdateNumberResult, ChatHistoryMedia, ChatHistoryMessage, MessageHistoryParams, MessageHistoryResult, NumberLinkBundle, RemotePairingInput, RemotePairingResult, RemotePairingInfo, RemotePairingStatus, RemotePairingConnectResult, CancelMessagesResult, DeleteNumberResult, TemplateCategory, TemplateExamples, TemplateListItem, TemplateDetail, CreateTemplateInput, UpdateTemplateInput, TemplateDeleteResult, FlowCategory, Flow, FlowListParams, FlowListResult, CreateFlowInput, FlowCreated, UpdateFlowInput, FlowUpdateResult, FlowDeleteResult, FlowJsonUploadResult, FlowJsonValidationFailure, FlowPublishInput, FlowPublishResult, FlowDeprecateInput, FlowDeprecateResult, FlowResponse, FlowResponseMedia, FlowSubmittedExchange, FlowResponseListParams, FlowResponseListResult, FlowEndpointKeyMetaStatus, FlowEndpointKeyStatus, FlowEndpointKeyRotateInput, FlowEndpointKeyRotateResult, GroupListItem, GroupDetail, GroupParticipant, CreateGroupInput, GroupActionResult, GroupInviteResult, GroupPinAction, NewsletterListItem, MediaDownloadResult, ConversationListParams, ConversationListResult, ConversationSummary, LeadListParams, LeadListResult, LeadGetResult, Lead, LeadField, ServiceWindowType, ServiceWindowResult, MetaPricingParams, MetaPricingResult, Webhook, CreateWebhookInput, UpdateWebhookInput, WebhookDeleteResult, WebhookLogsParams, WebhookLogEntry, BrandingInput, BrandingResult, EmbedSurface, EmbedSessionInput, EmbedSessionResult, CheckoutPurpose, CheckoutInput, CheckoutResult, ExtraNumbersPreview, ExtraNumbersPurchaseResult, ExtraNumbersScheduleResult, ChatwootChannelMode, ChatwootStatus, ChatwootConnectInput, ChatwootUpdateInput, ChatwootTestInput, ChatwootTestResult, ChatwootHistoryReplayInput, ChatwootHistoryReplayState, WorkspaceRole, WorkspaceMemberStatus, WorkspaceDetail, WorkspaceMember, WorkspaceMemberList, CallDirection, CallStatus, CallDetails, CallInitiateInput, CallInitiateAccepted, CallActionResult, CallListResult, CallingSettingsResult, CallSettingsUpdateInput, CallSettingsUpdateResult, CallPermissionResult, CallPermissionRequestInput, CallPermissionRequestResult, CallRealtimeSessionMode, CallRealtimeSessionResult, VerificationStatus, VerificationDocumentType, VerificationContactChannel, VerificationContactChannelPath, VerificationDocumentStatus, VerificationReviewReason, VerificationDetails, VerificationState, StartVerificationParams, StartVerificationOptions, StartVerificationResult, ActivationAudio, } from "./types.js";
|
|
13
|
+
export type { MessageStatus, Button, ButtonType, MarketingOptions, SendMessageInput, SendMessageHeader, SendMessageAccepted, MessageDetails, MessageMetaPricing, MessageLogDirection, MessageLogEntry, KnownMessageOrigin, MessageListParams, MessageListResult, GroupMessagesParams, GroupMessagesResult, UnreadMessagesParams, UnreadMessagesResult, MarkReadResult, TypingState, TypingInput, TypingResult, DashboardStats, ApiKeyCreated, ApiKeyListItem, ApiKeyListResult, NumberApiKeyReveal, RegeneratedNumberKey, WhatsAppNumberInstance, WhatsAppNumberListItem, NumberListItemApiKeyRef, NumberCoexistence, CreateNumberInput, CreateNumberResult, CreateMetaNumberInput, CheckNumbersInput, CheckNumbersResult, NumberConnectResult, NumberStatusResult, NumberStatusFailureCode, NumberDetail, NumberSettings, NumberSettingsInput, NumberSettingsSync, NumberPiiInput, NumberLogoutResult, NumberRestoreResult, NumberPurgeResult, NumberPayResult, NumberPayErrorBody, UpdateNumberInput, UpdateNumberResult, ChatHistoryMedia, ChatHistoryMessage, MessageHistoryParams, MessageHistoryResult, NumberLinkBundle, RemotePairingInput, RemotePairingResult, RemotePairingInfo, RemotePairingStatus, RemotePairingConnectResult, CancelMessagesResult, DeleteNumberResult, TemplateCategory, TemplateExamples, TemplateListItem, TemplateDetail, CreateTemplateInput, UpdateTemplateInput, TemplateDeleteResult, FlowCategory, Flow, FlowListParams, FlowListResult, CreateFlowInput, FlowCreated, UpdateFlowInput, FlowUpdateResult, FlowDeleteResult, FlowJsonUploadResult, FlowJsonValidationFailure, FlowPublishInput, FlowPublishResult, FlowDeprecateInput, FlowDeprecateResult, FlowResponse, FlowResponseMedia, FlowSubmittedExchange, FlowResponseListParams, FlowResponseListResult, FlowEndpointKeyMetaStatus, FlowEndpointKeyStatus, FlowEndpointKeyRotateInput, FlowEndpointKeyRotateResult, GroupListItem, GroupDetail, GroupParticipant, CreateGroupInput, GroupActionResult, GroupInviteResult, GroupPinAction, NewsletterListItem, MediaDownloadResult, ConversationListParams, ConversationListResult, ConversationSummary, LeadListParams, LeadListResult, LeadGetResult, Lead, LeadField, ChatReferral, ReferralListParams, ReferralMessage, ReferralListResult, ReferralSummaryParams, ReferralSummaryAd, ReferralSummaryResult, LinkedAdAccount, AdAccountCandidate, AdAccountListResult, AdAccountLinkResult, AdAccountUnlinkResult, AdsSummaryParams, AdsSummaryAd, AdsSummaryResult, LeadPageLink, LeadPageCandidate, LeadPageListResult, LeadPageLinkInput, LeadPageLinkResult, LeadPageUpdateInput, LeadPageUpdateResult, LeadPageUnlinkResult, LeadPageResyncResult, LeadVariableSource, LeadFormConfig, LeadFormQuestion, LeadForm, LeadFormListResult, LeadFormConfigInput, LeadFormConfigResult, ServiceWindowType, ServiceWindowResult, MetaPricingParams, MetaPricingResult, Webhook, CreateWebhookInput, UpdateWebhookInput, WebhookDeleteResult, WebhookLogsParams, WebhookLogEntry, BrandingInput, BrandingResult, EmbedSurface, EmbedSessionInput, EmbedSessionResult, CheckoutPurpose, CheckoutInput, CheckoutResult, ExtraNumbersPreview, ExtraNumbersPurchaseResult, ExtraNumbersScheduleResult, ChatwootChannelMode, ChatwootStatus, ChatwootConnectInput, ChatwootUpdateInput, ChatwootTestInput, ChatwootTestResult, ChatwootHistoryReplayInput, ChatwootHistoryReplayState, WorkspaceRole, WorkspaceMemberStatus, WorkspaceDetail, WorkspaceMember, WorkspaceMemberList, CallDirection, CallStatus, CallDetails, CallInitiateInput, CallInitiateAccepted, CallActionResult, CallListResult, CallingSettingsResult, CallSettingsUpdateInput, CallSettingsUpdateResult, CallPermissionResult, CallPermissionRequestInput, CallPermissionRequestResult, CallRealtimeSessionMode, CallRealtimeSessionResult, VerificationStatus, VerificationDocumentType, VerificationContactChannel, VerificationContactChannelPath, VerificationDocumentStatus, VerificationReviewReason, VerificationDetails, VerificationState, StartVerificationParams, StartVerificationOptions, StartVerificationResult, ActivationAudio, } from "./types.js";
|
|
14
14
|
export type { CustomerWebhookEvent, UnknownCustomerWebhookEvent, WhatsAppMessageType, MessageSentEvent, MessageDeliveredEvent, MessageReadEvent, MessageFailedEvent, MessageReplyEvent, MessageReceivedEvent, MessageGroupEvent, MessageNewsletterEvent, NumberCreatedEvent, NumberConnectedEvent, NumberDisconnectedEvent, NumberRemovedEvent, NumberRestoredEvent, CallRingingEvent, CallConnectedEvent, CallEndedEvent, CallMissedEvent, CallPermissionUpdatedEvent, EvolutionGoCallEventData, EvolutionGoCallOfferEvent, EvolutionGoCallAcceptEvent, EvolutionGoCallTerminateEvent, EvolutionGoCallEvent, FlowResponseReceivedEvent, FlowResponseReceivedEventData, FlowResponseMediaAttachment, LeadReceivedEvent, LeadReceivedEventData, LeadReceivedField, PhoneLineWebhookEvent, PhoneLineWebhookEventName, PhoneLineReturnedReason, PhoneLinePurchasedEvent, PhoneLineAudioReceivedEvent, PhoneLineCodeReceivedEvent, PhoneLineCodeFailedEvent, PhoneLineRenewedEvent, PhoneLinePaymentFailedEvent, PhoneLineSuspendedEvent, PhoneLineReturnedEvent, PhoneLineCanceledEvent, PhoneLineVerificationUpdatedEvent, } from "./webhooks/types.js";
|
|
15
15
|
export { parseCustomerWebhook, isCustomerWebhookEvent, isUnknownCustomerWebhookEvent, CUSTOMER_WEBHOOK_EVENTS, } from "./webhooks/parse.js";
|
|
16
16
|
export type { ParseCustomerWebhookOptions } from "./webhooks/parse.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAClE,YAAY,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAE5D,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,aAAa,EACb,aAAa,EACb,wBAAwB,EACxB,cAAc,EACd,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,EAAE,2BAA2B,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEhF;;;GAGG;AACH,OAAO,EAAE,wBAAwB,EAA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EACjB,qBAAqB,EACrB,yBAAyB,EACzB,uBAAuB,EACvB,uBAAuB,EACvB,2BAA2B,EAC3B,0BAA0B,EAC1B,wBAAwB,EACxB,qBAAqB,EACrB,2BAA2B,EAC3B,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,EACtB,iCAAiC,GAClC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACH,oBAAoB,EACpB,sBAAsB,EACtB,6BAA6B,EAC7B,uBAAuB,GAC1B,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EACL,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,yBAAyB,CAAC;AACjC,YAAY,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qmEAAqmE;AAErmE,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGlE,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,aAAa,EACb,aAAa,EACb,wBAAwB,EACxB,cAAc,EACd,WAAW,GACZ,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,2BAA2B,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEhF;;;GAGG;AACH,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,sGAAsG;AACtG,OAAO,EACL,kBAAkB,EAClB,6BAA6B,EAC7B,SAAS,EACT,+BAA+B,GAChC,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qmEAAqmE;AAErmE,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGlE,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,aAAa,EACb,aAAa,EACb,wBAAwB,EACxB,cAAc,EACd,WAAW,GACZ,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,2BAA2B,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEhF;;;GAGG;AACH,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,sGAAsG;AACtG,OAAO,EACL,kBAAkB,EAClB,6BAA6B,EAC7B,SAAS,EACT,+BAA+B,GAChC,MAAM,4BAA4B,CAAC;AAgQpC,OAAO,EACH,oBAAoB,EACpB,sBAAsB,EACtB,6BAA6B,EAC7B,uBAAuB,GAC1B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { HttpClient } from "../http.js";
|
|
2
|
+
import type { AdAccountLinkResult, AdAccountListResult, AdAccountUnlinkResult, AdsSummaryParams, AdsSummaryResult } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Meta ads configuration (`/v1/ads/*`): the ad accounts connected to the workspace (so
|
|
5
|
+
* ad / ad set / campaign NAMES can be resolved) and the ads volume report.
|
|
6
|
+
*
|
|
7
|
+
* Access to an ad account comes from the advertiser adding the Pilot Status business
|
|
8
|
+
* portfolio (`partnerBusinessId`) as a PARTNER with `ads_read` in Meta Business Manager —
|
|
9
|
+
* there is no token to send here.
|
|
10
|
+
*/
|
|
11
|
+
export declare class AdsResource {
|
|
12
|
+
#private;
|
|
13
|
+
constructor(http: HttpClient);
|
|
14
|
+
/**
|
|
15
|
+
* Connected ad accounts and the ones that may be connected. Account-wide (tenant)
|
|
16
|
+
* key only, with `integrations:manage`; a number-scoped key is refused.
|
|
17
|
+
*/
|
|
18
|
+
listAccounts(): Promise<AdAccountListResult>;
|
|
19
|
+
/**
|
|
20
|
+
* Connect one ad account (`act_<digits>`). Answers 201 `{ link }`. Refusals:
|
|
21
|
+
* 409 `AD_ACCOUNT_NOT_PROVEN` (no ad of that account in this workspace's
|
|
22
|
+
* conversations), 409 `AD_ACCOUNT_NOT_SHARED` (partner grant not there yet),
|
|
23
|
+
* 502 `ADS_LOOKUP_UNAVAILABLE`, 503 `ADS_NOT_CONFIGURED`. Account-wide key only.
|
|
24
|
+
*/
|
|
25
|
+
linkAccount(adAccountId: string): Promise<AdAccountLinkResult>;
|
|
26
|
+
/**
|
|
27
|
+
* Disconnect one ad account. Soft: names already resolved stay. 404 `NOT_FOUND` when
|
|
28
|
+
* it is not linked to this workspace. Account-wide key only.
|
|
29
|
+
*/
|
|
30
|
+
unlinkAccount(adAccountId: string): Promise<AdAccountUnlinkResult>;
|
|
31
|
+
/**
|
|
32
|
+
* Click-to-WhatsApp volume per ad, with resolved names and `leadCount`. Needs
|
|
33
|
+
* `analytics:read` (unlike `referrals.summary()`, which needs `chat:read`). A credential
|
|
34
|
+
* bound to one number (number-scoped key, or `whatsappNumberId` on the client) reports
|
|
35
|
+
* that number; an account-wide key without it reports the whole workspace. Capped at
|
|
36
|
+
* 200 ads (`truncated`).
|
|
37
|
+
*/
|
|
38
|
+
summary(params?: AdsSummaryParams): Promise<AdsSummaryResult>;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=ads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ads.d.ts","sourceRoot":"","sources":["../../src/resources/ads.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAErB;;;;;;;GAOG;AACH,qBAAa,WAAW;;gBAGV,IAAI,EAAE,UAAU;IAI5B;;;OAGG;IACG,YAAY,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAOlD;;;;;OAKG;IACG,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAQpE;;;OAGG;IACG,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAOxE;;;;;;OAMG;IACG,OAAO,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAWpE"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { compact } from "../internal.js";
|
|
2
|
+
/**
|
|
3
|
+
* Meta ads configuration (`/v1/ads/*`): the ad accounts connected to the workspace (so
|
|
4
|
+
* ad / ad set / campaign NAMES can be resolved) and the ads volume report.
|
|
5
|
+
*
|
|
6
|
+
* Access to an ad account comes from the advertiser adding the Pilot Status business
|
|
7
|
+
* portfolio (`partnerBusinessId`) as a PARTNER with `ads_read` in Meta Business Manager —
|
|
8
|
+
* there is no token to send here.
|
|
9
|
+
*/
|
|
10
|
+
export class AdsResource {
|
|
11
|
+
#http;
|
|
12
|
+
constructor(http) {
|
|
13
|
+
this.#http = http;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Connected ad accounts and the ones that may be connected. Account-wide (tenant)
|
|
17
|
+
* key only, with `integrations:manage`; a number-scoped key is refused.
|
|
18
|
+
*/
|
|
19
|
+
async listAccounts() {
|
|
20
|
+
return this.#http.requestJson({
|
|
21
|
+
method: "GET",
|
|
22
|
+
path: "/v1/ads/accounts",
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Connect one ad account (`act_<digits>`). Answers 201 `{ link }`. Refusals:
|
|
27
|
+
* 409 `AD_ACCOUNT_NOT_PROVEN` (no ad of that account in this workspace's
|
|
28
|
+
* conversations), 409 `AD_ACCOUNT_NOT_SHARED` (partner grant not there yet),
|
|
29
|
+
* 502 `ADS_LOOKUP_UNAVAILABLE`, 503 `ADS_NOT_CONFIGURED`. Account-wide key only.
|
|
30
|
+
*/
|
|
31
|
+
async linkAccount(adAccountId) {
|
|
32
|
+
return this.#http.requestJson({
|
|
33
|
+
method: "POST",
|
|
34
|
+
path: "/v1/ads/accounts",
|
|
35
|
+
body: { adAccountId },
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Disconnect one ad account. Soft: names already resolved stay. 404 `NOT_FOUND` when
|
|
40
|
+
* it is not linked to this workspace. Account-wide key only.
|
|
41
|
+
*/
|
|
42
|
+
async unlinkAccount(adAccountId) {
|
|
43
|
+
return this.#http.requestJson({
|
|
44
|
+
method: "DELETE",
|
|
45
|
+
path: `/v1/ads/accounts/${encodeURIComponent(adAccountId)}`,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Click-to-WhatsApp volume per ad, with resolved names and `leadCount`. Needs
|
|
50
|
+
* `analytics:read` (unlike `referrals.summary()`, which needs `chat:read`). A credential
|
|
51
|
+
* bound to one number (number-scoped key, or `whatsappNumberId` on the client) reports
|
|
52
|
+
* that number; an account-wide key without it reports the whole workspace. Capped at
|
|
53
|
+
* 200 ads (`truncated`).
|
|
54
|
+
*/
|
|
55
|
+
async summary(params) {
|
|
56
|
+
return this.#http.requestJson({
|
|
57
|
+
method: "GET",
|
|
58
|
+
path: "/v1/ads/summary",
|
|
59
|
+
query: compact({
|
|
60
|
+
whatsappNumberId: params?.whatsappNumberId,
|
|
61
|
+
startDate: params?.startDate,
|
|
62
|
+
endDate: params?.endDate,
|
|
63
|
+
}),
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=ads.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ads.js","sourceRoot":"","sources":["../../src/resources/ads.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AASzC;;;;;;;GAOG;AACH,MAAM,OAAO,WAAW;IACb,KAAK,CAAa;IAE3B,YAAY,IAAgB;QAC1B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,YAAY;QAChB,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAsB;YACjD,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,kBAAkB;SACzB,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,WAAW,CAAC,WAAmB;QACnC,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAsB;YACjD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE,EAAE,WAAW,EAAE;SACtB,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,aAAa,CAAC,WAAmB;QACrC,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAwB;YACnD,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,oBAAoB,kBAAkB,CAAC,WAAW,CAAC,EAAE;SAC5D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,OAAO,CAAC,MAAyB;QACrC,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAmB;YAC9C,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,iBAAiB;YACvB,KAAK,EAAE,OAAO,CAAC;gBACb,gBAAgB,EAAE,MAAM,EAAE,gBAAgB;gBAC1C,SAAS,EAAE,MAAM,EAAE,SAAS;gBAC5B,OAAO,EAAE,MAAM,EAAE,OAAO;aACzB,CAAC;SACH,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { HttpClient } from "../http.js";
|
|
2
|
+
import type { LeadFormConfigInput, LeadFormConfigResult, LeadFormListResult, LeadPageLinkInput, LeadPageLinkResult, LeadPageListResult, LeadPageResyncResult, LeadPageUnlinkResult, LeadPageUpdateInput, LeadPageUpdateResult } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Meta Lead Ads configuration (`/v1/lead-pages/*`): which Facebook Pages feed leads to
|
|
5
|
+
* which WhatsApp number, and each Instant Form's consent / auto-send setup.
|
|
6
|
+
*
|
|
7
|
+
* Every call needs `integrations:manage`. A credential bound to one number
|
|
8
|
+
* (number-scoped key, or `whatsappNumberId` on the client) acts on that number's links
|
|
9
|
+
* only (403 `NUMBER_NOT_IN_GRANT` otherwise); an account-wide key without it sees the
|
|
10
|
+
* whole workspace. Write calls refuse unknown body fields with 400 `UNKNOWN_FIELDS`.
|
|
11
|
+
*/
|
|
12
|
+
export declare class LeadPagesResource {
|
|
13
|
+
#private;
|
|
14
|
+
constructor(http: HttpClient);
|
|
15
|
+
/** Linked Pages and the Pages this workspace may link. */
|
|
16
|
+
list(): Promise<LeadPageListResult>;
|
|
17
|
+
/** Link one Page to one number. Answers 201 `{ link }`; the 90-day backfill starts on its own. */
|
|
18
|
+
link(input: LeadPageLinkInput): Promise<LeadPageLinkResult>;
|
|
19
|
+
/**
|
|
20
|
+
* Move a Page link to another number. When `autoSendDisabled` comes back `true`, every
|
|
21
|
+
* auto-send of the Page's forms was switched OFF and has to be reviewed.
|
|
22
|
+
*/
|
|
23
|
+
update(pageLinkId: string, input: LeadPageUpdateInput): Promise<LeadPageUpdateResult>;
|
|
24
|
+
/**
|
|
25
|
+
* ⚠️ DESTRUCTIVE: unlinking ERASES every lead captured through this Page
|
|
26
|
+
* (`deletedLeads`) and deletes its form configurations. There is no undo.
|
|
27
|
+
*/
|
|
28
|
+
unlink(pageLinkId: string): Promise<LeadPageUnlinkResult>;
|
|
29
|
+
/** The Page's Instant Forms (live from Meta) with their stored configs and usable templates. */
|
|
30
|
+
listForms(pageLinkId: string): Promise<LeadFormListResult>;
|
|
31
|
+
/**
|
|
32
|
+
* Create or REPLACE one form's config. ⚠️ With `autoSendEnabled: true` new leads get a
|
|
33
|
+
* WhatsApp message without a human: an official number sends `templateId` (an APPROVED
|
|
34
|
+
* template), the others send `freeText`.
|
|
35
|
+
*/
|
|
36
|
+
updateForm(pageLinkId: string, formId: string, input: LeadFormConfigInput): Promise<LeadFormConfigResult>;
|
|
37
|
+
/**
|
|
38
|
+
* Re-pull the Page's last 90 days of leads (idempotent) and retry the subscription when
|
|
39
|
+
* it is down. Answers 202; the backfill runs in the background. Inside the per-Page
|
|
40
|
+
* cooldown it throws 429 `RESYNC_COOLDOWN`, whose body carries `retryAfterSeconds`.
|
|
41
|
+
*/
|
|
42
|
+
resync(pageLinkId: string): Promise<LeadPageResyncResult>;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=lead-pages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lead-pages.d.ts","sourceRoot":"","sources":["../../src/resources/lead-pages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,aAAa,CAAC;AAErB;;;;;;;;GAQG;AACH,qBAAa,iBAAiB;;gBAGhB,IAAI,EAAE,UAAU;IAQ5B,0DAA0D;IACpD,IAAI,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAOzC,kGAAkG;IAC5F,IAAI,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAWjE;;;OAGG;IACG,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAQ3F;;;OAGG;IACG,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAO/D,gGAAgG;IAC1F,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAOhE;;;;OAIG;IACG,UAAU,CACd,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,mBAAmB,GACzB,OAAO,CAAC,oBAAoB,CAAC;IAQhC;;;;OAIG;IACG,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAMhE"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Meta Lead Ads configuration (`/v1/lead-pages/*`): which Facebook Pages feed leads to
|
|
3
|
+
* which WhatsApp number, and each Instant Form's consent / auto-send setup.
|
|
4
|
+
*
|
|
5
|
+
* Every call needs `integrations:manage`. A credential bound to one number
|
|
6
|
+
* (number-scoped key, or `whatsappNumberId` on the client) acts on that number's links
|
|
7
|
+
* only (403 `NUMBER_NOT_IN_GRANT` otherwise); an account-wide key without it sees the
|
|
8
|
+
* whole workspace. Write calls refuse unknown body fields with 400 `UNKNOWN_FIELDS`.
|
|
9
|
+
*/
|
|
10
|
+
export class LeadPagesResource {
|
|
11
|
+
#http;
|
|
12
|
+
constructor(http) {
|
|
13
|
+
this.#http = http;
|
|
14
|
+
}
|
|
15
|
+
#path(pageLinkId) {
|
|
16
|
+
return `/v1/lead-pages/${encodeURIComponent(pageLinkId)}`;
|
|
17
|
+
}
|
|
18
|
+
/** Linked Pages and the Pages this workspace may link. */
|
|
19
|
+
async list() {
|
|
20
|
+
return this.#http.requestJson({
|
|
21
|
+
method: "GET",
|
|
22
|
+
path: "/v1/lead-pages",
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/** Link one Page to one number. Answers 201 `{ link }`; the 90-day backfill starts on its own. */
|
|
26
|
+
async link(input) {
|
|
27
|
+
return this.#http.requestJson({
|
|
28
|
+
method: "POST",
|
|
29
|
+
path: "/v1/lead-pages",
|
|
30
|
+
body: input.whatsappNumberId === undefined
|
|
31
|
+
? { pageId: input.pageId }
|
|
32
|
+
: { pageId: input.pageId, whatsappNumberId: input.whatsappNumberId },
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Move a Page link to another number. When `autoSendDisabled` comes back `true`, every
|
|
37
|
+
* auto-send of the Page's forms was switched OFF and has to be reviewed.
|
|
38
|
+
*/
|
|
39
|
+
async update(pageLinkId, input) {
|
|
40
|
+
return this.#http.requestJson({
|
|
41
|
+
method: "PATCH",
|
|
42
|
+
path: this.#path(pageLinkId),
|
|
43
|
+
body: { whatsappNumberId: input.whatsappNumberId },
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* ⚠️ DESTRUCTIVE: unlinking ERASES every lead captured through this Page
|
|
48
|
+
* (`deletedLeads`) and deletes its form configurations. There is no undo.
|
|
49
|
+
*/
|
|
50
|
+
async unlink(pageLinkId) {
|
|
51
|
+
return this.#http.requestJson({
|
|
52
|
+
method: "DELETE",
|
|
53
|
+
path: this.#path(pageLinkId),
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/** The Page's Instant Forms (live from Meta) with their stored configs and usable templates. */
|
|
57
|
+
async listForms(pageLinkId) {
|
|
58
|
+
return this.#http.requestJson({
|
|
59
|
+
method: "GET",
|
|
60
|
+
path: `${this.#path(pageLinkId)}/forms`,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Create or REPLACE one form's config. ⚠️ With `autoSendEnabled: true` new leads get a
|
|
65
|
+
* WhatsApp message without a human: an official number sends `templateId` (an APPROVED
|
|
66
|
+
* template), the others send `freeText`.
|
|
67
|
+
*/
|
|
68
|
+
async updateForm(pageLinkId, formId, input) {
|
|
69
|
+
return this.#http.requestJson({
|
|
70
|
+
method: "PUT",
|
|
71
|
+
path: `${this.#path(pageLinkId)}/forms/${encodeURIComponent(formId)}`,
|
|
72
|
+
body: input,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Re-pull the Page's last 90 days of leads (idempotent) and retry the subscription when
|
|
77
|
+
* it is down. Answers 202; the backfill runs in the background. Inside the per-Page
|
|
78
|
+
* cooldown it throws 429 `RESYNC_COOLDOWN`, whose body carries `retryAfterSeconds`.
|
|
79
|
+
*/
|
|
80
|
+
async resync(pageLinkId) {
|
|
81
|
+
return this.#http.requestJson({
|
|
82
|
+
method: "POST",
|
|
83
|
+
path: `${this.#path(pageLinkId)}/resync`,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=lead-pages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lead-pages.js","sourceRoot":"","sources":["../../src/resources/lead-pages.ts"],"names":[],"mappings":"AAcA;;;;;;;;GAQG;AACH,MAAM,OAAO,iBAAiB;IACnB,KAAK,CAAa;IAE3B,YAAY,IAAgB;QAC1B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,KAAK,CAAC,UAAkB;QACtB,OAAO,kBAAkB,kBAAkB,CAAC,UAAU,CAAC,EAAE,CAAC;IAC5D,CAAC;IAED,0DAA0D;IAC1D,KAAK,CAAC,IAAI;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAqB;YAChD,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,gBAAgB;SACvB,CAAC,CAAC;IACL,CAAC;IAED,kGAAkG;IAClG,KAAK,CAAC,IAAI,CAAC,KAAwB;QACjC,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAqB;YAChD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,gBAAgB;YACtB,IAAI,EACF,KAAK,CAAC,gBAAgB,KAAK,SAAS;gBAClC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE;gBAC1B,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EA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IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS;SACzC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -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"}
|