meta-cloud-api 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +96 -59
- package/dist/index.d.ts +879 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +686 -9
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +16 -17
package/dist/types/index.d.ts
CHANGED
|
@@ -1867,43 +1867,135 @@ interface WABAClass {
|
|
|
1867
1867
|
//#endregion
|
|
1868
1868
|
//#region src/core/webhook/types/account.d.ts
|
|
1869
1869
|
/**
|
|
1870
|
-
*
|
|
1871
|
-
* @see https://developers.facebook.com/
|
|
1870
|
+
* WABA event types for account_update webhook.
|
|
1871
|
+
* @see https://developers.facebook.com/documentation/business-messaging/whatsapp/webhooks/reference/account_update
|
|
1872
1872
|
*/
|
|
1873
|
-
type AccountUpdateEvent = '
|
|
1873
|
+
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';
|
|
1874
1874
|
/**
|
|
1875
|
-
* WABA ban state
|
|
1876
|
-
* @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#value--ban_info
|
|
1875
|
+
* WABA ban state — present on DISABLED_UPDATE events.
|
|
1877
1876
|
*/
|
|
1878
1877
|
type WabaBanState = 'SCHEDULE_FOR_DISABLE' | 'DISABLE' | 'REINSTATE';
|
|
1879
1878
|
/**
|
|
1880
|
-
* Restriction types imposed on WABA
|
|
1881
|
-
* @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#value--restriction_info
|
|
1879
|
+
* Restriction types imposed on WABA — present on ACCOUNT_RESTRICTION events.
|
|
1882
1880
|
*/
|
|
1883
1881
|
type RestrictionType = 'RESTRICTION_ADD_PHONE_NUMBER_ACTION' | 'RESTRICTED_BIZ_INITIATED_MESSAGING' | 'RESTRICTED_CUSTOMER_INITIATED_MESSAGING';
|
|
1882
|
+
/**
|
|
1883
|
+
* Reason for the disconnection — present on PARTNER_REMOVED events where
|
|
1884
|
+
* the business used both WhatsApp Business app and Cloud API.
|
|
1885
|
+
*/
|
|
1886
|
+
type DisconnectionReason = 'ACCOUNT_DISCONNECTED' | 'BUSINESS_DOWNGRADE' | 'CHANGE_NUMBER' | 'COMPANION_INACTIVITY' | 'PRIMARY_INACTIVITY' | 'USER_RE_REGISTERED';
|
|
1887
|
+
/**
|
|
1888
|
+
* Who initiated the disconnection — present on PARTNER_REMOVED events.
|
|
1889
|
+
*/
|
|
1890
|
+
type DisconnectionInitiatedBy = 'SYSTEM' | 'USER';
|
|
1891
|
+
/**
|
|
1892
|
+
* Status of the partner-led business verification submission.
|
|
1893
|
+
*/
|
|
1894
|
+
type PartnerClientCertificationStatus = 'APPROVED' | 'REJECTED' | 'DISCARDED';
|
|
1895
|
+
/** Present on DISABLED_UPDATE events */
|
|
1884
1896
|
interface AccountUpdateBanInfo {
|
|
1885
1897
|
waba_ban_state: WabaBanState;
|
|
1886
|
-
|
|
1898
|
+
/** Unix timestamp of the ban date */
|
|
1899
|
+
waba_ban_date?: string;
|
|
1887
1900
|
}
|
|
1901
|
+
/** Present on ACCOUNT_VIOLATION events */
|
|
1888
1902
|
interface AccountUpdateViolationInfo {
|
|
1889
1903
|
violation_type: string;
|
|
1890
1904
|
}
|
|
1905
|
+
/** Present on ACCOUNT_RESTRICTION events */
|
|
1891
1906
|
interface AccountUpdateRestrictionInfo {
|
|
1892
1907
|
restriction_type: RestrictionType;
|
|
1908
|
+
/** Unix timestamp when the restriction expires */
|
|
1893
1909
|
expiration?: number;
|
|
1910
|
+
/** Steps the business can take to remediate the restriction */
|
|
1911
|
+
remediation?: string;
|
|
1894
1912
|
}
|
|
1913
|
+
/**
|
|
1914
|
+
* Present on PARTNER_ADDED, PARTNER_APP_INSTALLED, PARTNER_APP_UNINSTALLED,
|
|
1915
|
+
* PARTNER_REMOVED, AD_ACCOUNT_LINKED, and MM_LITE_TERMS_SIGNED events.
|
|
1916
|
+
*/
|
|
1895
1917
|
interface AccountUpdateWabaInfo {
|
|
1918
|
+
/** Customer or own WABA ID */
|
|
1896
1919
|
waba_id: string;
|
|
1920
|
+
/** Business portfolio ID */
|
|
1897
1921
|
owner_business_id: string;
|
|
1922
|
+
/** Partner app ID — present on PARTNER_APP_INSTALLED / PARTNER_APP_UNINSTALLED */
|
|
1898
1923
|
partner_app_id?: string;
|
|
1924
|
+
/** Ad account ID — present on AD_ACCOUNT_LINKED */
|
|
1925
|
+
ad_account_linked?: string;
|
|
1926
|
+
/** Solution ID — present when customer onboarded via multi-partner solution */
|
|
1927
|
+
solution_id?: string;
|
|
1928
|
+
/** Partner business portfolio IDs — present for multi-partner solutions */
|
|
1929
|
+
solution_partner_business_ids?: string[];
|
|
1930
|
+
}
|
|
1931
|
+
/** Present on AUTH_INTL_PRICE_ELIGIBILITY_UPDATE events */
|
|
1932
|
+
interface AuthInternationalRateEligibility {
|
|
1933
|
+
/** Unix timestamp when authentication-international rates become effective */
|
|
1934
|
+
start_time: number;
|
|
1935
|
+
/** Countries with different start times */
|
|
1936
|
+
exception_countries?: Array<{
|
|
1937
|
+
/** ISO 3166-1 alpha-2 country code */
|
|
1938
|
+
country_code: string;
|
|
1939
|
+
/** Unix timestamp for this country's start time */
|
|
1940
|
+
start_time: number;
|
|
1941
|
+
}>;
|
|
1942
|
+
}
|
|
1943
|
+
/** Present on VOLUME_BASED_PRICING_TIER_UPDATE events */
|
|
1944
|
+
interface VolumeTierInfo {
|
|
1945
|
+
/** Unix timestamp of the tier update */
|
|
1946
|
+
tier_update_time: number;
|
|
1947
|
+
/** Pricing category (e.g. "UTILITY") */
|
|
1948
|
+
pricing_category: string;
|
|
1949
|
+
/** Pricing tier identifier */
|
|
1950
|
+
tier: string;
|
|
1951
|
+
/** Effective month in YYYY-MM format (e.g. "2025-11") */
|
|
1952
|
+
effective_month: string;
|
|
1953
|
+
/** Region for the tier update (e.g. "India") */
|
|
1954
|
+
region: string;
|
|
1955
|
+
}
|
|
1956
|
+
/** Present on PARTNER_REMOVED events where disconnection_info is applicable */
|
|
1957
|
+
interface DisconnectionInfo {
|
|
1958
|
+
reason: DisconnectionReason;
|
|
1959
|
+
initiated_by: DisconnectionInitiatedBy;
|
|
1960
|
+
}
|
|
1961
|
+
/** Present on PARTNER_CLIENT_CERTIFICATION_STATUS_UPDATE events */
|
|
1962
|
+
interface PartnerClientCertificationInfo {
|
|
1963
|
+
/** Customer's business portfolio ID */
|
|
1964
|
+
client_business_id: string;
|
|
1965
|
+
/** Status of the verification submission */
|
|
1966
|
+
status: PartnerClientCertificationStatus;
|
|
1967
|
+
/** Rejection reasons — present when status is REJECTED */
|
|
1968
|
+
rejection_reasons?: string[];
|
|
1899
1969
|
}
|
|
1900
1970
|
interface AccountUpdateValue {
|
|
1971
|
+
/** Phone number associated with the WABA, if applicable */
|
|
1901
1972
|
phone_number?: string;
|
|
1973
|
+
/**
|
|
1974
|
+
* Event type describing what changed.
|
|
1975
|
+
* @see AccountUpdateEvent
|
|
1976
|
+
*/
|
|
1902
1977
|
event: AccountUpdateEvent;
|
|
1978
|
+
/**
|
|
1979
|
+
* ISO 3166-1 alpha-2 country code.
|
|
1980
|
+
* Only included for BUSINESS_PRIMARY_LOCATION_COUNTRY_UPDATE events.
|
|
1981
|
+
*/
|
|
1982
|
+
country?: string;
|
|
1983
|
+
/** Present on DISABLED_UPDATE events */
|
|
1903
1984
|
ban_info?: AccountUpdateBanInfo;
|
|
1985
|
+
/** Present on ACCOUNT_VIOLATION events */
|
|
1904
1986
|
violation_info?: AccountUpdateViolationInfo;
|
|
1987
|
+
/** Present on ACCOUNT_RESTRICTION events */
|
|
1905
1988
|
restriction_info?: AccountUpdateRestrictionInfo[];
|
|
1989
|
+
/** Present on partner-related and AD_ACCOUNT_LINKED events */
|
|
1906
1990
|
waba_info?: AccountUpdateWabaInfo;
|
|
1991
|
+
/** Present on AUTH_INTL_PRICE_ELIGIBILITY_UPDATE events */
|
|
1992
|
+
auth_international_rate_eligibility?: AuthInternationalRateEligibility;
|
|
1993
|
+
/** Present on VOLUME_BASED_PRICING_TIER_UPDATE events */
|
|
1994
|
+
volume_tier_info?: VolumeTierInfo;
|
|
1995
|
+
/** Present on PARTNER_REMOVED events where business used WhatsApp Business app + Cloud API */
|
|
1996
|
+
disconnection_info?: DisconnectionInfo;
|
|
1997
|
+
/** Present on PARTNER_CLIENT_CERTIFICATION_STATUS_UPDATE events */
|
|
1998
|
+
partner_client_certification_info?: PartnerClientCertificationInfo;
|
|
1907
1999
|
}
|
|
1908
2000
|
interface AccountUpdateWebhookValue {
|
|
1909
2001
|
field: 'account_update';
|
|
@@ -1953,6 +2045,44 @@ interface AccountAlertsWebhookValue {
|
|
|
1953
2045
|
field: 'account_alerts';
|
|
1954
2046
|
value: AccountAlertsValue;
|
|
1955
2047
|
}
|
|
2048
|
+
interface AccountSettingsCallingConfig {
|
|
2049
|
+
/** Whether calling is enabled for this phone number */
|
|
2050
|
+
status: 'ENABLED' | 'DISABLED' | string;
|
|
2051
|
+
/** Visibility of the call icon in WhatsApp */
|
|
2052
|
+
call_icon_visibility?: string;
|
|
2053
|
+
/** Status of callback permission */
|
|
2054
|
+
callback_permission_status?: 'ENABLED' | 'DISABLED' | string;
|
|
2055
|
+
/** Call hours configuration */
|
|
2056
|
+
call_hours?: {
|
|
2057
|
+
status: 'ENABLED' | 'DISABLED' | string;
|
|
2058
|
+
};
|
|
2059
|
+
/** SIP (Session Initiation Protocol) configuration */
|
|
2060
|
+
sip?: {
|
|
2061
|
+
status: 'ENABLED' | 'DISABLED' | string;
|
|
2062
|
+
};
|
|
2063
|
+
}
|
|
2064
|
+
interface AccountSettingsPhoneNumberSettings {
|
|
2065
|
+
/** The phone number ID these settings apply to */
|
|
2066
|
+
phone_number_id: string;
|
|
2067
|
+
/** Calling feature configuration */
|
|
2068
|
+
calling?: AccountSettingsCallingConfig;
|
|
2069
|
+
}
|
|
2070
|
+
interface AccountSettingsUpdateValue {
|
|
2071
|
+
messaging_product: 'whatsapp';
|
|
2072
|
+
/** Unix timestamp of the settings change */
|
|
2073
|
+
timestamp: string;
|
|
2074
|
+
/**
|
|
2075
|
+
* Type of settings that changed.
|
|
2076
|
+
* Known value: "phone_number_settings"
|
|
2077
|
+
*/
|
|
2078
|
+
type: 'phone_number_settings' | string;
|
|
2079
|
+
/** Present when type is "phone_number_settings" */
|
|
2080
|
+
phone_number_settings?: AccountSettingsPhoneNumberSettings;
|
|
2081
|
+
}
|
|
2082
|
+
interface AccountSettingsUpdateWebhookValue {
|
|
2083
|
+
field: 'account_settings_update';
|
|
2084
|
+
value: AccountSettingsUpdateValue;
|
|
2085
|
+
}
|
|
1956
2086
|
//#endregion
|
|
1957
2087
|
//#region src/core/webhook/types/common.d.ts
|
|
1958
2088
|
/**
|
|
@@ -2080,6 +2210,121 @@ interface BusinessCapabilityUpdateWebhookValue {
|
|
|
2080
2210
|
field: 'business_capability_update';
|
|
2081
2211
|
value: BusinessCapabilityUpdateValue;
|
|
2082
2212
|
}
|
|
2213
|
+
type BusinessStatusUpdateEvent = 'ACCOUNT_DELETED' | 'ACCOUNT_RESTRICTION' | 'ACCOUNT_VIOLATION' | 'DISABLED_UPDATE' | string;
|
|
2214
|
+
interface BusinessStatusUpdateValue {
|
|
2215
|
+
/** Event type describing the status change */
|
|
2216
|
+
event: BusinessStatusUpdateEvent;
|
|
2217
|
+
[key: string]: unknown;
|
|
2218
|
+
}
|
|
2219
|
+
interface BusinessStatusUpdateWebhookValue {
|
|
2220
|
+
field: 'business_status_update';
|
|
2221
|
+
value: BusinessStatusUpdateValue;
|
|
2222
|
+
}
|
|
2223
|
+
//#endregion
|
|
2224
|
+
//#region src/core/webhook/types/calls.d.ts
|
|
2225
|
+
/**
|
|
2226
|
+
* Lifecycle event type for a call.
|
|
2227
|
+
*
|
|
2228
|
+
* - "connect" — Call initiated; for consumer-initiated calls, respond with action=accept
|
|
2229
|
+
* - "call_status" — Business-initiated call started ringing or was accepted (business-initiated only)
|
|
2230
|
+
* - "media_update" — Consumer-side media event; apply the new SDP to your peer connection (business-initiated only)
|
|
2231
|
+
* - "terminate" — Call ended for any reason
|
|
2232
|
+
*/
|
|
2233
|
+
type CallEventType = 'connect' | 'call_status' | 'media_update' | 'terminate';
|
|
2234
|
+
/**
|
|
2235
|
+
* Direction of the call.
|
|
2236
|
+
*
|
|
2237
|
+
* - "business_initiated" — The business placed the call
|
|
2238
|
+
* - "user_initiated" — The user placed the call
|
|
2239
|
+
*/
|
|
2240
|
+
type CallDirection = 'business_initiated' | 'user_initiated';
|
|
2241
|
+
/**
|
|
2242
|
+
* Status for business-initiated calls (call_status event).
|
|
2243
|
+
*
|
|
2244
|
+
* - "ringing" — The outgoing call is ringing on the consumer's device
|
|
2245
|
+
* - "accepted" — The consumer accepted the call
|
|
2246
|
+
*/
|
|
2247
|
+
type CallStatusValue = 'ringing' | 'accepted';
|
|
2248
|
+
/**
|
|
2249
|
+
* Final call outcome (terminate event).
|
|
2250
|
+
*
|
|
2251
|
+
* - "Completed" — Call finished normally (includes calls rejected by either party)
|
|
2252
|
+
* - "Failed" — Call failed mid-connection
|
|
2253
|
+
*/
|
|
2254
|
+
type CallTerminateStatus = 'Completed' | 'Failed';
|
|
2255
|
+
interface CallSdpRenegotiation {
|
|
2256
|
+
/** SDP type — always "offer" for incoming media_update events */
|
|
2257
|
+
sdp_type: 'offer';
|
|
2258
|
+
/** SDP data compliant with RFC 4566 */
|
|
2259
|
+
sdp: string;
|
|
2260
|
+
}
|
|
2261
|
+
interface CallSession$1 {
|
|
2262
|
+
/**
|
|
2263
|
+
* Incremented each time Meta provides new SDP.
|
|
2264
|
+
* If multiple media_update webhooks arrive, apply the one with the highest version.
|
|
2265
|
+
*/
|
|
2266
|
+
version: number;
|
|
2267
|
+
/** Contains the SDP offer from Meta; generate an answer and apply to your peer connection */
|
|
2268
|
+
sdp_renegotiation: CallSdpRenegotiation;
|
|
2269
|
+
}
|
|
2270
|
+
interface CallEntry {
|
|
2271
|
+
/** Unique ID for the call — use in accept / reject / terminate API calls */
|
|
2272
|
+
id: string;
|
|
2273
|
+
/**
|
|
2274
|
+
* Lifecycle event type.
|
|
2275
|
+
* @see CallEventType
|
|
2276
|
+
*/
|
|
2277
|
+
event: CallEventType;
|
|
2278
|
+
/** Unix timestamp */
|
|
2279
|
+
timestamp: number;
|
|
2280
|
+
/** Callee of the call (Page ID) — present on connect */
|
|
2281
|
+
to?: string;
|
|
2282
|
+
/** Caller of the call (PSID) — present on connect */
|
|
2283
|
+
from?: string;
|
|
2284
|
+
/** Whether the call was business- or user-initiated — present on connect */
|
|
2285
|
+
call_direction?: CallDirection;
|
|
2286
|
+
/** PSID of the consumer — present on call_status */
|
|
2287
|
+
recipient_id?: string;
|
|
2288
|
+
/** Ringing or accepted — present on call_status */
|
|
2289
|
+
call_status?: CallStatusValue;
|
|
2290
|
+
/** SDP session information; apply the offer to your local peer connection — present on media_update */
|
|
2291
|
+
session?: CallSession$1;
|
|
2292
|
+
/** Final status of the call — present on terminate */
|
|
2293
|
+
status?: CallTerminateStatus;
|
|
2294
|
+
/** When the call started (Unix timestamp) — present on terminate */
|
|
2295
|
+
start_time?: number;
|
|
2296
|
+
/** When the call ended (Unix timestamp) — present on terminate */
|
|
2297
|
+
end_time?: number;
|
|
2298
|
+
/**
|
|
2299
|
+
* Call duration in seconds, counted from when the business connects.
|
|
2300
|
+
* Empty if the business did not successfully connect.
|
|
2301
|
+
* Present on terminate.
|
|
2302
|
+
*/
|
|
2303
|
+
duration?: number;
|
|
2304
|
+
}
|
|
2305
|
+
interface CallContact {
|
|
2306
|
+
profile: {
|
|
2307
|
+
/** Display name of the caller */
|
|
2308
|
+
name: string;
|
|
2309
|
+
};
|
|
2310
|
+
/** WhatsApp ID of the caller */
|
|
2311
|
+
wa_id: string;
|
|
2312
|
+
}
|
|
2313
|
+
interface CallsValue {
|
|
2314
|
+
messaging_product: 'whatsapp';
|
|
2315
|
+
metadata: {
|
|
2316
|
+
display_phone_number: string;
|
|
2317
|
+
phone_number_id: string;
|
|
2318
|
+
};
|
|
2319
|
+
/** Array of call lifecycle events */
|
|
2320
|
+
calls: CallEntry[];
|
|
2321
|
+
/** Contact profile information for the caller */
|
|
2322
|
+
contacts?: CallContact[];
|
|
2323
|
+
}
|
|
2324
|
+
interface CallsWebhookValue {
|
|
2325
|
+
field: 'calls';
|
|
2326
|
+
value: CallsValue;
|
|
2327
|
+
}
|
|
2083
2328
|
//#endregion
|
|
2084
2329
|
//#region src/core/webhook/types/flows.d.ts
|
|
2085
2330
|
/**
|
|
@@ -2129,6 +2374,165 @@ interface FlowsWebhookValue {
|
|
|
2129
2374
|
value: FlowsValue;
|
|
2130
2375
|
}
|
|
2131
2376
|
//#endregion
|
|
2377
|
+
//#region src/core/webhook/types/groups.d.ts
|
|
2378
|
+
interface GroupWebhookError {
|
|
2379
|
+
/** Error code */
|
|
2380
|
+
code: string;
|
|
2381
|
+
/** Human-readable error message */
|
|
2382
|
+
message: string;
|
|
2383
|
+
/** Short title for the error */
|
|
2384
|
+
title: string;
|
|
2385
|
+
error_data?: {
|
|
2386
|
+
/** Detailed error description */
|
|
2387
|
+
details: string;
|
|
2388
|
+
};
|
|
2389
|
+
}
|
|
2390
|
+
interface GroupAddedParticipant {
|
|
2391
|
+
/** WhatsApp ID of the participant */
|
|
2392
|
+
wa_id: string;
|
|
2393
|
+
/** Phone number input provided when adding (optional) */
|
|
2394
|
+
input?: string;
|
|
2395
|
+
}
|
|
2396
|
+
interface GroupRemovedParticipant {
|
|
2397
|
+
/** Phone number or WhatsApp ID of the removed participant */
|
|
2398
|
+
input: string;
|
|
2399
|
+
}
|
|
2400
|
+
interface GroupFailedParticipant {
|
|
2401
|
+
/** Phone number or WhatsApp ID that failed */
|
|
2402
|
+
input: string;
|
|
2403
|
+
errors: GroupWebhookError[];
|
|
2404
|
+
}
|
|
2405
|
+
type GroupLifecycleEventType = 'group_create' | 'group_delete';
|
|
2406
|
+
interface GroupLifecycleEntry {
|
|
2407
|
+
/** Unix timestamp of the event */
|
|
2408
|
+
timestamp: string;
|
|
2409
|
+
/** The group's WhatsApp ID */
|
|
2410
|
+
group_id: string;
|
|
2411
|
+
/** Event type: group_create or group_delete */
|
|
2412
|
+
type: GroupLifecycleEventType;
|
|
2413
|
+
/** Correlation ID for the API request that triggered this event */
|
|
2414
|
+
request_id: string;
|
|
2415
|
+
/** Group subject/name — present on group_create */
|
|
2416
|
+
subject?: string;
|
|
2417
|
+
/** Group description — present on group_create */
|
|
2418
|
+
description?: string;
|
|
2419
|
+
/** Invite link for the group — present on successful group_create */
|
|
2420
|
+
invite_link?: string;
|
|
2421
|
+
/** Whether users need admin approval to join — present on group_create */
|
|
2422
|
+
join_approval_mode?: string;
|
|
2423
|
+
/** Present when the operation failed */
|
|
2424
|
+
errors?: GroupWebhookError[];
|
|
2425
|
+
}
|
|
2426
|
+
interface GroupLifecycleUpdateValue {
|
|
2427
|
+
messaging_product: 'whatsapp';
|
|
2428
|
+
metadata: WebhookMetadata;
|
|
2429
|
+
/** Array of group lifecycle events */
|
|
2430
|
+
groups: GroupLifecycleEntry[];
|
|
2431
|
+
}
|
|
2432
|
+
interface GroupLifecycleUpdateWebhookValue {
|
|
2433
|
+
field: 'group_lifecycle_update';
|
|
2434
|
+
value: GroupLifecycleUpdateValue;
|
|
2435
|
+
}
|
|
2436
|
+
type GroupParticipantsEventType = 'group_participants_add' | 'group_participants_remove' | 'group_join_request_created' | 'group_join_request_revoked';
|
|
2437
|
+
type GroupParticipantsAddReason = 'invite_link' | 'admin_added';
|
|
2438
|
+
/** Who initiated the remove action */
|
|
2439
|
+
type GroupParticipantsInitiatedBy = 'business' | 'participant';
|
|
2440
|
+
interface GroupParticipantsEntry {
|
|
2441
|
+
/** Unix timestamp of the event */
|
|
2442
|
+
timestamp: string;
|
|
2443
|
+
/** The group's WhatsApp ID */
|
|
2444
|
+
group_id: string;
|
|
2445
|
+
/** Event type */
|
|
2446
|
+
type: GroupParticipantsEventType;
|
|
2447
|
+
/** Correlation ID for the API request */
|
|
2448
|
+
request_id?: string;
|
|
2449
|
+
/** Reason participants were added (e.g. invite_link) */
|
|
2450
|
+
reason?: GroupParticipantsAddReason | string;
|
|
2451
|
+
/** Participants successfully added */
|
|
2452
|
+
added_participants?: GroupAddedParticipant[];
|
|
2453
|
+
/** Whether business or participant initiated the removal */
|
|
2454
|
+
initiated_by?: GroupParticipantsInitiatedBy;
|
|
2455
|
+
/** Participants successfully removed */
|
|
2456
|
+
removed_participants?: GroupRemovedParticipant[];
|
|
2457
|
+
/** Participants that could not be removed */
|
|
2458
|
+
failed_participants?: GroupFailedParticipant[];
|
|
2459
|
+
/** ID of the join request */
|
|
2460
|
+
join_request_id?: string;
|
|
2461
|
+
/** WhatsApp ID of the user who submitted or cancelled the request */
|
|
2462
|
+
wa_id?: string;
|
|
2463
|
+
/** Present when the operation partially or fully failed */
|
|
2464
|
+
errors?: GroupWebhookError[];
|
|
2465
|
+
}
|
|
2466
|
+
interface GroupParticipantsUpdateValue {
|
|
2467
|
+
messaging_product: 'whatsapp';
|
|
2468
|
+
metadata: WebhookMetadata;
|
|
2469
|
+
/** Array of participant update events */
|
|
2470
|
+
groups: GroupParticipantsEntry[];
|
|
2471
|
+
}
|
|
2472
|
+
interface GroupParticipantsUpdateWebhookValue {
|
|
2473
|
+
field: 'group_participants_update';
|
|
2474
|
+
value: GroupParticipantsUpdateValue;
|
|
2475
|
+
}
|
|
2476
|
+
interface GroupSettingFieldResult {
|
|
2477
|
+
/** Whether this specific field was successfully updated */
|
|
2478
|
+
update_successful: boolean;
|
|
2479
|
+
/** Present on profile_picture updates */
|
|
2480
|
+
mime_type?: string;
|
|
2481
|
+
/** SHA-256 hash of the uploaded image — present on profile_picture updates */
|
|
2482
|
+
sha256?: string;
|
|
2483
|
+
/** New text value — present on group_subject / group_description updates */
|
|
2484
|
+
text?: string;
|
|
2485
|
+
/** Present when update_successful is false */
|
|
2486
|
+
errors?: GroupWebhookError[];
|
|
2487
|
+
}
|
|
2488
|
+
interface GroupSettingsEntry {
|
|
2489
|
+
/** Unix timestamp of the event */
|
|
2490
|
+
timestamp: string;
|
|
2491
|
+
/** The group's WhatsApp ID */
|
|
2492
|
+
group_id: string;
|
|
2493
|
+
/** Always "group_settings_update" */
|
|
2494
|
+
type: 'group_settings_update';
|
|
2495
|
+
/** Correlation ID for the API request */
|
|
2496
|
+
request_id?: string;
|
|
2497
|
+
/** Result of the profile picture update */
|
|
2498
|
+
profile_picture?: GroupSettingFieldResult;
|
|
2499
|
+
/** Result of the group subject (name) update */
|
|
2500
|
+
group_subject?: GroupSettingFieldResult;
|
|
2501
|
+
/** Result of the group description update */
|
|
2502
|
+
group_description?: GroupSettingFieldResult;
|
|
2503
|
+
/** Top-level errors when the entire update failed */
|
|
2504
|
+
errors?: GroupWebhookError[];
|
|
2505
|
+
}
|
|
2506
|
+
interface GroupSettingsUpdateValue {
|
|
2507
|
+
messaging_product: 'whatsapp';
|
|
2508
|
+
metadata: WebhookMetadata;
|
|
2509
|
+
/** Array of group settings update events */
|
|
2510
|
+
groups: GroupSettingsEntry[];
|
|
2511
|
+
}
|
|
2512
|
+
interface GroupSettingsUpdateWebhookValue {
|
|
2513
|
+
field: 'group_settings_update';
|
|
2514
|
+
value: GroupSettingsUpdateValue;
|
|
2515
|
+
}
|
|
2516
|
+
type GroupStatusEventType = 'group_suspend' | 'group_suspend_cleared';
|
|
2517
|
+
interface GroupStatusEntry {
|
|
2518
|
+
/** Unix timestamp of the event */
|
|
2519
|
+
timestamp: string;
|
|
2520
|
+
/** The group's WhatsApp ID */
|
|
2521
|
+
group_id: string;
|
|
2522
|
+
/** Event type: group_suspend or group_suspend_cleared */
|
|
2523
|
+
type: GroupStatusEventType;
|
|
2524
|
+
}
|
|
2525
|
+
interface GroupStatusUpdateValue {
|
|
2526
|
+
messaging_product: 'whatsapp';
|
|
2527
|
+
metadata: WebhookMetadata;
|
|
2528
|
+
/** Array of group status events */
|
|
2529
|
+
groups: GroupStatusEntry[];
|
|
2530
|
+
}
|
|
2531
|
+
interface GroupStatusUpdateWebhookValue {
|
|
2532
|
+
field: 'group_status_update';
|
|
2533
|
+
value: GroupStatusUpdateValue;
|
|
2534
|
+
}
|
|
2535
|
+
//#endregion
|
|
2132
2536
|
//#region src/core/webhook/types/message.d.ts
|
|
2133
2537
|
/**
|
|
2134
2538
|
* Base message properties common to all message types
|
|
@@ -2419,6 +2823,75 @@ interface HistoryWebhookValue {
|
|
|
2419
2823
|
value: HistoryValue;
|
|
2420
2824
|
}
|
|
2421
2825
|
//#endregion
|
|
2826
|
+
//#region src/core/webhook/types/marketing.d.ts
|
|
2827
|
+
/**
|
|
2828
|
+
* Detected event type.
|
|
2829
|
+
* Sample payload uses lowercase ("purchase"), docs use PascalCase ("Purchase").
|
|
2830
|
+
* Accept both forms.
|
|
2831
|
+
*/
|
|
2832
|
+
type AutomaticEventName = 'LeadSubmitted' | 'Purchase' | 'purchase' | 'lead_submitted' | string;
|
|
2833
|
+
interface AutomaticEventCustomData {
|
|
2834
|
+
/** ISO 4217 currency code (e.g. "USD") — present on Purchase events */
|
|
2835
|
+
currency: string;
|
|
2836
|
+
/** Monetary value of the purchase — present on Purchase events */
|
|
2837
|
+
value: number;
|
|
2838
|
+
}
|
|
2839
|
+
interface AutomaticEvent {
|
|
2840
|
+
/** WhatsApp message ID that triggered the event detection */
|
|
2841
|
+
id: string;
|
|
2842
|
+
/**
|
|
2843
|
+
* Detected event type.
|
|
2844
|
+
* @see AutomaticEventName
|
|
2845
|
+
*/
|
|
2846
|
+
event_name: AutomaticEventName;
|
|
2847
|
+
/** Unix timestamp of when the event was detected */
|
|
2848
|
+
timestamp: number;
|
|
2849
|
+
/**
|
|
2850
|
+
* Click-to-WhatsApp ad click ID — use with Conversions API.
|
|
2851
|
+
* Present when the event originated from a Click-to-WhatsApp ad.
|
|
2852
|
+
*/
|
|
2853
|
+
ctwa_clid?: string;
|
|
2854
|
+
/** Present on Purchase events */
|
|
2855
|
+
custom_data?: AutomaticEventCustomData;
|
|
2856
|
+
}
|
|
2857
|
+
interface AutomaticEventsValue {
|
|
2858
|
+
messaging_product: 'whatsapp';
|
|
2859
|
+
metadata: WebhookMetadata;
|
|
2860
|
+
/** Array of detected automatic events */
|
|
2861
|
+
automatic_events: AutomaticEvent[];
|
|
2862
|
+
}
|
|
2863
|
+
interface AutomaticEventsWebhookValue {
|
|
2864
|
+
field: 'automatic_events';
|
|
2865
|
+
value: AutomaticEventsValue;
|
|
2866
|
+
}
|
|
2867
|
+
interface TrackingEventData {
|
|
2868
|
+
/** Unique identifier for the click, also appended to the destination URL */
|
|
2869
|
+
click_id?: string;
|
|
2870
|
+
/** Internal Meta token for processing and tracking */
|
|
2871
|
+
tracking_token?: string;
|
|
2872
|
+
}
|
|
2873
|
+
interface TrackingEvent {
|
|
2874
|
+
/**
|
|
2875
|
+
* Name of the tracked event.
|
|
2876
|
+
* Known values: "sent"
|
|
2877
|
+
*/
|
|
2878
|
+
event_name: string;
|
|
2879
|
+
/** Unix timestamp of the event */
|
|
2880
|
+
timestamp: number;
|
|
2881
|
+
/** Tracking data associated with the event */
|
|
2882
|
+
tracking_data?: TrackingEventData;
|
|
2883
|
+
}
|
|
2884
|
+
interface TrackingEventsValue {
|
|
2885
|
+
messaging_product: 'whatsapp';
|
|
2886
|
+
metadata: WebhookMetadata;
|
|
2887
|
+
/** Array of tracking events */
|
|
2888
|
+
events: TrackingEvent[];
|
|
2889
|
+
}
|
|
2890
|
+
interface TrackingEventsWebhookValue {
|
|
2891
|
+
field: 'tracking_events';
|
|
2892
|
+
value: TrackingEventsValue;
|
|
2893
|
+
}
|
|
2894
|
+
//#endregion
|
|
2422
2895
|
//#region src/core/webhook/types/messageEchoes.d.ts
|
|
2423
2896
|
/**
|
|
2424
2897
|
* Message echo error
|
|
@@ -2474,6 +2947,179 @@ interface SmbMessageEchoesWebhookValue {
|
|
|
2474
2947
|
field: 'smb_message_echoes';
|
|
2475
2948
|
value: SmbMessageEchoesValue;
|
|
2476
2949
|
}
|
|
2950
|
+
interface MessageEchoSender {
|
|
2951
|
+
/** Page ID that sent the message */
|
|
2952
|
+
id: string;
|
|
2953
|
+
}
|
|
2954
|
+
interface MessageEchoRecipient {
|
|
2955
|
+
/** Page-scoped ID of the user who received the message */
|
|
2956
|
+
id: string;
|
|
2957
|
+
}
|
|
2958
|
+
interface MessageEchoAttachment {
|
|
2959
|
+
/** Attachment type: image, audio, video, file, template, fallback */
|
|
2960
|
+
type: string;
|
|
2961
|
+
/** URL of the attachment or fallback URL */
|
|
2962
|
+
url?: string;
|
|
2963
|
+
/** Template payload for template attachments */
|
|
2964
|
+
payload?: unknown;
|
|
2965
|
+
title?: string;
|
|
2966
|
+
}
|
|
2967
|
+
interface MessageEchoBody {
|
|
2968
|
+
/** Indicates the message was sent by the page */
|
|
2969
|
+
is_echo: true;
|
|
2970
|
+
/** ID of the app that sent the message */
|
|
2971
|
+
app_id: number;
|
|
2972
|
+
/** Custom metadata string set in the Send API request */
|
|
2973
|
+
metadata?: string;
|
|
2974
|
+
/** Message ID */
|
|
2975
|
+
mid: string;
|
|
2976
|
+
/** Text content — present on text messages */
|
|
2977
|
+
text?: string;
|
|
2978
|
+
/** Attachments — present on media/template messages */
|
|
2979
|
+
attachments?: MessageEchoAttachment[];
|
|
2980
|
+
}
|
|
2981
|
+
interface MessageEchoEntry {
|
|
2982
|
+
sender: MessageEchoSender;
|
|
2983
|
+
recipient: MessageEchoRecipient;
|
|
2984
|
+
/** Unix timestamp in milliseconds */
|
|
2985
|
+
timestamp: number;
|
|
2986
|
+
message: MessageEchoBody;
|
|
2987
|
+
}
|
|
2988
|
+
interface MessageEchoesValue {
|
|
2989
|
+
/** Array of echoed messages */
|
|
2990
|
+
messaging: MessageEchoEntry[];
|
|
2991
|
+
}
|
|
2992
|
+
interface MessageEchoesWebhookValue {
|
|
2993
|
+
field: 'message_echoes';
|
|
2994
|
+
value: MessageEchoesValue;
|
|
2995
|
+
}
|
|
2996
|
+
//#endregion
|
|
2997
|
+
//#region src/core/webhook/types/messaging.d.ts
|
|
2998
|
+
interface MessagingHandoverControlPassed {
|
|
2999
|
+
/** Optional metadata string passed with the handover */
|
|
3000
|
+
metadata?: string;
|
|
3001
|
+
}
|
|
3002
|
+
interface MessagingHandoversValue {
|
|
3003
|
+
messaging_product: 'whatsapp';
|
|
3004
|
+
/** The business phone number that received the handover event */
|
|
3005
|
+
recipient: {
|
|
3006
|
+
display_phone_number: string;
|
|
3007
|
+
phone_number_id: string;
|
|
3008
|
+
};
|
|
3009
|
+
/** The user involved in the handover */
|
|
3010
|
+
sender: {
|
|
3011
|
+
phone_number: string;
|
|
3012
|
+
};
|
|
3013
|
+
/** Unix timestamp of the event */
|
|
3014
|
+
timestamp: string;
|
|
3015
|
+
/** Present when thread control is passed to another app */
|
|
3016
|
+
control_passed?: MessagingHandoverControlPassed;
|
|
3017
|
+
}
|
|
3018
|
+
interface MessagingHandoversWebhookValue {
|
|
3019
|
+
field: 'messaging_handovers';
|
|
3020
|
+
value: MessagingHandoversValue;
|
|
3021
|
+
}
|
|
3022
|
+
interface StandbyValue {
|
|
3023
|
+
messaging_product: 'whatsapp';
|
|
3024
|
+
[key: string]: unknown;
|
|
3025
|
+
}
|
|
3026
|
+
interface StandbyWebhookValue {
|
|
3027
|
+
field: 'standby';
|
|
3028
|
+
value: StandbyValue;
|
|
3029
|
+
}
|
|
3030
|
+
interface UserPreferenceEntry {
|
|
3031
|
+
/** WhatsApp ID of the user */
|
|
3032
|
+
wa_id: string;
|
|
3033
|
+
/** Meta user ID (e.g. "US.1234567") */
|
|
3034
|
+
user_id: string;
|
|
3035
|
+
/** Human-readable description of the preference change */
|
|
3036
|
+
detail: string;
|
|
3037
|
+
/**
|
|
3038
|
+
* Category of the preference that changed.
|
|
3039
|
+
* Known value: "marketing_messages"
|
|
3040
|
+
*/
|
|
3041
|
+
category: 'marketing_messages' | string;
|
|
3042
|
+
/**
|
|
3043
|
+
* New preference value.
|
|
3044
|
+
* Known value: "stop" (user opted out)
|
|
3045
|
+
*/
|
|
3046
|
+
value: 'stop' | string;
|
|
3047
|
+
/** Unix timestamp of when the preference was changed */
|
|
3048
|
+
timestamp: number;
|
|
3049
|
+
/** Signup ID associated with the preference, if applicable */
|
|
3050
|
+
signup_id?: string;
|
|
3051
|
+
}
|
|
3052
|
+
interface UserPreferencesContact {
|
|
3053
|
+
profile: {
|
|
3054
|
+
/** Display name of the user */
|
|
3055
|
+
name: string;
|
|
3056
|
+
/** WhatsApp username, if available */
|
|
3057
|
+
username?: string;
|
|
3058
|
+
};
|
|
3059
|
+
/** WhatsApp ID of the user */
|
|
3060
|
+
wa_id: string;
|
|
3061
|
+
/** Meta user ID */
|
|
3062
|
+
user_id?: string;
|
|
3063
|
+
}
|
|
3064
|
+
interface UserPreferencesValue {
|
|
3065
|
+
messaging_product: 'whatsapp';
|
|
3066
|
+
metadata: WebhookMetadata;
|
|
3067
|
+
/** Array of user preference change events */
|
|
3068
|
+
user_preferences: UserPreferenceEntry[];
|
|
3069
|
+
/** Contact profile information for the users */
|
|
3070
|
+
contacts?: UserPreferencesContact[];
|
|
3071
|
+
}
|
|
3072
|
+
interface UserPreferencesWebhookValue {
|
|
3073
|
+
field: 'user_preferences';
|
|
3074
|
+
value: UserPreferencesValue;
|
|
3075
|
+
}
|
|
3076
|
+
//#endregion
|
|
3077
|
+
//#region src/core/webhook/types/partner.d.ts
|
|
3078
|
+
/**
|
|
3079
|
+
* Partner solution event types.
|
|
3080
|
+
* Known value: "SOLUTION_CREATED"
|
|
3081
|
+
*/
|
|
3082
|
+
type PartnerSolutionEvent = 'SOLUTION_CREATED' | string;
|
|
3083
|
+
/**
|
|
3084
|
+
* Partner solution status values.
|
|
3085
|
+
* Known value: "INITIATED"
|
|
3086
|
+
*/
|
|
3087
|
+
type PartnerSolutionStatus = 'INITIATED' | string;
|
|
3088
|
+
interface PartnerSolutionsValue {
|
|
3089
|
+
/** Type of partner solution event */
|
|
3090
|
+
event: PartnerSolutionEvent;
|
|
3091
|
+
/** Unique identifier for the partner solution */
|
|
3092
|
+
solution_id: string;
|
|
3093
|
+
/** Current status of the partner solution */
|
|
3094
|
+
solution_status: PartnerSolutionStatus;
|
|
3095
|
+
}
|
|
3096
|
+
interface PartnerSolutionsWebhookValue {
|
|
3097
|
+
field: 'partner_solutions';
|
|
3098
|
+
value: PartnerSolutionsValue;
|
|
3099
|
+
}
|
|
3100
|
+
//#endregion
|
|
3101
|
+
//#region src/core/webhook/types/payments.d.ts
|
|
3102
|
+
interface PaymentConfigurationUpdateValue {
|
|
3103
|
+
/** Name of the payment configuration */
|
|
3104
|
+
configuration_name: string;
|
|
3105
|
+
/** Payment provider name (e.g. "razorpay") */
|
|
3106
|
+
provider_name: string;
|
|
3107
|
+
/** Merchant ID assigned by the payment provider */
|
|
3108
|
+
provider_mid: string;
|
|
3109
|
+
/**
|
|
3110
|
+
* Current status of the payment configuration.
|
|
3111
|
+
* Known values: "Needs Testing"
|
|
3112
|
+
*/
|
|
3113
|
+
status: string;
|
|
3114
|
+
/** Unix timestamp of when the configuration was created */
|
|
3115
|
+
created_timestamp: number;
|
|
3116
|
+
/** Unix timestamp of when the configuration was last updated */
|
|
3117
|
+
updated_timestamp: number;
|
|
3118
|
+
}
|
|
3119
|
+
interface PaymentConfigurationUpdateWebhookValue {
|
|
3120
|
+
field: 'payment_configuration_update';
|
|
3121
|
+
value: PaymentConfigurationUpdateValue;
|
|
3122
|
+
}
|
|
2477
3123
|
//#endregion
|
|
2478
3124
|
//#region src/core/webhook/types/phoneNumber.d.ts
|
|
2479
3125
|
/**
|
|
@@ -2615,6 +3261,37 @@ interface MessageTemplateQualityUpdateWebhookValue {
|
|
|
2615
3261
|
field: 'message_template_quality_update';
|
|
2616
3262
|
value: MessageTemplateQualityUpdateValue;
|
|
2617
3263
|
}
|
|
3264
|
+
interface MessageTemplateComponentsUpdateValue {
|
|
3265
|
+
/** Numeric ID of the message template */
|
|
3266
|
+
message_template_id: number;
|
|
3267
|
+
/** Name of the message template */
|
|
3268
|
+
message_template_name: string;
|
|
3269
|
+
/** Language code of the message template (e.g. "en_US") */
|
|
3270
|
+
message_template_language: string;
|
|
3271
|
+
/** Event describing what changed */
|
|
3272
|
+
event: string;
|
|
3273
|
+
[key: string]: unknown;
|
|
3274
|
+
}
|
|
3275
|
+
interface MessageTemplateComponentsUpdateWebhookValue {
|
|
3276
|
+
field: 'message_template_components_update';
|
|
3277
|
+
value: MessageTemplateComponentsUpdateValue;
|
|
3278
|
+
}
|
|
3279
|
+
interface TemplateCorrectCategoryDetectionValue {
|
|
3280
|
+
/** Numeric ID of the affected message template */
|
|
3281
|
+
message_template_id: number;
|
|
3282
|
+
/** Name of the affected message template */
|
|
3283
|
+
message_template_name: string;
|
|
3284
|
+
/** Language code of the affected message template (e.g. "en_US") */
|
|
3285
|
+
message_template_language: string;
|
|
3286
|
+
/** The category WhatsApp determined the template should belong to */
|
|
3287
|
+
suggested_category: TemplateCategory;
|
|
3288
|
+
/** The template's current (approved) category */
|
|
3289
|
+
current_category: TemplateCategory;
|
|
3290
|
+
}
|
|
3291
|
+
interface TemplateCorrectCategoryDetectionWebhookValue {
|
|
3292
|
+
field: 'template_correct_category_detection';
|
|
3293
|
+
value: TemplateCorrectCategoryDetectionValue;
|
|
3294
|
+
}
|
|
2618
3295
|
//#endregion
|
|
2619
3296
|
//#region src/core/webhook/types/index.d.ts
|
|
2620
3297
|
/**
|
|
@@ -2649,7 +3326,7 @@ type WebhookValue = MessageWebhookValue | StatusWebhookValue | ErrorWebhookValue
|
|
|
2649
3326
|
/**
|
|
2650
3327
|
* Union type for all webhook field values
|
|
2651
3328
|
*/
|
|
2652
|
-
type WebhookFieldValue = AccountUpdateWebhookValue | AccountReviewUpdateWebhookValue | AccountAlertsWebhookValue | BusinessCapabilityUpdateWebhookValue |
|
|
3329
|
+
type WebhookFieldValue = AccountUpdateWebhookValue | AccountReviewUpdateWebhookValue | AccountAlertsWebhookValue | AccountSettingsUpdateWebhookValue | AutomaticEventsWebhookValue | BusinessCapabilityUpdateWebhookValue | BusinessStatusUpdateWebhookValue | CallsWebhookValue | FlowsWebhookValue | GroupLifecycleUpdateWebhookValue | GroupParticipantsUpdateWebhookValue | GroupSettingsUpdateWebhookValue | GroupStatusUpdateWebhookValue | HistoryWebhookValue | MessageEchoesWebhookValue | MessageTemplateComponentsUpdateWebhookValue | MessageTemplateQualityUpdateWebhookValue | MessageTemplateStatusUpdateWebhookValue | MessagingHandoversWebhookValue | PartnerSolutionsWebhookValue | PaymentConfigurationUpdateWebhookValue | PhoneNumberNameUpdateWebhookValue | PhoneNumberQualityUpdateWebhookValue | SecurityWebhookValue | SmbAppStateSyncWebhookValue | SmbMessageEchoesWebhookValue | StandbyWebhookValue | TemplateCategoryUpdateWebhookValue | TemplateCorrectCategoryDetectionWebhookValue | TrackingEventsWebhookValue | UserPreferencesWebhookValue;
|
|
2653
3330
|
interface WebhookPayload {
|
|
2654
3331
|
object: 'whatsapp_business_account';
|
|
2655
3332
|
entry: Array<{
|