meta-cloud-api 3.12.1 → 3.13.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/dist/index.d.mts +58 -21
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.d.mts +58 -21
- package/dist/node/index.d.mts.map +1 -1
- package/dist/node/index.mjs +2 -2
- package/dist/node/index.mjs.map +1 -1
- package/dist/types/index.d.ts +49 -13
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/node/index.d.ts +2 -2
- package/dist/utils/node/index.d.ts.map +1 -1
- package/dist/utils/node/index.js +1 -1
- package/dist/utils/node/index.js.map +1 -1
- package/package.json +1 -1
package/dist/node/index.d.mts
CHANGED
|
@@ -1490,6 +1490,14 @@ type CallPermissionAction = {
|
|
|
1490
1490
|
can_perform_action: boolean;
|
|
1491
1491
|
limits?: CallPermissionLimit[];
|
|
1492
1492
|
};
|
|
1493
|
+
/**
|
|
1494
|
+
* Identify the WhatsApp user by phone number (`userWaId`) or BSUID (`recipient`).
|
|
1495
|
+
* At least one is required.
|
|
1496
|
+
*/
|
|
1497
|
+
type GetCallPermissionsParams = {
|
|
1498
|
+
userWaId?: string;
|
|
1499
|
+
recipient?: string;
|
|
1500
|
+
};
|
|
1493
1501
|
type CallPermissionsResponse = {
|
|
1494
1502
|
messaging_product: 'whatsapp';
|
|
1495
1503
|
permission: CallPermission;
|
|
@@ -1537,7 +1545,8 @@ type MessagingAccountIdParam = {
|
|
|
1537
1545
|
messaging_account_id?: string;
|
|
1538
1546
|
};
|
|
1539
1547
|
type InitiateCallRequest = MessagingAccountIdParam & {
|
|
1540
|
-
to
|
|
1548
|
+
/** Callee phone number. Required unless `recipient` is provided; takes precedence when both are set. */to?: string; /** Callee business-scoped user ID (BSUID) or parent BSUID. Use instead of, or in addition to, `to`. */
|
|
1549
|
+
recipient?: string;
|
|
1541
1550
|
session: CallSession;
|
|
1542
1551
|
biz_opaque_callback_data?: string;
|
|
1543
1552
|
recording?: CallRecordingConfig;
|
|
@@ -1576,9 +1585,7 @@ interface CallingClass {
|
|
|
1576
1585
|
fields?: string[] | string;
|
|
1577
1586
|
include_sip_credentials?: boolean;
|
|
1578
1587
|
}): Promise<CallingSettingsResponse>;
|
|
1579
|
-
getCallPermissions(params:
|
|
1580
|
-
userWaId: string;
|
|
1581
|
-
}): Promise<CallPermissionsResponse>;
|
|
1588
|
+
getCallPermissions(params: GetCallPermissionsParams): Promise<CallPermissionsResponse>;
|
|
1582
1589
|
initiateCall(params: InitiateCallRequest): Promise<InitiateCallResponse>;
|
|
1583
1590
|
preAcceptCall(params: PreAcceptCallRequest): Promise<CallActionResponse>;
|
|
1584
1591
|
acceptCall(params: AcceptCallRequest): Promise<CallActionResponse>;
|
|
@@ -1629,18 +1636,18 @@ declare class CallingApi extends BaseAPI implements CallingClass {
|
|
|
1629
1636
|
* Get calling permissions for a specific WhatsApp user.
|
|
1630
1637
|
*
|
|
1631
1638
|
* @param params - The request parameters.
|
|
1632
|
-
* @param params.userWaId - The WhatsApp ID of the user to check permissions for.
|
|
1639
|
+
* @param params.userWaId - The WhatsApp ID of the user to check permissions for. Required unless `recipient` is set.
|
|
1640
|
+
* @param params.recipient - The user's business-scoped user ID (BSUID) or parent BSUID, used instead of `userWaId`.
|
|
1633
1641
|
* @returns The call permissions for the specified user.
|
|
1634
1642
|
* @see https://developers.facebook.com/documentation/business-messaging/whatsapp/calling/reference/
|
|
1635
1643
|
*/
|
|
1636
|
-
getCallPermissions(params:
|
|
1637
|
-
userWaId: string;
|
|
1638
|
-
}): Promise<CallPermissionsResponse>;
|
|
1644
|
+
getCallPermissions(params: GetCallPermissionsParams): Promise<CallPermissionsResponse>;
|
|
1639
1645
|
/**
|
|
1640
1646
|
* Initiate an outbound call to a WhatsApp user.
|
|
1641
1647
|
*
|
|
1642
1648
|
* @param params - The call initiation parameters.
|
|
1643
|
-
* @param params.to - The recipient's WhatsApp phone number.
|
|
1649
|
+
* @param params.to - The recipient's WhatsApp phone number. Required unless `recipient` is set.
|
|
1650
|
+
* @param params.recipient - The recipient's business-scoped user ID (BSUID) or parent BSUID. `to` takes precedence when both are set.
|
|
1644
1651
|
* @param params.session - The call session configuration.
|
|
1645
1652
|
* @param params.messaging_account_id - Optional Messaging account placing the call (required when the token reaches more than one).
|
|
1646
1653
|
* @param params.biz_opaque_callback_data - Optional opaque data passed back in webhooks.
|
|
@@ -2554,7 +2561,9 @@ type InteractiveObject = ButtonInteractiveObject | ListInteractiveObject | Produ
|
|
|
2554
2561
|
interface ReactionParams {
|
|
2555
2562
|
messageId: string;
|
|
2556
2563
|
emoji: string;
|
|
2557
|
-
to
|
|
2564
|
+
to?: string;
|
|
2565
|
+
/** Business-scoped user ID (BSUID) or parent BSUID; `to` takes precedence when both are set. */
|
|
2566
|
+
recipient?: string;
|
|
2558
2567
|
recipientType?: MessageRecipientType;
|
|
2559
2568
|
}
|
|
2560
2569
|
//#endregion
|
|
@@ -2608,8 +2617,9 @@ type DirectSendOptions = {
|
|
|
2608
2617
|
directSendConfig?: DirectSendConfig;
|
|
2609
2618
|
};
|
|
2610
2619
|
type MessageRequestBody<T extends MessageTypesEnum> = GeneralMessageBody & {
|
|
2611
|
-
recipient_type?: MessageRecipientType;
|
|
2612
|
-
to
|
|
2620
|
+
recipient_type?: MessageRecipientType; /** Recipient phone number. Optional when `recipient` (BSUID) is provided. */
|
|
2621
|
+
to?: string; /** Business-scoped user ID (BSUID) or parent BSUID. `to` takes precedence when both are set. */
|
|
2622
|
+
recipient?: string;
|
|
2613
2623
|
context?: ConTextObject;
|
|
2614
2624
|
type?: T;
|
|
2615
2625
|
category?: DirectSendCategory;
|
|
@@ -2617,7 +2627,14 @@ type MessageRequestBody<T extends MessageTypesEnum> = GeneralMessageBody & {
|
|
|
2617
2627
|
};
|
|
2618
2628
|
interface MessageRequestParams<T> {
|
|
2619
2629
|
body: T;
|
|
2620
|
-
|
|
2630
|
+
/** Recipient phone number. Required unless `recipient` is provided. */
|
|
2631
|
+
to?: string;
|
|
2632
|
+
/**
|
|
2633
|
+
* Business-scoped user ID (BSUID) or parent BSUID of the recipient. Use instead of,
|
|
2634
|
+
* or in addition to, `to`; if both are set, `to` takes precedence.
|
|
2635
|
+
* @see https://developers.facebook.com/documentation/business-messaging/whatsapp/business-phone-numbers/business-scoped-user-ids
|
|
2636
|
+
*/
|
|
2637
|
+
recipient?: string;
|
|
2621
2638
|
recipientType?: MessageRecipientType;
|
|
2622
2639
|
replyMessageId?: string;
|
|
2623
2640
|
/**
|
|
@@ -3972,7 +3989,7 @@ interface WABAClass {
|
|
|
3972
3989
|
* WABA event types for account_update webhook.
|
|
3973
3990
|
* @see https://developers.facebook.com/documentation/business-messaging/whatsapp/webhooks/reference/account_update
|
|
3974
3991
|
*/
|
|
3975
|
-
type AccountUpdateEvent = 'ACCOUNT_DELETED' | 'ACCOUNT_OFFBOARDED' | 'ACCOUNT_RECONNECTED' | 'ACCOUNT_RESTRICTION' | 'ACCOUNT_VIOLATION' | 'AD_ACCOUNT_LINKED' | 'AUTH_INTL_PRICE_ELIGIBILITY_UPDATE' | 'BUSINESS_PRIMARY_LOCATION_COUNTRY_UPDATE' | 'DISABLED_UPDATE' | 'MM_LITE_TERMS_SIGNED' | 'PARTNER_ADDED' | 'PARTNER_APP_INSTALLED' | 'PARTNER_APP_UNINSTALLED' | 'PARTNER_CLIENT_CERTIFICATION_STATUS_UPDATE' | 'PARTNER_REMOVED' | 'VERIFIED_ACCOUNT' | 'VOLUME_BASED_PRICING_TIER_UPDATE';
|
|
3992
|
+
type AccountUpdateEvent = 'ACCOUNT_DELETED' | 'ACCOUNT_OFFBOARDED' | 'ACCOUNT_RECONNECTED' | 'ACCOUNT_RESTRICTION' | 'ACCOUNT_VIOLATION' | 'AD_ACCOUNT_LINKED' | 'AUTH_INTL_PRICE_ELIGIBILITY_UPDATE' | 'CALLING_TIER_UPDATE' | 'BUSINESS_PRIMARY_LOCATION_COUNTRY_UPDATE' | 'DISABLED_UPDATE' | 'MM_LITE_TERMS_SIGNED' | 'PARTNER_ADDED' | 'PARTNER_APP_INSTALLED' | 'PARTNER_APP_UNINSTALLED' | 'PARTNER_CLIENT_CERTIFICATION_STATUS_UPDATE' | 'PARTNER_REMOVED' | 'VERIFIED_ACCOUNT' | 'VOLUME_BASED_PRICING_TIER_UPDATE';
|
|
3976
3993
|
/**
|
|
3977
3994
|
* WABA ban state — present on DISABLED_UPDATE events.
|
|
3978
3995
|
*/
|
|
@@ -4040,6 +4057,13 @@ interface AuthInternationalRateEligibility {
|
|
|
4040
4057
|
start_time: number;
|
|
4041
4058
|
}>;
|
|
4042
4059
|
}
|
|
4060
|
+
/** Business-initiated calling tier for quality-based calling */
|
|
4061
|
+
type CallingLimitTier = 'CALLING_TIER_NO_ACCESS' | 'CALLING_TIER_1K' | 'CALLING_TIER_15K' | 'CALLING_TIER_UNLIMITED';
|
|
4062
|
+
/** Present on CALLING_TIER_UPDATE events */
|
|
4063
|
+
interface CallingLimitInfo {
|
|
4064
|
+
current_limit: CallingLimitTier;
|
|
4065
|
+
previous_limit: CallingLimitTier;
|
|
4066
|
+
}
|
|
4043
4067
|
/** Present on VOLUME_BASED_PRICING_TIER_UPDATE events */
|
|
4044
4068
|
interface VolumeTierInfo {
|
|
4045
4069
|
/** Unix timestamp of the tier update */
|
|
@@ -4095,6 +4119,8 @@ interface AccountUpdateValue {
|
|
|
4095
4119
|
waba_info?: AccountUpdateWabaInfo;
|
|
4096
4120
|
/** Present on AUTH_INTL_PRICE_ELIGIBILITY_UPDATE events */
|
|
4097
4121
|
auth_international_rate_eligibility?: AuthInternationalRateEligibility;
|
|
4122
|
+
/** Present on CALLING_TIER_UPDATE events */
|
|
4123
|
+
calling_limit_info?: CallingLimitInfo;
|
|
4098
4124
|
/** Present on VOLUME_BASED_PRICING_TIER_UPDATE events */
|
|
4099
4125
|
volume_tier_info?: VolumeTierInfo;
|
|
4100
4126
|
/** Present on PARTNER_REMOVED events where business used WhatsApp Business app + Cloud API */
|
|
@@ -4413,8 +4439,12 @@ interface CallEntry {
|
|
|
4413
4439
|
event: CallEventType;
|
|
4414
4440
|
/** Unix timestamp */
|
|
4415
4441
|
timestamp: number;
|
|
4416
|
-
/** Callee of the call (Page ID) — present on connect / call_created */
|
|
4442
|
+
/** Callee of the call (Page ID) — present on connect / call_created. May be omitted when the user has a username and the phone number is hidden. */
|
|
4417
4443
|
to?: string;
|
|
4444
|
+
/** BSUID of the callee (business-initiated calls) */
|
|
4445
|
+
to_user_id?: string;
|
|
4446
|
+
/** Parent BSUID of the callee, only when parent BSUIDs are enabled */
|
|
4447
|
+
to_parent_user_id?: string;
|
|
4418
4448
|
/** Caller of the call (PSID) — present on connect / call_created */
|
|
4419
4449
|
from?: string;
|
|
4420
4450
|
/** Whether the call was business- or user-initiated — present on connect */
|
|
@@ -4427,6 +4457,10 @@ interface CallEntry {
|
|
|
4427
4457
|
from_parent_user_id?: string;
|
|
4428
4458
|
/** PSID of the consumer — present on call_status */
|
|
4429
4459
|
recipient_id?: string;
|
|
4460
|
+
/** BSUID of the callee — present on call_status */
|
|
4461
|
+
recipient_user_id?: string;
|
|
4462
|
+
/** Parent BSUID of the callee, only when parent BSUIDs are enabled — present on call_status */
|
|
4463
|
+
recipient_parent_user_id?: string;
|
|
4430
4464
|
/** Ringing or accepted — present on call_status */
|
|
4431
4465
|
call_status?: CallStatusValue;
|
|
4432
4466
|
/** SDP session information; apply the offer to your local peer connection — present on media_update */
|
|
@@ -4453,10 +4487,12 @@ interface CallContact {
|
|
|
4453
4487
|
/** Display name of the caller */name: string; /** Business-scoped username, when Meta includes it */
|
|
4454
4488
|
username?: string;
|
|
4455
4489
|
};
|
|
4456
|
-
/** WhatsApp ID of the caller */
|
|
4457
|
-
wa_id
|
|
4490
|
+
/** WhatsApp ID of the caller. May be omitted when the user has a username and the phone number is hidden. */
|
|
4491
|
+
wa_id?: string;
|
|
4458
4492
|
/** Business-scoped user ID, when Meta includes it */
|
|
4459
4493
|
user_id?: string;
|
|
4494
|
+
/** Parent business-scoped user ID, only when parent BSUIDs are enabled */
|
|
4495
|
+
parent_user_id?: string;
|
|
4460
4496
|
}
|
|
4461
4497
|
interface CallsValue {
|
|
4462
4498
|
messaging_product: 'whatsapp';
|
|
@@ -5912,7 +5948,7 @@ type MetaErrorData = {
|
|
|
5912
5948
|
interface MetaError extends Error {
|
|
5913
5949
|
error: MetaErrorData;
|
|
5914
5950
|
}
|
|
5915
|
-
declare const WHATSAPP_ERROR_CODES: readonly [0, 1, 2, 3, 4, 10, 33, 100, 190, 200, 299, 368, 613, 80007, 130429, 130472, 130497, 131000, 131005, 131008, 131009, 131016, 131020, 131021, 131026, 131030, 131031, 131037, 131041, 131042, 131044, 131045, 131047, 131048, 131049, 131050, 131051, 131052, 131053, 131055, 131056, 131057, 131059, 131061, 131062, 131063, 131065, 131070, 131201, 131202, 131203, 131204, 131207, 131208, 131209, 131210, 131211, 131212, 131213, 131214, 131215, 132000, 132001, 132005, 132007, 132008, 132012, 132015, 132016, 132068, 132069, 133000, 133004, 133005, 133006, 133008, 133009, 133010, 133015, 133016, 134011, 134100, 134101, 134102, 135000, 137000, 138000, 138001, 138002, 138003, 138004, 138005, 138006, 138007, 138009, 138012, 138013, 138018, 138038, 139000, 139001, 139002, 139003, 139004, 139100, 139101, 139102, 139103, 147005, 200005, 200006, 200007, 1752041, 2388001, 2388012, 2388019, 2388040, 2388047, 2388072, 2388073, 2388091, 2388093, 2388103, 2388293, 2388299, 2494100, 2494191, 2593079, 2593085, 2593107, 2593108];
|
|
5951
|
+
declare const WHATSAPP_ERROR_CODES: readonly [0, 1, 2, 3, 4, 10, 33, 100, 190, 200, 299, 368, 613, 80007, 130429, 130472, 130497, 131000, 131005, 131008, 131009, 131016, 131020, 131021, 131026, 131030, 131031, 131037, 131041, 131042, 131044, 131045, 131047, 131048, 131049, 131050, 131051, 131052, 131053, 131055, 131056, 131057, 131059, 131061, 131062, 131063, 131065, 131070, 131201, 131202, 131203, 131204, 131207, 131208, 131209, 131210, 131211, 131212, 131213, 131214, 131215, 132000, 132001, 132005, 132007, 132008, 132012, 132015, 132016, 132068, 132069, 133000, 133004, 133005, 133006, 133008, 133009, 133010, 133015, 133016, 134011, 134100, 134101, 134102, 135000, 137000, 138000, 138001, 138002, 138003, 138004, 138005, 138006, 138007, 138009, 138012, 138013, 138018, 138037, 138038, 139000, 139001, 139002, 139003, 139004, 139100, 139101, 139102, 139103, 147005, 200005, 200006, 200007, 1752041, 2388001, 2388012, 2388019, 2388040, 2388047, 2388072, 2388073, 2388091, 2388093, 2388103, 2388293, 2388299, 2494100, 2494191, 2593079, 2593085, 2593107, 2593108];
|
|
5916
5952
|
type ApiPermissionErrorCode = number;
|
|
5917
5953
|
type WhatsAppErrorCode = (typeof WHATSAPP_ERROR_CODES)[number] | ApiPermissionErrorCode;
|
|
5918
5954
|
declare const AUTHORIZATION_ERROR_CODES: readonly [0, 3, 10, 190];
|
|
@@ -5921,7 +5957,7 @@ declare const INTEGRITY_ERROR_CODES: readonly [368, 130497, 131031];
|
|
|
5921
5957
|
declare const SEND_MESSAGE_ERROR_CODES: readonly [130472, 131000, 131005, 131008, 131009, 131016, 131021, 131026, 131030, 131042, 131044, 131045, 131047, 131050, 131051, 131052, 131053, 131056, 131057, 131048, 131061, 131062, 131063, 131065, 131070, 132000, 132001, 132005, 132007, 132008, 132012, 132015, 132016, 132068, 132069, 135000, 137000];
|
|
5922
5958
|
declare const FLOW_ERROR_CODES: readonly [139000, 139001, 139002, 139003, 139004];
|
|
5923
5959
|
declare const BLOCK_USER_ERROR_CODES: readonly [139100, 139101, 139102, 139103];
|
|
5924
|
-
declare const CALLING_ERROR_CODES: readonly [138000, 138001, 138002, 138003, 138004, 138005, 138006, 138007, 138009, 138012, 138013, 138018, 138038, 613];
|
|
5960
|
+
declare const CALLING_ERROR_CODES: readonly [138000, 138001, 138002, 138003, 138004, 138005, 138006, 138007, 138009, 138012, 138013, 138018, 138037, 138038, 613];
|
|
5925
5961
|
declare const GROUP_ERROR_CODES: readonly [131020, 131041, 131059, 131201, 131202, 131203, 131204, 131207, 131208, 131209, 131210, 131211, 131212, 131213, 131214, 131215];
|
|
5926
5962
|
declare function isWhatsAppErrorCode(code: number): code is WhatsAppErrorCode;
|
|
5927
5963
|
declare function isApiPermissionErrorCode(code: number): code is ApiPermissionErrorCode;
|
|
@@ -7487,10 +7523,11 @@ declare class MessagesApi extends BaseAPI implements MessagesClass {
|
|
|
7487
7523
|
*
|
|
7488
7524
|
* @param type - The type of message to send (e.g., text, image, template)
|
|
7489
7525
|
* @param payload - The message payload object matching the specified type
|
|
7490
|
-
* @param to - The recipient's phone number in international format (e.g., "1234567890")
|
|
7526
|
+
* @param to - The recipient's phone number in international format (e.g., "1234567890"). Optional when `recipient` is set.
|
|
7491
7527
|
* @param replyMessageId - Optional message ID to reply to, setting the message context
|
|
7492
7528
|
* @param recipientType - Whether `to` addresses an individual or a group
|
|
7493
7529
|
* @param directSend - Optional Direct Send options (`category` and `directSendConfig`)
|
|
7530
|
+
* @param recipient - Optional business-scoped user ID (BSUID) or parent BSUID. Use instead of, or with, `to`; `to` takes precedence when both are set.
|
|
7494
7531
|
* @returns The formatted request body ready to be serialized and sent
|
|
7495
7532
|
*
|
|
7496
7533
|
* @see {@link https://developers.facebook.com/docs/whatsapp/cloud-api/reference/messages | Messages API Reference}
|
|
@@ -7505,7 +7542,7 @@ declare class MessagesApi extends BaseAPI implements MessagesClass {
|
|
|
7505
7542
|
* );
|
|
7506
7543
|
* ```
|
|
7507
7544
|
*/
|
|
7508
|
-
bodyBuilder<T extends MessageTypesEnum>(type: T, payload: MessagePayloadType<T>, to: string, replyMessageId?: string, recipientType?: MessageRecipientType, directSend?: DirectSendOptions): MessageRequestBody<T>;
|
|
7545
|
+
bodyBuilder<T extends MessageTypesEnum>(type: T, payload: MessagePayloadType<T>, to: string | undefined, replyMessageId?: string, recipientType?: MessageRecipientType, directSend?: DirectSendOptions, recipient?: string): MessageRequestBody<T>;
|
|
7509
7546
|
/**
|
|
7510
7547
|
* Sends a request to the WhatsApp Cloud API messages endpoint.
|
|
7511
7548
|
*
|