meta-cloud-api 2.2.0 → 2.4.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 +921 -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/index.d.ts
CHANGED
|
@@ -2881,43 +2881,135 @@ interface WABAClass {
|
|
|
2881
2881
|
//#endregion
|
|
2882
2882
|
//#region src/core/webhook/types/account.d.ts
|
|
2883
2883
|
/**
|
|
2884
|
-
*
|
|
2885
|
-
* @see https://developers.facebook.com/
|
|
2884
|
+
* WABA event types for account_update webhook.
|
|
2885
|
+
* @see https://developers.facebook.com/documentation/business-messaging/whatsapp/webhooks/reference/account_update
|
|
2886
2886
|
*/
|
|
2887
|
-
type AccountUpdateEvent = '
|
|
2887
|
+
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';
|
|
2888
2888
|
/**
|
|
2889
|
-
* WABA ban state
|
|
2890
|
-
* @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#value--ban_info
|
|
2889
|
+
* WABA ban state — present on DISABLED_UPDATE events.
|
|
2891
2890
|
*/
|
|
2892
2891
|
type WabaBanState = 'SCHEDULE_FOR_DISABLE' | 'DISABLE' | 'REINSTATE';
|
|
2893
2892
|
/**
|
|
2894
|
-
* Restriction types imposed on WABA
|
|
2895
|
-
* @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#value--restriction_info
|
|
2893
|
+
* Restriction types imposed on WABA — present on ACCOUNT_RESTRICTION events.
|
|
2896
2894
|
*/
|
|
2897
2895
|
type RestrictionType = 'RESTRICTION_ADD_PHONE_NUMBER_ACTION' | 'RESTRICTED_BIZ_INITIATED_MESSAGING' | 'RESTRICTED_CUSTOMER_INITIATED_MESSAGING';
|
|
2896
|
+
/**
|
|
2897
|
+
* Reason for the disconnection — present on PARTNER_REMOVED events where
|
|
2898
|
+
* the business used both WhatsApp Business app and Cloud API.
|
|
2899
|
+
*/
|
|
2900
|
+
type DisconnectionReason = 'ACCOUNT_DISCONNECTED' | 'BUSINESS_DOWNGRADE' | 'CHANGE_NUMBER' | 'COMPANION_INACTIVITY' | 'PRIMARY_INACTIVITY' | 'USER_RE_REGISTERED';
|
|
2901
|
+
/**
|
|
2902
|
+
* Who initiated the disconnection — present on PARTNER_REMOVED events.
|
|
2903
|
+
*/
|
|
2904
|
+
type DisconnectionInitiatedBy = 'SYSTEM' | 'USER';
|
|
2905
|
+
/**
|
|
2906
|
+
* Status of the partner-led business verification submission.
|
|
2907
|
+
*/
|
|
2908
|
+
type PartnerClientCertificationStatus = 'APPROVED' | 'REJECTED' | 'DISCARDED';
|
|
2909
|
+
/** Present on DISABLED_UPDATE events */
|
|
2898
2910
|
interface AccountUpdateBanInfo {
|
|
2899
2911
|
waba_ban_state: WabaBanState;
|
|
2900
|
-
|
|
2912
|
+
/** Unix timestamp of the ban date */
|
|
2913
|
+
waba_ban_date?: string;
|
|
2901
2914
|
}
|
|
2915
|
+
/** Present on ACCOUNT_VIOLATION events */
|
|
2902
2916
|
interface AccountUpdateViolationInfo {
|
|
2903
2917
|
violation_type: string;
|
|
2904
2918
|
}
|
|
2919
|
+
/** Present on ACCOUNT_RESTRICTION events */
|
|
2905
2920
|
interface AccountUpdateRestrictionInfo {
|
|
2906
2921
|
restriction_type: RestrictionType;
|
|
2922
|
+
/** Unix timestamp when the restriction expires */
|
|
2907
2923
|
expiration?: number;
|
|
2924
|
+
/** Steps the business can take to remediate the restriction */
|
|
2925
|
+
remediation?: string;
|
|
2908
2926
|
}
|
|
2927
|
+
/**
|
|
2928
|
+
* Present on PARTNER_ADDED, PARTNER_APP_INSTALLED, PARTNER_APP_UNINSTALLED,
|
|
2929
|
+
* PARTNER_REMOVED, AD_ACCOUNT_LINKED, and MM_LITE_TERMS_SIGNED events.
|
|
2930
|
+
*/
|
|
2909
2931
|
interface AccountUpdateWabaInfo {
|
|
2932
|
+
/** Customer or own WABA ID */
|
|
2910
2933
|
waba_id: string;
|
|
2934
|
+
/** Business portfolio ID */
|
|
2911
2935
|
owner_business_id: string;
|
|
2936
|
+
/** Partner app ID — present on PARTNER_APP_INSTALLED / PARTNER_APP_UNINSTALLED */
|
|
2912
2937
|
partner_app_id?: string;
|
|
2938
|
+
/** Ad account ID — present on AD_ACCOUNT_LINKED */
|
|
2939
|
+
ad_account_linked?: string;
|
|
2940
|
+
/** Solution ID — present when customer onboarded via multi-partner solution */
|
|
2941
|
+
solution_id?: string;
|
|
2942
|
+
/** Partner business portfolio IDs — present for multi-partner solutions */
|
|
2943
|
+
solution_partner_business_ids?: string[];
|
|
2944
|
+
}
|
|
2945
|
+
/** Present on AUTH_INTL_PRICE_ELIGIBILITY_UPDATE events */
|
|
2946
|
+
interface AuthInternationalRateEligibility {
|
|
2947
|
+
/** Unix timestamp when authentication-international rates become effective */
|
|
2948
|
+
start_time: number;
|
|
2949
|
+
/** Countries with different start times */
|
|
2950
|
+
exception_countries?: Array<{
|
|
2951
|
+
/** ISO 3166-1 alpha-2 country code */
|
|
2952
|
+
country_code: string;
|
|
2953
|
+
/** Unix timestamp for this country's start time */
|
|
2954
|
+
start_time: number;
|
|
2955
|
+
}>;
|
|
2956
|
+
}
|
|
2957
|
+
/** Present on VOLUME_BASED_PRICING_TIER_UPDATE events */
|
|
2958
|
+
interface VolumeTierInfo {
|
|
2959
|
+
/** Unix timestamp of the tier update */
|
|
2960
|
+
tier_update_time: number;
|
|
2961
|
+
/** Pricing category (e.g. "UTILITY") */
|
|
2962
|
+
pricing_category: string;
|
|
2963
|
+
/** Pricing tier identifier */
|
|
2964
|
+
tier: string;
|
|
2965
|
+
/** Effective month in YYYY-MM format (e.g. "2025-11") */
|
|
2966
|
+
effective_month: string;
|
|
2967
|
+
/** Region for the tier update (e.g. "India") */
|
|
2968
|
+
region: string;
|
|
2969
|
+
}
|
|
2970
|
+
/** Present on PARTNER_REMOVED events where disconnection_info is applicable */
|
|
2971
|
+
interface DisconnectionInfo {
|
|
2972
|
+
reason: DisconnectionReason;
|
|
2973
|
+
initiated_by: DisconnectionInitiatedBy;
|
|
2974
|
+
}
|
|
2975
|
+
/** Present on PARTNER_CLIENT_CERTIFICATION_STATUS_UPDATE events */
|
|
2976
|
+
interface PartnerClientCertificationInfo {
|
|
2977
|
+
/** Customer's business portfolio ID */
|
|
2978
|
+
client_business_id: string;
|
|
2979
|
+
/** Status of the verification submission */
|
|
2980
|
+
status: PartnerClientCertificationStatus;
|
|
2981
|
+
/** Rejection reasons — present when status is REJECTED */
|
|
2982
|
+
rejection_reasons?: string[];
|
|
2913
2983
|
}
|
|
2914
2984
|
interface AccountUpdateValue {
|
|
2985
|
+
/** Phone number associated with the WABA, if applicable */
|
|
2915
2986
|
phone_number?: string;
|
|
2987
|
+
/**
|
|
2988
|
+
* Event type describing what changed.
|
|
2989
|
+
* @see AccountUpdateEvent
|
|
2990
|
+
*/
|
|
2916
2991
|
event: AccountUpdateEvent;
|
|
2992
|
+
/**
|
|
2993
|
+
* ISO 3166-1 alpha-2 country code.
|
|
2994
|
+
* Only included for BUSINESS_PRIMARY_LOCATION_COUNTRY_UPDATE events.
|
|
2995
|
+
*/
|
|
2996
|
+
country?: string;
|
|
2997
|
+
/** Present on DISABLED_UPDATE events */
|
|
2917
2998
|
ban_info?: AccountUpdateBanInfo;
|
|
2999
|
+
/** Present on ACCOUNT_VIOLATION events */
|
|
2918
3000
|
violation_info?: AccountUpdateViolationInfo;
|
|
3001
|
+
/** Present on ACCOUNT_RESTRICTION events */
|
|
2919
3002
|
restriction_info?: AccountUpdateRestrictionInfo[];
|
|
3003
|
+
/** Present on partner-related and AD_ACCOUNT_LINKED events */
|
|
2920
3004
|
waba_info?: AccountUpdateWabaInfo;
|
|
3005
|
+
/** Present on AUTH_INTL_PRICE_ELIGIBILITY_UPDATE events */
|
|
3006
|
+
auth_international_rate_eligibility?: AuthInternationalRateEligibility;
|
|
3007
|
+
/** Present on VOLUME_BASED_PRICING_TIER_UPDATE events */
|
|
3008
|
+
volume_tier_info?: VolumeTierInfo;
|
|
3009
|
+
/** Present on PARTNER_REMOVED events where business used WhatsApp Business app + Cloud API */
|
|
3010
|
+
disconnection_info?: DisconnectionInfo;
|
|
3011
|
+
/** Present on PARTNER_CLIENT_CERTIFICATION_STATUS_UPDATE events */
|
|
3012
|
+
partner_client_certification_info?: PartnerClientCertificationInfo;
|
|
2921
3013
|
}
|
|
2922
3014
|
interface AccountUpdateWebhookValue {
|
|
2923
3015
|
field: 'account_update';
|
|
@@ -2967,6 +3059,44 @@ interface AccountAlertsWebhookValue {
|
|
|
2967
3059
|
field: 'account_alerts';
|
|
2968
3060
|
value: AccountAlertsValue;
|
|
2969
3061
|
}
|
|
3062
|
+
interface AccountSettingsCallingConfig {
|
|
3063
|
+
/** Whether calling is enabled for this phone number */
|
|
3064
|
+
status: 'ENABLED' | 'DISABLED' | string;
|
|
3065
|
+
/** Visibility of the call icon in WhatsApp */
|
|
3066
|
+
call_icon_visibility?: string;
|
|
3067
|
+
/** Status of callback permission */
|
|
3068
|
+
callback_permission_status?: 'ENABLED' | 'DISABLED' | string;
|
|
3069
|
+
/** Call hours configuration */
|
|
3070
|
+
call_hours?: {
|
|
3071
|
+
status: 'ENABLED' | 'DISABLED' | string;
|
|
3072
|
+
};
|
|
3073
|
+
/** SIP (Session Initiation Protocol) configuration */
|
|
3074
|
+
sip?: {
|
|
3075
|
+
status: 'ENABLED' | 'DISABLED' | string;
|
|
3076
|
+
};
|
|
3077
|
+
}
|
|
3078
|
+
interface AccountSettingsPhoneNumberSettings {
|
|
3079
|
+
/** The phone number ID these settings apply to */
|
|
3080
|
+
phone_number_id: string;
|
|
3081
|
+
/** Calling feature configuration */
|
|
3082
|
+
calling?: AccountSettingsCallingConfig;
|
|
3083
|
+
}
|
|
3084
|
+
interface AccountSettingsUpdateValue {
|
|
3085
|
+
messaging_product: 'whatsapp';
|
|
3086
|
+
/** Unix timestamp of the settings change */
|
|
3087
|
+
timestamp: string;
|
|
3088
|
+
/**
|
|
3089
|
+
* Type of settings that changed.
|
|
3090
|
+
* Known value: "phone_number_settings"
|
|
3091
|
+
*/
|
|
3092
|
+
type: 'phone_number_settings' | string;
|
|
3093
|
+
/** Present when type is "phone_number_settings" */
|
|
3094
|
+
phone_number_settings?: AccountSettingsPhoneNumberSettings;
|
|
3095
|
+
}
|
|
3096
|
+
interface AccountSettingsUpdateWebhookValue {
|
|
3097
|
+
field: 'account_settings_update';
|
|
3098
|
+
value: AccountSettingsUpdateValue;
|
|
3099
|
+
}
|
|
2970
3100
|
//#endregion
|
|
2971
3101
|
//#region src/core/webhook/types/common.d.ts
|
|
2972
3102
|
/**
|
|
@@ -3094,6 +3224,121 @@ interface BusinessCapabilityUpdateWebhookValue {
|
|
|
3094
3224
|
field: 'business_capability_update';
|
|
3095
3225
|
value: BusinessCapabilityUpdateValue;
|
|
3096
3226
|
}
|
|
3227
|
+
type BusinessStatusUpdateEvent = 'ACCOUNT_DELETED' | 'ACCOUNT_RESTRICTION' | 'ACCOUNT_VIOLATION' | 'DISABLED_UPDATE' | string;
|
|
3228
|
+
interface BusinessStatusUpdateValue {
|
|
3229
|
+
/** Event type describing the status change */
|
|
3230
|
+
event: BusinessStatusUpdateEvent;
|
|
3231
|
+
[key: string]: unknown;
|
|
3232
|
+
}
|
|
3233
|
+
interface BusinessStatusUpdateWebhookValue {
|
|
3234
|
+
field: 'business_status_update';
|
|
3235
|
+
value: BusinessStatusUpdateValue;
|
|
3236
|
+
}
|
|
3237
|
+
//#endregion
|
|
3238
|
+
//#region src/core/webhook/types/calls.d.ts
|
|
3239
|
+
/**
|
|
3240
|
+
* Lifecycle event type for a call.
|
|
3241
|
+
*
|
|
3242
|
+
* - "connect" — Call initiated; for consumer-initiated calls, respond with action=accept
|
|
3243
|
+
* - "call_status" — Business-initiated call started ringing or was accepted (business-initiated only)
|
|
3244
|
+
* - "media_update" — Consumer-side media event; apply the new SDP to your peer connection (business-initiated only)
|
|
3245
|
+
* - "terminate" — Call ended for any reason
|
|
3246
|
+
*/
|
|
3247
|
+
type CallEventType = 'connect' | 'call_status' | 'media_update' | 'terminate';
|
|
3248
|
+
/**
|
|
3249
|
+
* Direction of the call.
|
|
3250
|
+
*
|
|
3251
|
+
* - "business_initiated" — The business placed the call
|
|
3252
|
+
* - "user_initiated" — The user placed the call
|
|
3253
|
+
*/
|
|
3254
|
+
type CallDirection = 'business_initiated' | 'user_initiated';
|
|
3255
|
+
/**
|
|
3256
|
+
* Status for business-initiated calls (call_status event).
|
|
3257
|
+
*
|
|
3258
|
+
* - "ringing" — The outgoing call is ringing on the consumer's device
|
|
3259
|
+
* - "accepted" — The consumer accepted the call
|
|
3260
|
+
*/
|
|
3261
|
+
type CallStatusValue = 'ringing' | 'accepted';
|
|
3262
|
+
/**
|
|
3263
|
+
* Final call outcome (terminate event).
|
|
3264
|
+
*
|
|
3265
|
+
* - "Completed" — Call finished normally (includes calls rejected by either party)
|
|
3266
|
+
* - "Failed" — Call failed mid-connection
|
|
3267
|
+
*/
|
|
3268
|
+
type CallTerminateStatus = 'Completed' | 'Failed';
|
|
3269
|
+
interface CallSdpRenegotiation {
|
|
3270
|
+
/** SDP type — always "offer" for incoming media_update events */
|
|
3271
|
+
sdp_type: 'offer';
|
|
3272
|
+
/** SDP data compliant with RFC 4566 */
|
|
3273
|
+
sdp: string;
|
|
3274
|
+
}
|
|
3275
|
+
interface CallSession$1 {
|
|
3276
|
+
/**
|
|
3277
|
+
* Incremented each time Meta provides new SDP.
|
|
3278
|
+
* If multiple media_update webhooks arrive, apply the one with the highest version.
|
|
3279
|
+
*/
|
|
3280
|
+
version: number;
|
|
3281
|
+
/** Contains the SDP offer from Meta; generate an answer and apply to your peer connection */
|
|
3282
|
+
sdp_renegotiation: CallSdpRenegotiation;
|
|
3283
|
+
}
|
|
3284
|
+
interface CallEntry {
|
|
3285
|
+
/** Unique ID for the call — use in accept / reject / terminate API calls */
|
|
3286
|
+
id: string;
|
|
3287
|
+
/**
|
|
3288
|
+
* Lifecycle event type.
|
|
3289
|
+
* @see CallEventType
|
|
3290
|
+
*/
|
|
3291
|
+
event: CallEventType;
|
|
3292
|
+
/** Unix timestamp */
|
|
3293
|
+
timestamp: number;
|
|
3294
|
+
/** Callee of the call (Page ID) — present on connect */
|
|
3295
|
+
to?: string;
|
|
3296
|
+
/** Caller of the call (PSID) — present on connect */
|
|
3297
|
+
from?: string;
|
|
3298
|
+
/** Whether the call was business- or user-initiated — present on connect */
|
|
3299
|
+
call_direction?: CallDirection;
|
|
3300
|
+
/** PSID of the consumer — present on call_status */
|
|
3301
|
+
recipient_id?: string;
|
|
3302
|
+
/** Ringing or accepted — present on call_status */
|
|
3303
|
+
call_status?: CallStatusValue;
|
|
3304
|
+
/** SDP session information; apply the offer to your local peer connection — present on media_update */
|
|
3305
|
+
session?: CallSession$1;
|
|
3306
|
+
/** Final status of the call — present on terminate */
|
|
3307
|
+
status?: CallTerminateStatus;
|
|
3308
|
+
/** When the call started (Unix timestamp) — present on terminate */
|
|
3309
|
+
start_time?: number;
|
|
3310
|
+
/** When the call ended (Unix timestamp) — present on terminate */
|
|
3311
|
+
end_time?: number;
|
|
3312
|
+
/**
|
|
3313
|
+
* Call duration in seconds, counted from when the business connects.
|
|
3314
|
+
* Empty if the business did not successfully connect.
|
|
3315
|
+
* Present on terminate.
|
|
3316
|
+
*/
|
|
3317
|
+
duration?: number;
|
|
3318
|
+
}
|
|
3319
|
+
interface CallContact {
|
|
3320
|
+
profile: {
|
|
3321
|
+
/** Display name of the caller */
|
|
3322
|
+
name: string;
|
|
3323
|
+
};
|
|
3324
|
+
/** WhatsApp ID of the caller */
|
|
3325
|
+
wa_id: string;
|
|
3326
|
+
}
|
|
3327
|
+
interface CallsValue {
|
|
3328
|
+
messaging_product: 'whatsapp';
|
|
3329
|
+
metadata: {
|
|
3330
|
+
display_phone_number: string;
|
|
3331
|
+
phone_number_id: string;
|
|
3332
|
+
};
|
|
3333
|
+
/** Array of call lifecycle events */
|
|
3334
|
+
calls: CallEntry[];
|
|
3335
|
+
/** Contact profile information for the caller */
|
|
3336
|
+
contacts?: CallContact[];
|
|
3337
|
+
}
|
|
3338
|
+
interface CallsWebhookValue {
|
|
3339
|
+
field: 'calls';
|
|
3340
|
+
value: CallsValue;
|
|
3341
|
+
}
|
|
3097
3342
|
//#endregion
|
|
3098
3343
|
//#region src/core/webhook/types/flows.d.ts
|
|
3099
3344
|
/**
|
|
@@ -3143,6 +3388,165 @@ interface FlowsWebhookValue {
|
|
|
3143
3388
|
value: FlowsValue;
|
|
3144
3389
|
}
|
|
3145
3390
|
//#endregion
|
|
3391
|
+
//#region src/core/webhook/types/groups.d.ts
|
|
3392
|
+
interface GroupWebhookError {
|
|
3393
|
+
/** Error code */
|
|
3394
|
+
code: string;
|
|
3395
|
+
/** Human-readable error message */
|
|
3396
|
+
message: string;
|
|
3397
|
+
/** Short title for the error */
|
|
3398
|
+
title: string;
|
|
3399
|
+
error_data?: {
|
|
3400
|
+
/** Detailed error description */
|
|
3401
|
+
details: string;
|
|
3402
|
+
};
|
|
3403
|
+
}
|
|
3404
|
+
interface GroupAddedParticipant {
|
|
3405
|
+
/** WhatsApp ID of the participant */
|
|
3406
|
+
wa_id: string;
|
|
3407
|
+
/** Phone number input provided when adding (optional) */
|
|
3408
|
+
input?: string;
|
|
3409
|
+
}
|
|
3410
|
+
interface GroupRemovedParticipant {
|
|
3411
|
+
/** Phone number or WhatsApp ID of the removed participant */
|
|
3412
|
+
input: string;
|
|
3413
|
+
}
|
|
3414
|
+
interface GroupFailedParticipant {
|
|
3415
|
+
/** Phone number or WhatsApp ID that failed */
|
|
3416
|
+
input: string;
|
|
3417
|
+
errors: GroupWebhookError[];
|
|
3418
|
+
}
|
|
3419
|
+
type GroupLifecycleEventType = 'group_create' | 'group_delete';
|
|
3420
|
+
interface GroupLifecycleEntry {
|
|
3421
|
+
/** Unix timestamp of the event */
|
|
3422
|
+
timestamp: string;
|
|
3423
|
+
/** The group's WhatsApp ID */
|
|
3424
|
+
group_id: string;
|
|
3425
|
+
/** Event type: group_create or group_delete */
|
|
3426
|
+
type: GroupLifecycleEventType;
|
|
3427
|
+
/** Correlation ID for the API request that triggered this event */
|
|
3428
|
+
request_id: string;
|
|
3429
|
+
/** Group subject/name — present on group_create */
|
|
3430
|
+
subject?: string;
|
|
3431
|
+
/** Group description — present on group_create */
|
|
3432
|
+
description?: string;
|
|
3433
|
+
/** Invite link for the group — present on successful group_create */
|
|
3434
|
+
invite_link?: string;
|
|
3435
|
+
/** Whether users need admin approval to join — present on group_create */
|
|
3436
|
+
join_approval_mode?: string;
|
|
3437
|
+
/** Present when the operation failed */
|
|
3438
|
+
errors?: GroupWebhookError[];
|
|
3439
|
+
}
|
|
3440
|
+
interface GroupLifecycleUpdateValue {
|
|
3441
|
+
messaging_product: 'whatsapp';
|
|
3442
|
+
metadata: WebhookMetadata;
|
|
3443
|
+
/** Array of group lifecycle events */
|
|
3444
|
+
groups: GroupLifecycleEntry[];
|
|
3445
|
+
}
|
|
3446
|
+
interface GroupLifecycleUpdateWebhookValue {
|
|
3447
|
+
field: 'group_lifecycle_update';
|
|
3448
|
+
value: GroupLifecycleUpdateValue;
|
|
3449
|
+
}
|
|
3450
|
+
type GroupParticipantsEventType = 'group_participants_add' | 'group_participants_remove' | 'group_join_request_created' | 'group_join_request_revoked';
|
|
3451
|
+
type GroupParticipantsAddReason = 'invite_link' | 'admin_added';
|
|
3452
|
+
/** Who initiated the remove action */
|
|
3453
|
+
type GroupParticipantsInitiatedBy = 'business' | 'participant';
|
|
3454
|
+
interface GroupParticipantsEntry {
|
|
3455
|
+
/** Unix timestamp of the event */
|
|
3456
|
+
timestamp: string;
|
|
3457
|
+
/** The group's WhatsApp ID */
|
|
3458
|
+
group_id: string;
|
|
3459
|
+
/** Event type */
|
|
3460
|
+
type: GroupParticipantsEventType;
|
|
3461
|
+
/** Correlation ID for the API request */
|
|
3462
|
+
request_id?: string;
|
|
3463
|
+
/** Reason participants were added (e.g. invite_link) */
|
|
3464
|
+
reason?: GroupParticipantsAddReason | string;
|
|
3465
|
+
/** Participants successfully added */
|
|
3466
|
+
added_participants?: GroupAddedParticipant[];
|
|
3467
|
+
/** Whether business or participant initiated the removal */
|
|
3468
|
+
initiated_by?: GroupParticipantsInitiatedBy;
|
|
3469
|
+
/** Participants successfully removed */
|
|
3470
|
+
removed_participants?: GroupRemovedParticipant[];
|
|
3471
|
+
/** Participants that could not be removed */
|
|
3472
|
+
failed_participants?: GroupFailedParticipant[];
|
|
3473
|
+
/** ID of the join request */
|
|
3474
|
+
join_request_id?: string;
|
|
3475
|
+
/** WhatsApp ID of the user who submitted or cancelled the request */
|
|
3476
|
+
wa_id?: string;
|
|
3477
|
+
/** Present when the operation partially or fully failed */
|
|
3478
|
+
errors?: GroupWebhookError[];
|
|
3479
|
+
}
|
|
3480
|
+
interface GroupParticipantsUpdateValue {
|
|
3481
|
+
messaging_product: 'whatsapp';
|
|
3482
|
+
metadata: WebhookMetadata;
|
|
3483
|
+
/** Array of participant update events */
|
|
3484
|
+
groups: GroupParticipantsEntry[];
|
|
3485
|
+
}
|
|
3486
|
+
interface GroupParticipantsUpdateWebhookValue {
|
|
3487
|
+
field: 'group_participants_update';
|
|
3488
|
+
value: GroupParticipantsUpdateValue;
|
|
3489
|
+
}
|
|
3490
|
+
interface GroupSettingFieldResult {
|
|
3491
|
+
/** Whether this specific field was successfully updated */
|
|
3492
|
+
update_successful: boolean;
|
|
3493
|
+
/** Present on profile_picture updates */
|
|
3494
|
+
mime_type?: string;
|
|
3495
|
+
/** SHA-256 hash of the uploaded image — present on profile_picture updates */
|
|
3496
|
+
sha256?: string;
|
|
3497
|
+
/** New text value — present on group_subject / group_description updates */
|
|
3498
|
+
text?: string;
|
|
3499
|
+
/** Present when update_successful is false */
|
|
3500
|
+
errors?: GroupWebhookError[];
|
|
3501
|
+
}
|
|
3502
|
+
interface GroupSettingsEntry {
|
|
3503
|
+
/** Unix timestamp of the event */
|
|
3504
|
+
timestamp: string;
|
|
3505
|
+
/** The group's WhatsApp ID */
|
|
3506
|
+
group_id: string;
|
|
3507
|
+
/** Always "group_settings_update" */
|
|
3508
|
+
type: 'group_settings_update';
|
|
3509
|
+
/** Correlation ID for the API request */
|
|
3510
|
+
request_id?: string;
|
|
3511
|
+
/** Result of the profile picture update */
|
|
3512
|
+
profile_picture?: GroupSettingFieldResult;
|
|
3513
|
+
/** Result of the group subject (name) update */
|
|
3514
|
+
group_subject?: GroupSettingFieldResult;
|
|
3515
|
+
/** Result of the group description update */
|
|
3516
|
+
group_description?: GroupSettingFieldResult;
|
|
3517
|
+
/** Top-level errors when the entire update failed */
|
|
3518
|
+
errors?: GroupWebhookError[];
|
|
3519
|
+
}
|
|
3520
|
+
interface GroupSettingsUpdateValue {
|
|
3521
|
+
messaging_product: 'whatsapp';
|
|
3522
|
+
metadata: WebhookMetadata;
|
|
3523
|
+
/** Array of group settings update events */
|
|
3524
|
+
groups: GroupSettingsEntry[];
|
|
3525
|
+
}
|
|
3526
|
+
interface GroupSettingsUpdateWebhookValue {
|
|
3527
|
+
field: 'group_settings_update';
|
|
3528
|
+
value: GroupSettingsUpdateValue;
|
|
3529
|
+
}
|
|
3530
|
+
type GroupStatusEventType = 'group_suspend' | 'group_suspend_cleared';
|
|
3531
|
+
interface GroupStatusEntry {
|
|
3532
|
+
/** Unix timestamp of the event */
|
|
3533
|
+
timestamp: string;
|
|
3534
|
+
/** The group's WhatsApp ID */
|
|
3535
|
+
group_id: string;
|
|
3536
|
+
/** Event type: group_suspend or group_suspend_cleared */
|
|
3537
|
+
type: GroupStatusEventType;
|
|
3538
|
+
}
|
|
3539
|
+
interface GroupStatusUpdateValue {
|
|
3540
|
+
messaging_product: 'whatsapp';
|
|
3541
|
+
metadata: WebhookMetadata;
|
|
3542
|
+
/** Array of group status events */
|
|
3543
|
+
groups: GroupStatusEntry[];
|
|
3544
|
+
}
|
|
3545
|
+
interface GroupStatusUpdateWebhookValue {
|
|
3546
|
+
field: 'group_status_update';
|
|
3547
|
+
value: GroupStatusUpdateValue;
|
|
3548
|
+
}
|
|
3549
|
+
//#endregion
|
|
3146
3550
|
//#region src/core/webhook/types/message.d.ts
|
|
3147
3551
|
/**
|
|
3148
3552
|
* Base message properties common to all message types
|
|
@@ -3433,6 +3837,75 @@ interface HistoryWebhookValue {
|
|
|
3433
3837
|
value: HistoryValue;
|
|
3434
3838
|
}
|
|
3435
3839
|
//#endregion
|
|
3840
|
+
//#region src/core/webhook/types/marketing.d.ts
|
|
3841
|
+
/**
|
|
3842
|
+
* Detected event type.
|
|
3843
|
+
* Sample payload uses lowercase ("purchase"), docs use PascalCase ("Purchase").
|
|
3844
|
+
* Accept both forms.
|
|
3845
|
+
*/
|
|
3846
|
+
type AutomaticEventName = 'LeadSubmitted' | 'Purchase' | 'purchase' | 'lead_submitted' | string;
|
|
3847
|
+
interface AutomaticEventCustomData {
|
|
3848
|
+
/** ISO 4217 currency code (e.g. "USD") — present on Purchase events */
|
|
3849
|
+
currency: string;
|
|
3850
|
+
/** Monetary value of the purchase — present on Purchase events */
|
|
3851
|
+
value: number;
|
|
3852
|
+
}
|
|
3853
|
+
interface AutomaticEvent {
|
|
3854
|
+
/** WhatsApp message ID that triggered the event detection */
|
|
3855
|
+
id: string;
|
|
3856
|
+
/**
|
|
3857
|
+
* Detected event type.
|
|
3858
|
+
* @see AutomaticEventName
|
|
3859
|
+
*/
|
|
3860
|
+
event_name: AutomaticEventName;
|
|
3861
|
+
/** Unix timestamp of when the event was detected */
|
|
3862
|
+
timestamp: number;
|
|
3863
|
+
/**
|
|
3864
|
+
* Click-to-WhatsApp ad click ID — use with Conversions API.
|
|
3865
|
+
* Present when the event originated from a Click-to-WhatsApp ad.
|
|
3866
|
+
*/
|
|
3867
|
+
ctwa_clid?: string;
|
|
3868
|
+
/** Present on Purchase events */
|
|
3869
|
+
custom_data?: AutomaticEventCustomData;
|
|
3870
|
+
}
|
|
3871
|
+
interface AutomaticEventsValue {
|
|
3872
|
+
messaging_product: 'whatsapp';
|
|
3873
|
+
metadata: WebhookMetadata;
|
|
3874
|
+
/** Array of detected automatic events */
|
|
3875
|
+
automatic_events: AutomaticEvent[];
|
|
3876
|
+
}
|
|
3877
|
+
interface AutomaticEventsWebhookValue {
|
|
3878
|
+
field: 'automatic_events';
|
|
3879
|
+
value: AutomaticEventsValue;
|
|
3880
|
+
}
|
|
3881
|
+
interface TrackingEventData {
|
|
3882
|
+
/** Unique identifier for the click, also appended to the destination URL */
|
|
3883
|
+
click_id?: string;
|
|
3884
|
+
/** Internal Meta token for processing and tracking */
|
|
3885
|
+
tracking_token?: string;
|
|
3886
|
+
}
|
|
3887
|
+
interface TrackingEvent {
|
|
3888
|
+
/**
|
|
3889
|
+
* Name of the tracked event.
|
|
3890
|
+
* Known values: "sent"
|
|
3891
|
+
*/
|
|
3892
|
+
event_name: string;
|
|
3893
|
+
/** Unix timestamp of the event */
|
|
3894
|
+
timestamp: number;
|
|
3895
|
+
/** Tracking data associated with the event */
|
|
3896
|
+
tracking_data?: TrackingEventData;
|
|
3897
|
+
}
|
|
3898
|
+
interface TrackingEventsValue {
|
|
3899
|
+
messaging_product: 'whatsapp';
|
|
3900
|
+
metadata: WebhookMetadata;
|
|
3901
|
+
/** Array of tracking events */
|
|
3902
|
+
events: TrackingEvent[];
|
|
3903
|
+
}
|
|
3904
|
+
interface TrackingEventsWebhookValue {
|
|
3905
|
+
field: 'tracking_events';
|
|
3906
|
+
value: TrackingEventsValue;
|
|
3907
|
+
}
|
|
3908
|
+
//#endregion
|
|
3436
3909
|
//#region src/core/webhook/types/messageEchoes.d.ts
|
|
3437
3910
|
/**
|
|
3438
3911
|
* Message echo error
|
|
@@ -3488,6 +3961,179 @@ interface SmbMessageEchoesWebhookValue {
|
|
|
3488
3961
|
field: 'smb_message_echoes';
|
|
3489
3962
|
value: SmbMessageEchoesValue;
|
|
3490
3963
|
}
|
|
3964
|
+
interface MessageEchoSender {
|
|
3965
|
+
/** Page ID that sent the message */
|
|
3966
|
+
id: string;
|
|
3967
|
+
}
|
|
3968
|
+
interface MessageEchoRecipient {
|
|
3969
|
+
/** Page-scoped ID of the user who received the message */
|
|
3970
|
+
id: string;
|
|
3971
|
+
}
|
|
3972
|
+
interface MessageEchoAttachment {
|
|
3973
|
+
/** Attachment type: image, audio, video, file, template, fallback */
|
|
3974
|
+
type: string;
|
|
3975
|
+
/** URL of the attachment or fallback URL */
|
|
3976
|
+
url?: string;
|
|
3977
|
+
/** Template payload for template attachments */
|
|
3978
|
+
payload?: unknown;
|
|
3979
|
+
title?: string;
|
|
3980
|
+
}
|
|
3981
|
+
interface MessageEchoBody {
|
|
3982
|
+
/** Indicates the message was sent by the page */
|
|
3983
|
+
is_echo: true;
|
|
3984
|
+
/** ID of the app that sent the message */
|
|
3985
|
+
app_id: number;
|
|
3986
|
+
/** Custom metadata string set in the Send API request */
|
|
3987
|
+
metadata?: string;
|
|
3988
|
+
/** Message ID */
|
|
3989
|
+
mid: string;
|
|
3990
|
+
/** Text content — present on text messages */
|
|
3991
|
+
text?: string;
|
|
3992
|
+
/** Attachments — present on media/template messages */
|
|
3993
|
+
attachments?: MessageEchoAttachment[];
|
|
3994
|
+
}
|
|
3995
|
+
interface MessageEchoEntry {
|
|
3996
|
+
sender: MessageEchoSender;
|
|
3997
|
+
recipient: MessageEchoRecipient;
|
|
3998
|
+
/** Unix timestamp in milliseconds */
|
|
3999
|
+
timestamp: number;
|
|
4000
|
+
message: MessageEchoBody;
|
|
4001
|
+
}
|
|
4002
|
+
interface MessageEchoesValue {
|
|
4003
|
+
/** Array of echoed messages */
|
|
4004
|
+
messaging: MessageEchoEntry[];
|
|
4005
|
+
}
|
|
4006
|
+
interface MessageEchoesWebhookValue {
|
|
4007
|
+
field: 'message_echoes';
|
|
4008
|
+
value: MessageEchoesValue;
|
|
4009
|
+
}
|
|
4010
|
+
//#endregion
|
|
4011
|
+
//#region src/core/webhook/types/messaging.d.ts
|
|
4012
|
+
interface MessagingHandoverControlPassed {
|
|
4013
|
+
/** Optional metadata string passed with the handover */
|
|
4014
|
+
metadata?: string;
|
|
4015
|
+
}
|
|
4016
|
+
interface MessagingHandoversValue {
|
|
4017
|
+
messaging_product: 'whatsapp';
|
|
4018
|
+
/** The business phone number that received the handover event */
|
|
4019
|
+
recipient: {
|
|
4020
|
+
display_phone_number: string;
|
|
4021
|
+
phone_number_id: string;
|
|
4022
|
+
};
|
|
4023
|
+
/** The user involved in the handover */
|
|
4024
|
+
sender: {
|
|
4025
|
+
phone_number: string;
|
|
4026
|
+
};
|
|
4027
|
+
/** Unix timestamp of the event */
|
|
4028
|
+
timestamp: string;
|
|
4029
|
+
/** Present when thread control is passed to another app */
|
|
4030
|
+
control_passed?: MessagingHandoverControlPassed;
|
|
4031
|
+
}
|
|
4032
|
+
interface MessagingHandoversWebhookValue {
|
|
4033
|
+
field: 'messaging_handovers';
|
|
4034
|
+
value: MessagingHandoversValue;
|
|
4035
|
+
}
|
|
4036
|
+
interface StandbyValue {
|
|
4037
|
+
messaging_product: 'whatsapp';
|
|
4038
|
+
[key: string]: unknown;
|
|
4039
|
+
}
|
|
4040
|
+
interface StandbyWebhookValue {
|
|
4041
|
+
field: 'standby';
|
|
4042
|
+
value: StandbyValue;
|
|
4043
|
+
}
|
|
4044
|
+
interface UserPreferenceEntry {
|
|
4045
|
+
/** WhatsApp ID of the user */
|
|
4046
|
+
wa_id: string;
|
|
4047
|
+
/** Meta user ID (e.g. "US.1234567") */
|
|
4048
|
+
user_id: string;
|
|
4049
|
+
/** Human-readable description of the preference change */
|
|
4050
|
+
detail: string;
|
|
4051
|
+
/**
|
|
4052
|
+
* Category of the preference that changed.
|
|
4053
|
+
* Known value: "marketing_messages"
|
|
4054
|
+
*/
|
|
4055
|
+
category: 'marketing_messages' | string;
|
|
4056
|
+
/**
|
|
4057
|
+
* New preference value.
|
|
4058
|
+
* Known value: "stop" (user opted out)
|
|
4059
|
+
*/
|
|
4060
|
+
value: 'stop' | string;
|
|
4061
|
+
/** Unix timestamp of when the preference was changed */
|
|
4062
|
+
timestamp: number;
|
|
4063
|
+
/** Signup ID associated with the preference, if applicable */
|
|
4064
|
+
signup_id?: string;
|
|
4065
|
+
}
|
|
4066
|
+
interface UserPreferencesContact {
|
|
4067
|
+
profile: {
|
|
4068
|
+
/** Display name of the user */
|
|
4069
|
+
name: string;
|
|
4070
|
+
/** WhatsApp username, if available */
|
|
4071
|
+
username?: string;
|
|
4072
|
+
};
|
|
4073
|
+
/** WhatsApp ID of the user */
|
|
4074
|
+
wa_id: string;
|
|
4075
|
+
/** Meta user ID */
|
|
4076
|
+
user_id?: string;
|
|
4077
|
+
}
|
|
4078
|
+
interface UserPreferencesValue {
|
|
4079
|
+
messaging_product: 'whatsapp';
|
|
4080
|
+
metadata: WebhookMetadata;
|
|
4081
|
+
/** Array of user preference change events */
|
|
4082
|
+
user_preferences: UserPreferenceEntry[];
|
|
4083
|
+
/** Contact profile information for the users */
|
|
4084
|
+
contacts?: UserPreferencesContact[];
|
|
4085
|
+
}
|
|
4086
|
+
interface UserPreferencesWebhookValue {
|
|
4087
|
+
field: 'user_preferences';
|
|
4088
|
+
value: UserPreferencesValue;
|
|
4089
|
+
}
|
|
4090
|
+
//#endregion
|
|
4091
|
+
//#region src/core/webhook/types/partner.d.ts
|
|
4092
|
+
/**
|
|
4093
|
+
* Partner solution event types.
|
|
4094
|
+
* Known value: "SOLUTION_CREATED"
|
|
4095
|
+
*/
|
|
4096
|
+
type PartnerSolutionEvent = 'SOLUTION_CREATED' | string;
|
|
4097
|
+
/**
|
|
4098
|
+
* Partner solution status values.
|
|
4099
|
+
* Known value: "INITIATED"
|
|
4100
|
+
*/
|
|
4101
|
+
type PartnerSolutionStatus = 'INITIATED' | string;
|
|
4102
|
+
interface PartnerSolutionsValue {
|
|
4103
|
+
/** Type of partner solution event */
|
|
4104
|
+
event: PartnerSolutionEvent;
|
|
4105
|
+
/** Unique identifier for the partner solution */
|
|
4106
|
+
solution_id: string;
|
|
4107
|
+
/** Current status of the partner solution */
|
|
4108
|
+
solution_status: PartnerSolutionStatus;
|
|
4109
|
+
}
|
|
4110
|
+
interface PartnerSolutionsWebhookValue {
|
|
4111
|
+
field: 'partner_solutions';
|
|
4112
|
+
value: PartnerSolutionsValue;
|
|
4113
|
+
}
|
|
4114
|
+
//#endregion
|
|
4115
|
+
//#region src/core/webhook/types/payments.d.ts
|
|
4116
|
+
interface PaymentConfigurationUpdateValue {
|
|
4117
|
+
/** Name of the payment configuration */
|
|
4118
|
+
configuration_name: string;
|
|
4119
|
+
/** Payment provider name (e.g. "razorpay") */
|
|
4120
|
+
provider_name: string;
|
|
4121
|
+
/** Merchant ID assigned by the payment provider */
|
|
4122
|
+
provider_mid: string;
|
|
4123
|
+
/**
|
|
4124
|
+
* Current status of the payment configuration.
|
|
4125
|
+
* Known values: "Needs Testing"
|
|
4126
|
+
*/
|
|
4127
|
+
status: string;
|
|
4128
|
+
/** Unix timestamp of when the configuration was created */
|
|
4129
|
+
created_timestamp: number;
|
|
4130
|
+
/** Unix timestamp of when the configuration was last updated */
|
|
4131
|
+
updated_timestamp: number;
|
|
4132
|
+
}
|
|
4133
|
+
interface PaymentConfigurationUpdateWebhookValue {
|
|
4134
|
+
field: 'payment_configuration_update';
|
|
4135
|
+
value: PaymentConfigurationUpdateValue;
|
|
4136
|
+
}
|
|
3491
4137
|
//#endregion
|
|
3492
4138
|
//#region src/core/webhook/types/phoneNumber.d.ts
|
|
3493
4139
|
/**
|
|
@@ -3638,6 +4284,74 @@ interface MessageTemplateQualityUpdateWebhookValue {
|
|
|
3638
4284
|
field: 'message_template_quality_update';
|
|
3639
4285
|
value: MessageTemplateQualityUpdateValue;
|
|
3640
4286
|
}
|
|
4287
|
+
interface MessageTemplateComponentsUpdateValue {
|
|
4288
|
+
/** Numeric ID of the message template */
|
|
4289
|
+
message_template_id: number;
|
|
4290
|
+
/** Name of the message template */
|
|
4291
|
+
message_template_name: string;
|
|
4292
|
+
/** Language code of the message template (e.g. "en_US") */
|
|
4293
|
+
message_template_language: string;
|
|
4294
|
+
/** Event describing what changed */
|
|
4295
|
+
event: string;
|
|
4296
|
+
[key: string]: unknown;
|
|
4297
|
+
}
|
|
4298
|
+
interface MessageTemplateComponentsUpdateWebhookValue {
|
|
4299
|
+
field: 'message_template_components_update';
|
|
4300
|
+
value: MessageTemplateComponentsUpdateValue;
|
|
4301
|
+
}
|
|
4302
|
+
interface TemplateCorrectCategoryDetectionValue {
|
|
4303
|
+
/** Numeric ID of the affected message template */
|
|
4304
|
+
message_template_id: number;
|
|
4305
|
+
/** Name of the affected message template */
|
|
4306
|
+
message_template_name: string;
|
|
4307
|
+
/** Language code of the affected message template (e.g. "en_US") */
|
|
4308
|
+
message_template_language: string;
|
|
4309
|
+
/** The category WhatsApp determined the template should belong to */
|
|
4310
|
+
suggested_category: TemplateCategory;
|
|
4311
|
+
/** The template's current (approved) category */
|
|
4312
|
+
current_category: TemplateCategory;
|
|
4313
|
+
}
|
|
4314
|
+
interface TemplateCorrectCategoryDetectionWebhookValue {
|
|
4315
|
+
field: 'template_correct_category_detection';
|
|
4316
|
+
value: TemplateCorrectCategoryDetectionValue;
|
|
4317
|
+
}
|
|
4318
|
+
//#endregion
|
|
4319
|
+
//#region src/core/webhook/types/webhookFields.d.ts
|
|
4320
|
+
declare const WebhookField: {
|
|
4321
|
+
readonly Messages: "messages";
|
|
4322
|
+
readonly AccountUpdate: "account_update";
|
|
4323
|
+
readonly AccountReviewUpdate: "account_review_update";
|
|
4324
|
+
readonly AccountAlerts: "account_alerts";
|
|
4325
|
+
readonly AccountSettingsUpdate: "account_settings_update";
|
|
4326
|
+
readonly BusinessCapabilityUpdate: "business_capability_update";
|
|
4327
|
+
readonly BusinessStatusUpdate: "business_status_update";
|
|
4328
|
+
readonly PhoneNumberNameUpdate: "phone_number_name_update";
|
|
4329
|
+
readonly PhoneNumberQualityUpdate: "phone_number_quality_update";
|
|
4330
|
+
readonly MessageTemplateStatusUpdate: "message_template_status_update";
|
|
4331
|
+
readonly MessageTemplateQualityUpdate: "message_template_quality_update";
|
|
4332
|
+
readonly MessageTemplateComponentsUpdate: "message_template_components_update";
|
|
4333
|
+
readonly TemplateCategoryUpdate: "template_category_update";
|
|
4334
|
+
readonly TemplateCorrectCategoryDetection: "template_correct_category_detection";
|
|
4335
|
+
readonly Flows: "flows";
|
|
4336
|
+
readonly Security: "security";
|
|
4337
|
+
readonly History: "history";
|
|
4338
|
+
readonly SmbMessageEchoes: "smb_message_echoes";
|
|
4339
|
+
readonly SmbAppStateSync: "smb_app_state_sync";
|
|
4340
|
+
readonly AutomaticEvents: "automatic_events";
|
|
4341
|
+
readonly TrackingEvents: "tracking_events";
|
|
4342
|
+
readonly Calls: "calls";
|
|
4343
|
+
readonly GroupLifecycleUpdate: "group_lifecycle_update";
|
|
4344
|
+
readonly GroupParticipantsUpdate: "group_participants_update";
|
|
4345
|
+
readonly GroupSettingsUpdate: "group_settings_update";
|
|
4346
|
+
readonly GroupStatusUpdate: "group_status_update";
|
|
4347
|
+
readonly MessageEchoes: "message_echoes";
|
|
4348
|
+
readonly MessagingHandovers: "messaging_handovers";
|
|
4349
|
+
readonly PartnerSolutions: "partner_solutions";
|
|
4350
|
+
readonly PaymentConfigurationUpdate: "payment_configuration_update";
|
|
4351
|
+
readonly Standby: "standby";
|
|
4352
|
+
readonly UserPreferences: "user_preferences";
|
|
4353
|
+
};
|
|
4354
|
+
type WebhookFieldType = (typeof WebhookField)[keyof typeof WebhookField];
|
|
3641
4355
|
//#endregion
|
|
3642
4356
|
//#region src/core/webhook/types/index.d.ts
|
|
3643
4357
|
/**
|
|
@@ -3672,7 +4386,7 @@ type WebhookValue = MessageWebhookValue | StatusWebhookValue | ErrorWebhookValue
|
|
|
3672
4386
|
/**
|
|
3673
4387
|
* Union type for all webhook field values
|
|
3674
4388
|
*/
|
|
3675
|
-
type WebhookFieldValue = AccountUpdateWebhookValue | AccountReviewUpdateWebhookValue | AccountAlertsWebhookValue | BusinessCapabilityUpdateWebhookValue |
|
|
4389
|
+
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;
|
|
3676
4390
|
interface WebhookPayload {
|
|
3677
4391
|
object: 'whatsapp_business_account';
|
|
3678
4392
|
entry: Array<{
|
|
@@ -6632,6 +7346,74 @@ type ProcessedSmbAppStateSync = {
|
|
|
6632
7346
|
wabaId: string;
|
|
6633
7347
|
value: SmbAppStateSyncWebhookValue['value'];
|
|
6634
7348
|
};
|
|
7349
|
+
type ProcessedAccountSettingsUpdate = {
|
|
7350
|
+
wabaId: string;
|
|
7351
|
+
value: AccountSettingsUpdateWebhookValue['value'];
|
|
7352
|
+
};
|
|
7353
|
+
type ProcessedAutomaticEvents = {
|
|
7354
|
+
wabaId: string;
|
|
7355
|
+
value: AutomaticEventsWebhookValue['value'];
|
|
7356
|
+
};
|
|
7357
|
+
type ProcessedBusinessStatusUpdate = {
|
|
7358
|
+
wabaId: string;
|
|
7359
|
+
value: BusinessStatusUpdateWebhookValue['value'];
|
|
7360
|
+
};
|
|
7361
|
+
type ProcessedCalls = {
|
|
7362
|
+
wabaId: string;
|
|
7363
|
+
value: CallsWebhookValue['value'];
|
|
7364
|
+
};
|
|
7365
|
+
type ProcessedGroupLifecycleUpdate = {
|
|
7366
|
+
wabaId: string;
|
|
7367
|
+
value: GroupLifecycleUpdateWebhookValue['value'];
|
|
7368
|
+
};
|
|
7369
|
+
type ProcessedGroupParticipantsUpdate = {
|
|
7370
|
+
wabaId: string;
|
|
7371
|
+
value: GroupParticipantsUpdateWebhookValue['value'];
|
|
7372
|
+
};
|
|
7373
|
+
type ProcessedGroupSettingsUpdate = {
|
|
7374
|
+
wabaId: string;
|
|
7375
|
+
value: GroupSettingsUpdateWebhookValue['value'];
|
|
7376
|
+
};
|
|
7377
|
+
type ProcessedGroupStatusUpdate = {
|
|
7378
|
+
wabaId: string;
|
|
7379
|
+
value: GroupStatusUpdateWebhookValue['value'];
|
|
7380
|
+
};
|
|
7381
|
+
type ProcessedMessageEchoes = {
|
|
7382
|
+
wabaId: string;
|
|
7383
|
+
value: MessageEchoesWebhookValue['value'];
|
|
7384
|
+
};
|
|
7385
|
+
type ProcessedMessageTemplateComponentsUpdate = {
|
|
7386
|
+
wabaId: string;
|
|
7387
|
+
value: MessageTemplateComponentsUpdateWebhookValue['value'];
|
|
7388
|
+
};
|
|
7389
|
+
type ProcessedMessagingHandovers = {
|
|
7390
|
+
wabaId: string;
|
|
7391
|
+
value: MessagingHandoversWebhookValue['value'];
|
|
7392
|
+
};
|
|
7393
|
+
type ProcessedPartnerSolutions = {
|
|
7394
|
+
wabaId: string;
|
|
7395
|
+
value: PartnerSolutionsWebhookValue['value'];
|
|
7396
|
+
};
|
|
7397
|
+
type ProcessedPaymentConfigurationUpdate = {
|
|
7398
|
+
wabaId: string;
|
|
7399
|
+
value: PaymentConfigurationUpdateWebhookValue['value'];
|
|
7400
|
+
};
|
|
7401
|
+
type ProcessedStandby = {
|
|
7402
|
+
wabaId: string;
|
|
7403
|
+
value: StandbyWebhookValue['value'];
|
|
7404
|
+
};
|
|
7405
|
+
type ProcessedTemplateCorrectCategoryDetection = {
|
|
7406
|
+
wabaId: string;
|
|
7407
|
+
value: TemplateCorrectCategoryDetectionWebhookValue['value'];
|
|
7408
|
+
};
|
|
7409
|
+
type ProcessedTrackingEvents = {
|
|
7410
|
+
wabaId: string;
|
|
7411
|
+
value: TrackingEventsWebhookValue['value'];
|
|
7412
|
+
};
|
|
7413
|
+
type ProcessedUserPreferences = {
|
|
7414
|
+
wabaId: string;
|
|
7415
|
+
value: UserPreferencesWebhookValue['value'];
|
|
7416
|
+
};
|
|
6635
7417
|
type TextProcessedMessage = ProcessedMessage & {
|
|
6636
7418
|
message: Extract<WhatsAppMessage, {
|
|
6637
7419
|
type: MessageTypesEnum.Text;
|
|
@@ -6700,6 +7482,7 @@ type SystemProcessedMessage = ProcessedMessage & {
|
|
|
6700
7482
|
type MessageHandler = (whatsapp: WhatsApp, processed: ProcessedMessage) => void | Promise<void>;
|
|
6701
7483
|
type StatusHandler = (whatsapp: WhatsApp, processed: ProcessedStatus) => void | Promise<void>;
|
|
6702
7484
|
type FlowHandler = (whatsapp: WhatsApp, request: FlowEndpointRequest) => any | Promise<any>;
|
|
7485
|
+
type RawWebhookHandler = (whatsapp: WhatsApp, payload: WebhookPayload) => void | Promise<void>;
|
|
6703
7486
|
type AccountUpdateHandler = (whatsapp: WhatsApp, processed: ProcessedAccountUpdate) => void | Promise<void>;
|
|
6704
7487
|
type AccountReviewUpdateHandler = (whatsapp: WhatsApp, processed: ProcessedAccountReviewUpdate) => void | Promise<void>;
|
|
6705
7488
|
type AccountAlertsHandler = (whatsapp: WhatsApp, processed: ProcessedAccountAlerts) => void | Promise<void>;
|
|
@@ -6714,6 +7497,23 @@ type SecurityHandler = (whatsapp: WhatsApp, processed: ProcessedSecurity) => voi
|
|
|
6714
7497
|
type HistoryHandler = (whatsapp: WhatsApp, processed: ProcessedHistory) => void | Promise<void>;
|
|
6715
7498
|
type SmbMessageEchoesHandler = (whatsapp: WhatsApp, processed: ProcessedSmbMessageEchoes) => void | Promise<void>;
|
|
6716
7499
|
type SmbAppStateSyncHandler = (whatsapp: WhatsApp, processed: ProcessedSmbAppStateSync) => void | Promise<void>;
|
|
7500
|
+
type AccountSettingsUpdateHandler = (whatsapp: WhatsApp, processed: ProcessedAccountSettingsUpdate) => void | Promise<void>;
|
|
7501
|
+
type AutomaticEventsHandler = (whatsapp: WhatsApp, processed: ProcessedAutomaticEvents) => void | Promise<void>;
|
|
7502
|
+
type BusinessStatusUpdateHandler = (whatsapp: WhatsApp, processed: ProcessedBusinessStatusUpdate) => void | Promise<void>;
|
|
7503
|
+
type CallsHandler = (whatsapp: WhatsApp, processed: ProcessedCalls) => void | Promise<void>;
|
|
7504
|
+
type GroupLifecycleUpdateHandler = (whatsapp: WhatsApp, processed: ProcessedGroupLifecycleUpdate) => void | Promise<void>;
|
|
7505
|
+
type GroupParticipantsUpdateHandler = (whatsapp: WhatsApp, processed: ProcessedGroupParticipantsUpdate) => void | Promise<void>;
|
|
7506
|
+
type GroupSettingsUpdateHandler = (whatsapp: WhatsApp, processed: ProcessedGroupSettingsUpdate) => void | Promise<void>;
|
|
7507
|
+
type GroupStatusUpdateHandler = (whatsapp: WhatsApp, processed: ProcessedGroupStatusUpdate) => void | Promise<void>;
|
|
7508
|
+
type MessageEchoesHandler = (whatsapp: WhatsApp, processed: ProcessedMessageEchoes) => void | Promise<void>;
|
|
7509
|
+
type MessageTemplateComponentsUpdateHandler = (whatsapp: WhatsApp, processed: ProcessedMessageTemplateComponentsUpdate) => void | Promise<void>;
|
|
7510
|
+
type MessagingHandoversHandler = (whatsapp: WhatsApp, processed: ProcessedMessagingHandovers) => void | Promise<void>;
|
|
7511
|
+
type PartnerSolutionsHandler = (whatsapp: WhatsApp, processed: ProcessedPartnerSolutions) => void | Promise<void>;
|
|
7512
|
+
type PaymentConfigurationUpdateHandler = (whatsapp: WhatsApp, processed: ProcessedPaymentConfigurationUpdate) => void | Promise<void>;
|
|
7513
|
+
type StandbyHandler = (whatsapp: WhatsApp, processed: ProcessedStandby) => void | Promise<void>;
|
|
7514
|
+
type TemplateCorrectCategoryDetectionHandler = (whatsapp: WhatsApp, processed: ProcessedTemplateCorrectCategoryDetection) => void | Promise<void>;
|
|
7515
|
+
type TrackingEventsHandler = (whatsapp: WhatsApp, processed: ProcessedTrackingEvents) => void | Promise<void>;
|
|
7516
|
+
type UserPreferencesHandler = (whatsapp: WhatsApp, processed: ProcessedUserPreferences) => void | Promise<void>;
|
|
6717
7517
|
type TextMessageHandler = (whatsapp: WhatsApp, processed: TextProcessedMessage) => void | Promise<void>;
|
|
6718
7518
|
type ImageMessageHandler = (whatsapp: WhatsApp, processed: ImageProcessedMessage) => void | Promise<void>;
|
|
6719
7519
|
type VideoMessageHandler = (whatsapp: WhatsApp, processed: VideoProcessedMessage) => void | Promise<void>;
|
|
@@ -6735,6 +7535,8 @@ declare function processWebhookMessages(request: Request, whatsapp: WhatsApp, ha
|
|
|
6735
7535
|
statusHandler?: StatusHandler;
|
|
6736
7536
|
preProcessHandler?: MessageHandler;
|
|
6737
7537
|
postProcessHandler?: MessageHandler;
|
|
7538
|
+
rawHandler?: RawWebhookHandler;
|
|
7539
|
+
rawHandlerFields?: WebhookFieldType[];
|
|
6738
7540
|
accountUpdateHandler?: AccountUpdateHandler;
|
|
6739
7541
|
accountReviewUpdateHandler?: AccountReviewUpdateHandler;
|
|
6740
7542
|
accountAlertsHandler?: AccountAlertsHandler;
|
|
@@ -6749,6 +7551,23 @@ declare function processWebhookMessages(request: Request, whatsapp: WhatsApp, ha
|
|
|
6749
7551
|
historyHandler?: HistoryHandler;
|
|
6750
7552
|
smbMessageEchoesHandler?: SmbMessageEchoesHandler;
|
|
6751
7553
|
smbAppStateSyncHandler?: SmbAppStateSyncHandler;
|
|
7554
|
+
accountSettingsUpdateHandler?: AccountSettingsUpdateHandler;
|
|
7555
|
+
automaticEventsHandler?: AutomaticEventsHandler;
|
|
7556
|
+
businessStatusUpdateHandler?: BusinessStatusUpdateHandler;
|
|
7557
|
+
callsHandler?: CallsHandler;
|
|
7558
|
+
groupLifecycleUpdateHandler?: GroupLifecycleUpdateHandler;
|
|
7559
|
+
groupParticipantsUpdateHandler?: GroupParticipantsUpdateHandler;
|
|
7560
|
+
groupSettingsUpdateHandler?: GroupSettingsUpdateHandler;
|
|
7561
|
+
groupStatusUpdateHandler?: GroupStatusUpdateHandler;
|
|
7562
|
+
messageEchoesHandler?: MessageEchoesHandler;
|
|
7563
|
+
messageTemplateComponentsUpdateHandler?: MessageTemplateComponentsUpdateHandler;
|
|
7564
|
+
messagingHandoversHandler?: MessagingHandoversHandler;
|
|
7565
|
+
partnerSolutionsHandler?: PartnerSolutionsHandler;
|
|
7566
|
+
paymentConfigurationUpdateHandler?: PaymentConfigurationUpdateHandler;
|
|
7567
|
+
standbyHandler?: StandbyHandler;
|
|
7568
|
+
templateCorrectCategoryDetectionHandler?: TemplateCorrectCategoryDetectionHandler;
|
|
7569
|
+
trackingEventsHandler?: TrackingEventsHandler;
|
|
7570
|
+
userPreferencesHandler?: UserPreferencesHandler;
|
|
6752
7571
|
}): Promise<Response>;
|
|
6753
7572
|
/**
|
|
6754
7573
|
* Handle flow requests
|
|
@@ -6775,6 +7594,7 @@ declare class WebhookProcessor {
|
|
|
6775
7594
|
private statusHandler;
|
|
6776
7595
|
private preProcessHandler;
|
|
6777
7596
|
private postProcessHandler;
|
|
7597
|
+
private rawHandler;
|
|
6778
7598
|
private flowHandlers;
|
|
6779
7599
|
private accountUpdateHandler;
|
|
6780
7600
|
private accountReviewUpdateHandler;
|
|
@@ -6790,6 +7610,23 @@ declare class WebhookProcessor {
|
|
|
6790
7610
|
private historyHandler;
|
|
6791
7611
|
private smbMessageEchoesHandler;
|
|
6792
7612
|
private smbAppStateSyncHandler;
|
|
7613
|
+
private accountSettingsUpdateHandler;
|
|
7614
|
+
private automaticEventsHandler;
|
|
7615
|
+
private businessStatusUpdateHandler;
|
|
7616
|
+
private callsHandler;
|
|
7617
|
+
private groupLifecycleUpdateHandler;
|
|
7618
|
+
private groupParticipantsUpdateHandler;
|
|
7619
|
+
private groupSettingsUpdateHandler;
|
|
7620
|
+
private groupStatusUpdateHandler;
|
|
7621
|
+
private messageEchoesHandler;
|
|
7622
|
+
private messageTemplateComponentsUpdateHandler;
|
|
7623
|
+
private messagingHandoversHandler;
|
|
7624
|
+
private partnerSolutionsHandler;
|
|
7625
|
+
private paymentConfigurationUpdateHandler;
|
|
7626
|
+
private standbyHandler;
|
|
7627
|
+
private templateCorrectCategoryDetectionHandler;
|
|
7628
|
+
private trackingEventsHandler;
|
|
7629
|
+
private userPreferencesHandler;
|
|
6793
7630
|
constructor(config: WhatsAppConfig);
|
|
6794
7631
|
processVerification(mode: string | null, token: string | null, challenge: string | null): Promise<WebhookResponse>;
|
|
6795
7632
|
processWebhook(request: Request): Promise<WebhookResponse>;
|
|
@@ -6798,6 +7635,7 @@ declare class WebhookProcessor {
|
|
|
6798
7635
|
onStatus(handler: StatusHandler): void;
|
|
6799
7636
|
onMessagePreProcess(handler: MessageHandler): void;
|
|
6800
7637
|
onMessagePostProcess(handler: MessageHandler): void;
|
|
7638
|
+
onRaw(handler: RawWebhookHandler, fields?: WebhookFieldType[]): void;
|
|
6801
7639
|
onFlow(type: FlowTypeEnum, handler: FlowHandler): void;
|
|
6802
7640
|
/**
|
|
6803
7641
|
* Register a handler for text messages
|
|
@@ -6934,6 +7772,80 @@ declare class WebhookProcessor {
|
|
|
6934
7772
|
* @see https://developers.facebook.com/docs/graph-api/webhooks/reference/whatsapp-business-account#smb_app_state_sync
|
|
6935
7773
|
*/
|
|
6936
7774
|
onSmbAppStateSync(handler: SmbAppStateSyncHandler): void;
|
|
7775
|
+
/**
|
|
7776
|
+
* Register a handler for account_settings_update webhook field
|
|
7777
|
+
*/
|
|
7778
|
+
onAccountSettingsUpdate(handler: AccountSettingsUpdateHandler): void;
|
|
7779
|
+
/**
|
|
7780
|
+
* Register a handler for automatic_events webhook field
|
|
7781
|
+
*/
|
|
7782
|
+
onAutomaticEvents(handler: AutomaticEventsHandler): void;
|
|
7783
|
+
/**
|
|
7784
|
+
* Register a handler for business_status_update webhook field
|
|
7785
|
+
*/
|
|
7786
|
+
onBusinessStatusUpdate(handler: BusinessStatusUpdateHandler): void;
|
|
7787
|
+
/**
|
|
7788
|
+
* Register a handler for calls webhook field
|
|
7789
|
+
* @see https://developers.facebook.com/documentation/business-messaging/whatsapp/calling/reference/
|
|
7790
|
+
*/
|
|
7791
|
+
onCalls(handler: CallsHandler): void;
|
|
7792
|
+
/**
|
|
7793
|
+
* Register a handler for group_lifecycle_update webhook field
|
|
7794
|
+
* @see https://developers.facebook.com/documentation/business-messaging/whatsapp/groups/reference/
|
|
7795
|
+
*/
|
|
7796
|
+
onGroupLifecycleUpdate(handler: GroupLifecycleUpdateHandler): void;
|
|
7797
|
+
/**
|
|
7798
|
+
* Register a handler for group_participants_update webhook field
|
|
7799
|
+
* @see https://developers.facebook.com/documentation/business-messaging/whatsapp/groups/reference/
|
|
7800
|
+
*/
|
|
7801
|
+
onGroupParticipantsUpdate(handler: GroupParticipantsUpdateHandler): void;
|
|
7802
|
+
/**
|
|
7803
|
+
* Register a handler for group_settings_update webhook field
|
|
7804
|
+
* @see https://developers.facebook.com/documentation/business-messaging/whatsapp/groups/reference/
|
|
7805
|
+
*/
|
|
7806
|
+
onGroupSettingsUpdate(handler: GroupSettingsUpdateHandler): void;
|
|
7807
|
+
/**
|
|
7808
|
+
* Register a handler for group_status_update webhook field
|
|
7809
|
+
* @see https://developers.facebook.com/documentation/business-messaging/whatsapp/groups/reference/
|
|
7810
|
+
*/
|
|
7811
|
+
onGroupStatusUpdate(handler: GroupStatusUpdateHandler): void;
|
|
7812
|
+
/**
|
|
7813
|
+
* Register a handler for message_echoes webhook field
|
|
7814
|
+
* @see https://developers.facebook.com/docs/graph-api/webhooks/reference/whatsapp-business-account#message_echoes
|
|
7815
|
+
*/
|
|
7816
|
+
onMessageEchoes(handler: MessageEchoesHandler): void;
|
|
7817
|
+
/**
|
|
7818
|
+
* Register a handler for message_template_components_update webhook field
|
|
7819
|
+
*/
|
|
7820
|
+
onMessageTemplateComponentsUpdate(handler: MessageTemplateComponentsUpdateHandler): void;
|
|
7821
|
+
/**
|
|
7822
|
+
* Register a handler for messaging_handovers webhook field
|
|
7823
|
+
*/
|
|
7824
|
+
onMessagingHandovers(handler: MessagingHandoversHandler): void;
|
|
7825
|
+
/**
|
|
7826
|
+
* Register a handler for partner_solutions webhook field
|
|
7827
|
+
*/
|
|
7828
|
+
onPartnerSolutions(handler: PartnerSolutionsHandler): void;
|
|
7829
|
+
/**
|
|
7830
|
+
* Register a handler for payment_configuration_update webhook field
|
|
7831
|
+
*/
|
|
7832
|
+
onPaymentConfigurationUpdate(handler: PaymentConfigurationUpdateHandler): void;
|
|
7833
|
+
/**
|
|
7834
|
+
* Register a handler for standby webhook field
|
|
7835
|
+
*/
|
|
7836
|
+
onStandby(handler: StandbyHandler): void;
|
|
7837
|
+
/**
|
|
7838
|
+
* Register a handler for template_correct_category_detection webhook field
|
|
7839
|
+
*/
|
|
7840
|
+
onTemplateCorrectCategoryDetection(handler: TemplateCorrectCategoryDetectionHandler): void;
|
|
7841
|
+
/**
|
|
7842
|
+
* Register a handler for tracking_events webhook field
|
|
7843
|
+
*/
|
|
7844
|
+
onTrackingEvents(handler: TrackingEventsHandler): void;
|
|
7845
|
+
/**
|
|
7846
|
+
* Register a handler for user_preferences webhook field
|
|
7847
|
+
*/
|
|
7848
|
+
onUserPreferences(handler: UserPreferencesHandler): void;
|
|
6937
7849
|
getClient(): WhatsApp;
|
|
6938
7850
|
getConfig(): WabaConfigType;
|
|
6939
7851
|
}
|