meta-cloud-api 1.7.3 → 2.0.1

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.
@@ -1,91 +1,6 @@
1
- import { AudioMediaTypesEnum, BusinessVerticalEnum, ButtonPositionEnum, CategoryEnum, ComponentTypesEnum, ConversationTypesEnum, CurrencyCodesEnum, DataLocalizationRegionEnum, DocumentMediaTypesEnum, HttpMethodsEnum, ImageMediaTypesEnum, InteractiveTypesEnum, LanguagesEnum, MessageTypesEnum, ParametersTypesEnum, ReferralSourceTypesEnum, RequestCodeMethodsEnum, StatusEnum, StickerMediaTypesEnum, SubTypeEnum, SystemChangeTypesEnum, TemplateStatusEnum, VideoMediaTypesEnum, WabaConfigEnum, WebhookTypesEnum } from "./enums-DEu7hLmx.js";
2
- import { IncomingHttpHeaders, IncomingMessage } from "http";
1
+ import { AudioMediaTypesEnum, BusinessVerticalEnum, ButtonPositionEnum, CategoryEnum, ComponentTypesEnum, ConversationTypesEnum, CurrencyCodesEnum, DataLocalizationRegionEnum, DocumentMediaTypesEnum, HttpMethodsEnum, ImageMediaTypesEnum, InteractiveTypesEnum, LanguagesEnum, MessageTypesEnum, ParametersTypesEnum, ReferralSourceTypesEnum, RequestCodeMethodsEnum, StatusEnum, StickerMediaTypesEnum, SubTypeEnum, SystemChangeTypesEnum, TemplateStatusEnum, VideoMediaTypesEnum, WabaConfigEnum, WebhookTypesEnum } from "./enums.js";
2
+ import { IncomingHttpHeaders, IncomingMessage } from "node:http";
3
3
 
4
- //#region src/types/config.d.ts
5
- type WhatsAppConfig = {
6
- accessToken: string;
7
- appId?: string;
8
- appSecret?: string;
9
- phoneNumberId?: number;
10
- businessAcctId?: string;
11
- apiVersion?: string;
12
- webhookEndpoint?: string;
13
- webhookVerificationToken?: string;
14
- listenerPort?: number;
15
- debug?: boolean;
16
- maxRetriesAfterWait?: number;
17
- requestTimeout?: number;
18
- privatePem?: string;
19
- passphrase?: string;
20
- };
21
- type WabaConfigType = {
22
- /**
23
- * The Meta for Developers business application Id for this registered application.
24
- */
25
- [WabaConfigEnum.AppId]: string;
26
- /**
27
- * The Meta for Developers business application secret for this registered application.
28
- */
29
- [WabaConfigEnum.AppSecret]: string;
30
- /**
31
- * The Meta for Developers phone number id used by the registered business.
32
- */
33
- [WabaConfigEnum.PhoneNumberId]: number;
34
- /**
35
- * The Meta for Developers business id for the registered business.
36
- */
37
- [WabaConfigEnum.BusinessAcctId]: string;
38
- /**
39
- * The version of the Cloud API being used. Starts with a "v" and follows the major number.
40
- */
41
- [WabaConfigEnum.APIVersion]: string;
42
- /**
43
- * The access token to make calls on behalf of the signed in Meta for Developers account or business.
44
- */
45
- [WabaConfigEnum.AccessToken]: string;
46
- /**
47
- * The endpoint path (e.g. if the value here is webhook, the webhook URL would look like http/https://{host}/webhook).
48
- */
49
- [WabaConfigEnum.WebhookEndpoint]: string;
50
- /**
51
- * The verification token that needs to match what is sent by the Cloud API webhook in order to subscribe.
52
- */
53
- [WabaConfigEnum.WebhookVerificationToken]: string;
54
- /**
55
- * The listener port for the webhook web server.
56
- */
57
- [WabaConfigEnum.ListenerPort]: number;
58
- /**
59
- * To turn on global debugging of the logger to print verbose output across the APIs.
60
- */
61
- [WabaConfigEnum.Debug]: boolean;
62
- /**
63
- * The total number of times a request should be retried after the wait period if it fails.
64
- */
65
- [WabaConfigEnum.MaxRetriesAfterWait]: number;
66
- /**
67
- * The timeout period for a request to quit and destroy the attempt in ms.
68
- */
69
- [WabaConfigEnum.RequestTimeout]: number;
70
- /**
71
- * The private key for the Meta for Developers business.
72
- */
73
- [WabaConfigEnum.PrivatePem]: string;
74
- /**
75
- * The passphrase for the Meta for Developers business.
76
- */
77
- [WabaConfigEnum.Passphrase]: string;
78
- };
79
- //#endregion
80
- //#region src/types/logger.d.ts
81
- interface LoggerInterface {
82
- log(...data: any[]): void;
83
- error(...data: any[]): void;
84
- warn(...data: any[]): void;
85
- info(...data: any[]): void;
86
- debug(...data: any[]): void;
87
- }
88
- //#endregion
89
4
  //#region src/types/request.d.ts
90
5
  type GeneralRequestBody = Record<string, unknown>;
91
6
  interface GeneralHeaderInterface {
@@ -143,1413 +58,1801 @@ declare class RequesterClass {
143
58
  getJson<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: GeneralRequestBody, additionalHeaders?: Record<string, string>): Promise<T>;
144
59
  sendFormData<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: FormData, additionalHeaders?: Record<string, string>): Promise<T>;
145
60
  sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: Record<string, string>, additionalHeaders?: Record<string, string>): Promise<T>;
61
+ updateTimeout(timeout: number): void;
62
+ updateAccessToken(accessToken: string): void;
146
63
  }
147
64
  //#endregion
148
- //#region src/types/httpsClient.d.ts
149
- type ResponseHeaderValue = string | string[] | undefined;
150
- type ResponseHeaders = Record<string, ResponseHeaderValue>;
151
- type ResponseJSONBody = Record<string, unknown>;
152
- declare class HttpsClientResponseClass {
153
- constructor(resp: Response);
154
- statusCode: () => number;
155
- headers: () => ResponseHeaders;
156
- rawResponse: () => Response;
157
- json: () => Promise<ResponseJSONBody>;
158
- }
159
- declare class HttpsClientClass {
160
- constructor();
161
- clearSockets: () => boolean;
162
- sendRequest: (host: string, path: string, method: HttpMethodsEnum, headers: HeadersInit, timeout: number, body?: BodyInit | null) => Promise<HttpsClientResponseClass>;
163
- }
164
- //#endregion
165
- //#region src/types/base.d.ts
166
- declare class BaseClass {
167
- constructor(config: WabaConfigType);
168
- }
169
- //#endregion
170
- //#region src/api/profile/types/upload.d.ts
65
+ //#region src/api/blockUsers/types/blockUsers.d.ts
171
66
  /**
172
- * Response from creating an upload session.
67
+ * Blocked user information in response
173
68
  */
174
- interface UploadSessionResponse {
175
- id: string;
176
- }
69
+ type BlockedUserInfo = {
70
+ input: string;
71
+ wa_id: string;
72
+ };
177
73
  /**
178
- * Response from uploading business profile media.
74
+ * Failed user information with error details
75
+ * Uses common MetaErrorDetail type for consistency across APIs
179
76
  */
180
- interface UploadBusinessProfileResponse {
181
- h: string;
182
- }
77
+ type FailedUserInfo = BlockedUserInfo & {
78
+ errors?: MetaErrorDetail[];
79
+ };
183
80
  /**
184
- * Upload handle information containing file details and handle.
81
+ * Response for block/unblock operations
185
82
  */
186
- interface UploadHandle {
187
- handle: string;
188
- file_size: number;
189
- upload_result: {
190
- handle_type: string;
191
- name: string;
83
+ type BlockUsersResponse = {
84
+ messaging_product: 'whatsapp';
85
+ block_users: {
86
+ added_users?: BlockedUserInfo[];
87
+ failed_users?: FailedUserInfo[];
192
88
  };
193
- }
194
- //#endregion
195
- //#region src/api/profile/types/common.d.ts
89
+ };
196
90
  /**
197
- * Available fields that can be requested when retrieving a business profile.
91
+ * Pagination cursors for list operations
198
92
  */
199
- type BusinessProfileField = 'about' | 'address' | 'description' | 'email' | 'profile_picture_url' | 'websites' | 'vertical';
200
- type BusinessProfileFieldsParam = BusinessProfileField[] | string;
93
+ type PagingCursors = {
94
+ after?: string;
95
+ before?: string;
96
+ };
201
97
  /**
202
- * Business profile data structure containing all profile information.
98
+ * Pagination information
203
99
  */
204
- interface BusinessProfileData {
205
- /**
206
- * The business's About text. This text appears in the business's profile, beneath its profile image,
207
- * phone number, and contact buttons.
208
- * - String cannot be empty
209
- * - Strings must be between 1 and 139 characters
210
- * - Rendered emojis are supported however their unicode values are not.
211
- * Emoji unicode values must be Java- or JavaScript-escape encoded
212
- * - Hyperlinks can be included but will not render as clickable links
213
- * - Markdown is not supported
214
- */
215
- about?: string;
216
- /**
217
- * Address of the business. Character limit 256.
218
- */
219
- address?: string;
220
- /**
221
- * Description of the business. Character limit 512.
222
- */
223
- description?: string;
224
- /**
225
- * The contact email address (in valid email format) of the business. Character limit 128.
226
- */
227
- email?: string;
228
- /**
229
- * The messaging service used for the request. Always set it to "whatsapp" if you are using
230
- * the WhatsApp Business API.
231
- */
232
- messaging_product: string;
233
- /**
234
- * Profile picture URL.
235
- */
236
- profile_picture_url?: string;
237
- /**
238
- * The URLs associated with the business. For instance, a website, Facebook Page, or Instagram.
239
- * - You must include the http:// or https:// portion of the URL
240
- * - There is a maximum of 2 websites with a maximum of 256 characters each
241
- */
242
- websites?: string[];
243
- /**
244
- * Business category. This can be either an empty string or one of the predefined business categories.
245
- * @see BusinessVerticalEnum for all available options
246
- */
247
- vertical?: BusinessVerticalEnum | string;
248
- }
100
+ type PagingInfo$1 = {
101
+ cursors?: PagingCursors;
102
+ previous?: string;
103
+ next?: string;
104
+ };
249
105
  /**
250
- * Response structure for business profile GET requests.
106
+ * List blocked users response
251
107
  */
252
- interface BusinessProfileResponse {
253
- data: BusinessProfileData[];
254
- }
108
+ type ListBlockedUsersResponse = {
109
+ data: Array<{
110
+ block_users: BlockedUserInfo[];
111
+ }>;
112
+ paging?: PagingInfo$1;
113
+ };
255
114
  /**
256
- * Request structure for updating business profile.
115
+ * Query parameters for listing blocked users
257
116
  */
258
- interface UpdateBusinessProfileRequest {
117
+ type ListBlockedUsersParams = {
118
+ limit?: number;
119
+ after?: string;
120
+ before?: string;
121
+ };
122
+ /**
123
+ * Block Users API Interface
124
+ */
125
+ interface BlockUsersClass {
259
126
  /**
260
- * The messaging service used for the request. Always set it to "whatsapp" if you are using
261
- * the WhatsApp Business API.
262
- * @required
127
+ * Block one or more WhatsApp users
128
+ * @param users - Array of phone numbers or WhatsApp IDs to block
129
+ * @returns Response with successfully blocked and failed users
130
+ * @throws Error if users have not messaged in last 24 hours
131
+ * @see https://developers.facebook.com/docs/whatsapp/cloud-api/block-users#block-users
263
132
  */
264
- messaging_product: string;
133
+ block(users: string[]): Promise<BlockUsersResponse>;
265
134
  /**
266
- * The business's About text. This text appears in the business's profile, beneath its profile image,
267
- * phone number, and contact buttons.
268
- * - String cannot be empty
269
- * - Strings must be between 1 and 139 characters
270
- * - Rendered emojis are supported however their unicode values are not.
271
- * Emoji unicode values must be Java- or JavaScript-escape encoded
272
- * - Hyperlinks can be included but will not render as clickable links
273
- * - Markdown is not supported
135
+ * Unblock one or more WhatsApp users
136
+ * @param users - Array of phone numbers or WhatsApp IDs to unblock
137
+ * @returns Response with successfully unblocked and failed users
138
+ * @see https://developers.facebook.com/docs/whatsapp/cloud-api/block-users#unblock-users
274
139
  */
275
- about?: string;
140
+ unblock(users: string[]): Promise<BlockUsersResponse>;
276
141
  /**
277
- * Address of the business. Character limit 256.
142
+ * Get list of blocked WhatsApp users with pagination
143
+ * @param params - Optional pagination parameters
144
+ * @returns List of blocked users with pagination info
145
+ * @see https://developers.facebook.com/docs/whatsapp/cloud-api/block-users#get-list-of-blocked-numbers
278
146
  */
279
- address?: string;
280
- /**
281
- * Description of the business. Character limit 512.
282
- */
283
- description?: string;
284
- /**
285
- * Business category. This can be either an empty string or one of the predefined business categories.
286
- * @see BusinessVerticalEnum for all available options
287
- */
288
- vertical?: BusinessVerticalEnum | string;
289
- /**
290
- * The contact email address (in valid email format) of the business. Character limit 128.
291
- */
292
- email?: string;
293
- /**
294
- * The URLs associated with the business. For instance, a website, Facebook Page, or Instagram.
295
- * - You must include the http:// or https:// portion of the URL
296
- * - There is a maximum of 2 websites with a maximum of 256 characters each
297
- */
298
- websites?: string[];
299
- /**
300
- * Handle of the profile picture. This handle is generated when you upload the binary file
301
- * for the profile picture to Meta using the Resumable Upload API.
302
- */
303
- profile_picture_handle?: string;
304
- }
305
- declare class BusinessProfileClass extends BaseClass {
306
- /**
307
- * Get your business profile.
308
- * @param fields Specific fields to be returned in the response. If not specified, all fields will be returned.
309
- */
310
- getBusinessProfile(fields?: BusinessProfileFieldsParam): Promise<BusinessProfileResponse>;
311
- /**
312
- * Update your business profile.
313
- * @param updateRequest The request object containing the fields to update.
314
- */
315
- updateBusinessProfile(updateRequest: UpdateBusinessProfileRequest): Promise<ResponseSuccess>;
316
- /**
317
- * Create an upload session for profile picture.
318
- * @param fileLength Length of the file to be uploaded in bytes.
319
- * @param fileType MIME type of the file (e.g., 'image/jpeg').
320
- * @param fileName Name of the file.
321
- */
322
- createUploadSession(fileLength: number, fileType: string, fileName: string): Promise<UploadSessionResponse>;
323
- /**
324
- * Upload media file to the upload session.
325
- * @param uploadId The ID of the upload session.
326
- * @param file The binary data of the file.
327
- */
328
- uploadMedia(uploadId: string, file: Buffer): Promise<UploadBusinessProfileResponse>;
329
- /**
330
- * Get the upload handle information.
331
- * @param uploadId The ID of the upload session.
332
- */
333
- getUploadHandle(uploadId: string): Promise<UploadHandle>;
147
+ listBlockedUsers(params?: ListBlockedUsersParams): Promise<ListBlockedUsersResponse>;
334
148
  }
335
149
  //#endregion
336
- //#region src/api/phone/types/common.d.ts
337
- type QualityRating = 'GREEN' | 'YELLOW' | 'RED' | 'NA';
338
- type AccountMode = 'LIVE' | 'SANDBOX';
339
- type CodeVerificationStatus = 'NOT_VERIFIED' | 'VERIFIED' | 'EXPIRED' | 'PENDING' | 'DELETED' | 'MIGRATED' | 'BANNED' | 'RESTRICTED' | 'RATE_LIMITED' | 'FLAGGED' | 'CONNECTED' | 'DISCONNECTED' | 'UNKNOWN' | 'UNVERIFIED';
340
- type MessagingLimitTier = 'TIER_50' | 'TIER_250' | 'TIER_1K' | 'TIER_10K' | 'TIER_100K' | 'TIER_UNLIMITED';
341
- type PlatformType = 'CLOUD_API' | 'ON_PREMISE' | 'NOT_APPLICABLE';
342
- type ThroughputLevel = 'STANDARD' | 'HIGH' | 'NOT_APPLICABLE';
343
- type HealthStatusEntity = {
344
- entity_type: string;
345
- id: string;
346
- can_send_message: string;
347
- additional_info?: string[];
348
- errors?: Array<{
349
- error_code: number;
350
- error_description: string;
351
- possible_solution: string;
352
- }>;
150
+ //#region src/api/calling/types/calling.d.ts
151
+ /**
152
+ * Calling API Types
153
+ * @see https://developers.facebook.com/documentation/business-messaging/whatsapp/calling/reference/
154
+ */
155
+ type CallingStatus = 'ENABLED' | 'DISABLED';
156
+ type CallIconVisibility = 'DEFAULT' | 'DISABLE_ALL';
157
+ type CallbackPermissionStatus = 'ENABLED' | 'DISABLED';
158
+ type CallHoursStatus = 'ENABLED' | 'DISABLED';
159
+ type SipStatus = 'ENABLED' | 'DISABLED';
160
+ type CallHoursDay = 'MONDAY' | 'TUESDAY' | 'WEDNESDAY' | 'THURSDAY' | 'FRIDAY' | 'SATURDAY' | 'SUNDAY';
161
+ type WeeklyOperatingHours = {
162
+ day_of_week: CallHoursDay;
163
+ open_time: string;
164
+ close_time: string;
165
+ };
166
+ type HolidaySchedule = {
167
+ date: string;
168
+ start_time: string;
169
+ end_time: string;
170
+ };
171
+ type CallHours = {
172
+ status: CallHoursStatus;
173
+ timezone_id: string;
174
+ weekly_operating_hours: WeeklyOperatingHours[];
175
+ holiday_schedule?: HolidaySchedule[];
176
+ };
177
+ type SipServer = {
178
+ hostname: string;
179
+ port?: number;
180
+ request_uri_user_params?: Record<string, string>;
181
+ sip_user_password?: string;
182
+ };
183
+ type SipSettings = {
184
+ status: SipStatus;
185
+ servers?: SipServer[];
186
+ };
187
+ type CallingSettings = {
188
+ status?: CallingStatus;
189
+ call_icon_visibility?: CallIconVisibility;
190
+ call_hours?: CallHours;
191
+ callback_permission_status?: CallbackPermissionStatus;
192
+ sip?: SipSettings;
193
+ };
194
+ type UpdateCallingSettingsRequest = {
195
+ calling: CallingSettings;
196
+ };
197
+ type CallingSettingsResponse = {
198
+ calling?: CallingSettings;
199
+ [key: string]: unknown;
200
+ };
201
+ type CallPermission = {
202
+ status: string;
203
+ expiration_time?: number;
353
204
  };
354
- type HealthStatus = {
355
- can_send_message: string;
356
- entities: HealthStatusEntity[];
205
+ type CallPermissionLimit = {
206
+ time_period: string;
207
+ max_allowed: number;
208
+ current_usage: number;
209
+ limit_expiration_time?: number;
357
210
  };
358
- type QualityScore = {
359
- score: QualityRating;
211
+ type CallPermissionAction = {
212
+ action_name: string;
213
+ can_perform_action: boolean;
214
+ limits?: CallPermissionLimit[];
360
215
  };
361
- type Throughput = {
362
- level: ThroughputLevel;
216
+ type CallPermissionsResponse = {
217
+ messaging_product: 'whatsapp';
218
+ permission: CallPermission;
219
+ actions?: CallPermissionAction[];
363
220
  };
364
- type PhoneNumberResponse = {
365
- display_phone_number: string;
366
- id: string;
367
- quality_rating: QualityRating;
368
- verified_name: string;
369
- account_mode?: AccountMode;
370
- certificate?: string;
371
- code_verification_status?: CodeVerificationStatus;
372
- conversational_automation?: Record<string, unknown>;
373
- eligibility_for_api_business_global_search?: string;
374
- health_status?: HealthStatus;
375
- is_official_business_account?: boolean;
376
- is_on_biz_app?: boolean;
377
- is_pin_enabled?: boolean;
378
- is_preverified_number?: boolean;
379
- last_onboarded_time?: string;
380
- messaging_limit_tier?: MessagingLimitTier;
381
- name_status?: string;
382
- new_certificate?: string;
383
- new_name_status?: string;
384
- platform_type?: PlatformType;
385
- quality_score?: QualityScore;
386
- search_visibility?: string;
387
- status?: CodeVerificationStatus;
388
- throughput?: Throughput;
221
+ type CallSdpType = 'offer' | 'answer';
222
+ type CallSession = {
223
+ sdp_type: CallSdpType;
224
+ sdp: string;
389
225
  };
390
- type Cursors = {
391
- before: string;
392
- after: string;
226
+ type CallAction = 'connect' | 'pre_accept' | 'accept' | 'reject' | 'terminate';
227
+ type InitiateCallRequest = {
228
+ to: string;
229
+ session: CallSession;
230
+ biz_opaque_callback_data?: string;
393
231
  };
394
- type PhoneNumbersResponse = {
395
- data: PhoneNumberResponse[];
396
- paging: Paging;
232
+ type PreAcceptCallRequest = {
233
+ call_id: string;
234
+ session?: CallSession;
397
235
  };
398
- type RequestVerificationCodeRequest = {
399
- code_method: 'SMS' | 'VOICE';
400
- language: string;
236
+ type AcceptCallRequest = {
237
+ call_id: string;
238
+ session?: CallSession;
239
+ biz_opaque_callback_data?: string;
401
240
  };
402
- type VerifyCodeRequest = {
403
- code: string;
241
+ type RejectCallRequest = {
242
+ call_id: string;
404
243
  };
405
- type TwoStepVerificationParams = {
406
- pin: string;
244
+ type TerminateCallRequest = {
245
+ call_id: string;
407
246
  };
408
- /**
409
- * Conversational Components - Commands
410
- */
411
- type ConversationalCommand = {
412
- command_name: string;
413
- command_description: string;
247
+ type InitiateCallResponse = {
248
+ messaging_product: 'whatsapp';
249
+ calls: Array<{
250
+ id: string;
251
+ }>;
414
252
  };
415
- /**
416
- * Conversational Components - Ice Breakers (Prompts)
417
- */
418
- type ConversationalPrompt = string;
419
- /**
420
- * Request payload for configuring conversational automation
421
- */
422
- type ConversationalAutomationRequest = {
423
- enable_welcome_message?: boolean;
424
- commands?: ConversationalCommand[];
425
- prompts?: ConversationalPrompt[];
253
+ type CallActionResponse = {
254
+ messaging_product: 'whatsapp';
255
+ success: boolean;
426
256
  };
257
+ interface CallingClass {
258
+ updateCallingSettings(params: UpdateCallingSettingsRequest): Promise<ResponseSuccess>;
259
+ getCallingSettings(params?: {
260
+ fields?: string[] | string;
261
+ include_sip_credentials?: boolean;
262
+ }): Promise<CallingSettingsResponse>;
263
+ getCallPermissions(params: {
264
+ userWaId: string;
265
+ }): Promise<CallPermissionsResponse>;
266
+ initiateCall(params: InitiateCallRequest): Promise<InitiateCallResponse>;
267
+ preAcceptCall(params: PreAcceptCallRequest): Promise<CallActionResponse>;
268
+ acceptCall(params: AcceptCallRequest): Promise<CallActionResponse>;
269
+ rejectCall(params: RejectCallRequest): Promise<CallActionResponse>;
270
+ terminateCall(params: TerminateCallRequest): Promise<CallActionResponse>;
271
+ }
272
+ //#endregion
273
+ //#region src/api/commerce/types/commerce.d.ts
427
274
  /**
428
- * Response from conversational automation GET endpoint
275
+ * Commerce Settings API Types
276
+ * @see https://developers.facebook.com/documentation/business-messaging/whatsapp/catalogs/sell-products-and-services/set-commerce-settings/
429
277
  */
430
- type ConversationalAutomationResponse = {
431
- enable_welcome_message?: boolean;
432
- commands?: ConversationalCommand[];
433
- prompts?: ConversationalPrompt[];
278
+ type CommerceSetting = {
434
279
  id: string;
280
+ is_cart_enabled?: boolean;
281
+ is_catalog_visible?: boolean;
435
282
  };
436
- /**
437
- * Response from throughput GET endpoint
438
- */
439
- type ThroughputResponse = {
440
- throughput: Throughput;
441
- id: string;
283
+ type CommerceSettingsResponse = {
284
+ data: CommerceSetting[];
442
285
  };
443
- interface PhoneNumberClass {
444
- getPhoneNumberById(fields?: string): Promise<PhoneNumberResponse>;
445
- getPhoneNumbers(): Promise<PhoneNumbersResponse>;
446
- requestVerificationCode(params: RequestVerificationCodeRequest): Promise<ResponseSuccess>;
447
- verifyCode(params: VerifyCodeRequest): Promise<ResponseSuccess>;
448
- setConversationalAutomation(params: ConversationalAutomationRequest): Promise<ResponseSuccess>;
449
- getConversationalAutomation(): Promise<ConversationalAutomationResponse>;
450
- getThroughput(): Promise<ThroughputResponse>;
286
+ type UpdateCommerceSettingsRequest = {
287
+ is_cart_enabled?: boolean;
288
+ is_catalog_visible?: boolean;
289
+ };
290
+ interface CommerceClass {
291
+ getCommerceSettings(): Promise<CommerceSettingsResponse>;
292
+ updateCommerceSettings(params: UpdateCommerceSettingsRequest): Promise<ResponseSuccess>;
451
293
  }
452
294
  //#endregion
453
- //#region src/api/template/types/common.d.ts
454
- type TemplateFormat = 'TEXT' | 'IMAGE' | 'VIDEO' | 'DOCUMENT' | 'LOCATION' | 'PRODUCT';
455
- type PhoneNumberButton = {
456
- type: 'PHONE_NUMBER';
457
- text: string;
458
- phone_number: string;
295
+ //#region src/api/encryption/types/publicKey.d.ts
296
+ type EncryptionPublicKeyResponse = ResponseData<{
297
+ business_public_key: string;
298
+ business_public_key_signature_status: 'VALID' | 'MISMATCH';
299
+ }>;
300
+ //#endregion
301
+ //#region src/api/groups/types/groups.d.ts
302
+ /**
303
+ * Groups API Types
304
+ * @see https://developers.facebook.com/documentation/business-messaging/whatsapp/groups/reference/
305
+ */
306
+ type GroupJoinApprovalMode = 'approval_required' | 'auto_approve';
307
+ type GroupCreateRequest = {
308
+ subject: string;
309
+ description?: string;
310
+ join_approval_mode?: GroupJoinApprovalMode;
459
311
  };
460
- type URLButton = {
461
- type: 'URL';
462
- text: string;
463
- url: string;
464
- example?: string[];
312
+ type GroupCreateResponse = {
313
+ messaging_product: 'whatsapp';
314
+ id: string;
315
+ invite_link?: string;
465
316
  };
466
- type QuickReplyButton = {
467
- type: 'QUICK_REPLY';
468
- text: string;
317
+ type GroupInfoField = 'join_approval_mode' | 'subject' | 'description' | 'suspended' | 'creation_timestamp' | 'participants' | 'total_participant_count';
318
+ type GroupInfoFieldsParam = GroupInfoField[] | string;
319
+ type GroupParticipant = {
320
+ wa_id: string;
469
321
  };
470
- type CopyCodeButton = {
471
- type: 'COPY_CODE';
472
- example: string;
322
+ type GroupInfoResponse = {
323
+ messaging_product: 'whatsapp';
324
+ id: string;
325
+ subject?: string;
326
+ description?: string;
327
+ suspended?: boolean;
328
+ creation_timestamp?: number;
329
+ participants?: GroupParticipant[];
330
+ total_participant_count?: number;
331
+ join_approval_mode?: GroupJoinApprovalMode;
473
332
  };
474
- type FlowButton = {
475
- type: 'FLOW';
476
- text: string;
477
- flow_id?: string;
478
- flow_name?: string;
479
- flow_json?: string;
480
- flow_action?: 'navigate' | 'data_exchange';
481
- navigate_screen?: string;
333
+ type GroupInviteLinkResponse = {
334
+ messaging_product: 'whatsapp';
335
+ invite_link: string;
482
336
  };
483
- type MPMButton = {
484
- type: 'MPM';
485
- action?: {
486
- thumbnail_product_retailer_id: string;
487
- sections: Array<{
488
- title?: string;
489
- product_items: Array<{
490
- product_retailer_id: string;
491
- }>;
492
- }>;
337
+ type GroupJoinRequest = {
338
+ join_request_id: string;
339
+ wa_id: string;
340
+ creation_timestamp: number;
341
+ };
342
+ type GroupJoinRequestError = {
343
+ code: number;
344
+ message: string;
345
+ title?: string;
346
+ error_data?: {
347
+ details?: string;
493
348
  };
494
349
  };
495
- type OTPButton = {
496
- type: 'OTP';
350
+ type GroupJoinRequestFailure = {
351
+ join_request_id: string;
352
+ errors: GroupJoinRequestError[];
497
353
  };
498
- type SPMButton = {
499
- type: 'SPM';
500
- action?: {
501
- product_retailer_id: string;
502
- };
354
+ type GroupJoinRequestsResponse = {
355
+ data: GroupJoinRequest[];
356
+ paging?: PagingInfo;
503
357
  };
504
- type CatalogButton = {
505
- type: 'CATALOG';
506
- action?: {
507
- thumbnail_product_retailer_id: string;
508
- };
358
+ type GroupJoinRequestsActionResponse = {
359
+ messaging_product: 'whatsapp';
360
+ approved_join_requests?: string[];
361
+ rejected_join_requests?: string[];
362
+ failed_join_requests?: GroupJoinRequestFailure[];
363
+ errors?: GroupJoinRequestError[];
509
364
  };
510
- type TemplateButton = PhoneNumberButton | URLButton | QuickReplyButton | CopyCodeButton | FlowButton | MPMButton | OTPButton | SPMButton | CatalogButton;
511
- type TemplateHeaderExample = {
512
- header_text?: string[];
513
- header_text_named_params?: Array<{
514
- param_name: string;
515
- example: string;
516
- }>;
517
- header_handle?: string[];
365
+ type GroupSummary = {
366
+ id: string;
367
+ subject: string;
368
+ created_at: number;
518
369
  };
519
- type TemplateHeader = {
520
- type: 'HEADER';
521
- format: TemplateFormat;
522
- text?: string;
523
- example?: TemplateHeaderExample;
370
+ type GroupListResponse = {
371
+ data: {
372
+ groups: GroupSummary[];
373
+ };
374
+ paging?: PagingInfo;
524
375
  };
525
- type TemplateBody = {
526
- type: 'BODY';
527
- text: string;
528
- example?: {
529
- body_text?: Array<Array<string>>;
530
- body_text_named_params?: Array<{
531
- param_name: string;
532
- example: string;
533
- }>;
376
+ type GroupListParams = {
377
+ limit?: number;
378
+ after?: string;
379
+ before?: string;
380
+ };
381
+ type UpdateGroupSettingsRequest = {
382
+ subject?: string;
383
+ description?: string;
384
+ profilePictureFile?: Blob | Buffer;
385
+ };
386
+ type GroupSettingsResponse = ResponseSuccess;
387
+ interface GroupsClass {
388
+ createGroup(params: GroupCreateRequest): Promise<GroupCreateResponse>;
389
+ deleteGroup(groupId: string): Promise<ResponseSuccess>;
390
+ getGroupInfo(groupId: string, fields?: GroupInfoFieldsParam): Promise<GroupInfoResponse>;
391
+ getActiveGroups(params?: GroupListParams): Promise<GroupListResponse>;
392
+ getGroupInviteLink(groupId: string): Promise<GroupInviteLinkResponse>;
393
+ resetGroupInviteLink(groupId: string): Promise<GroupInviteLinkResponse>;
394
+ getJoinRequests(groupId: string): Promise<GroupJoinRequestsResponse>;
395
+ approveJoinRequests(groupId: string, joinRequestIds: string[]): Promise<GroupJoinRequestsActionResponse>;
396
+ rejectJoinRequests(groupId: string, joinRequestIds: string[]): Promise<GroupJoinRequestsActionResponse>;
397
+ removeParticipants(groupId: string, participants: string[]): Promise<ResponseSuccess>;
398
+ updateGroupSettings(groupId: string, params: UpdateGroupSettingsRequest): Promise<GroupSettingsResponse>;
399
+ }
400
+ type PagingInfo = {
401
+ cursors?: {
402
+ before?: string;
403
+ after?: string;
534
404
  };
405
+ previous?: string;
406
+ next?: string;
535
407
  };
536
- type TemplateFooter = {
537
- type: 'FOOTER';
408
+ //#endregion
409
+ //#region src/api/messages/types/text.d.ts
410
+ type TextObject = {
411
+ body: string;
412
+ preview_url?: boolean;
413
+ };
414
+ interface TextMessageParams extends MessageRequestParams<TextObject | string> {
415
+ previewUrl?: boolean;
416
+ }
417
+ //#endregion
418
+ //#region src/api/messages/types/template.d.ts
419
+ type LanguageObject = {
420
+ policy: 'deterministic';
421
+ code: LanguagesEnum;
422
+ };
423
+ type ParametersObject<T extends ParametersTypesEnum> = {
424
+ type: T;
425
+ };
426
+ type SimpleTextObject$1 = {
538
427
  text: string;
539
428
  };
540
- type TemplateButtons = {
541
- type: 'BUTTONS';
542
- buttons: TemplateButton[];
429
+ type TextParametersObject = ParametersObject<ParametersTypesEnum.Text> & SimpleTextObject$1;
430
+ type CouponCodeParametersObject = ParametersObject<ParametersTypesEnum.CouponCode> & {
431
+ coupon_code: string;
543
432
  };
544
- type TemplateLimitedTimeOffer = {
545
- type: 'LIMITED_TIME_OFFER';
546
- limited_time_offer: {
547
- expiration_time_ms: number;
548
- };
433
+ type CurrencyObject = {
434
+ fallback_value: string;
435
+ code: CurrencyCodesEnum;
436
+ amount_1000: number;
549
437
  };
550
- type TemplateCarousel = {
551
- type: 'CAROUSEL';
552
- cards: Array<{
553
- card_index: number;
554
- components: ComponentTypes[];
555
- }>;
438
+ type CurrencyParametersObject = ParametersObject<ParametersTypesEnum.Currency> & {
439
+ currency: CurrencyObject;
556
440
  };
557
- type MediaCarouselCard = {
558
- card_index: number;
559
- components: (TemplateHeader | TemplateBody | TemplateButtons)[];
441
+ type DateTimeObject = {
442
+ fallback_value: string;
560
443
  };
561
- type ProductCarouselCard = {
562
- card_index: number;
563
- components: TemplateHeader[];
444
+ type DateTimeParametersObject = ParametersObject<ParametersTypesEnum.Currency> & {
445
+ date_time: DateTimeObject;
564
446
  };
565
- type ComponentTypes = TemplateHeader | TemplateBody | TemplateFooter | TemplateButtons | TemplateLimitedTimeOffer | TemplateCarousel;
566
- type TemplateRequestBody = GeneralRequestBody & {
447
+ type DocumentMediaObject$2 = {
448
+ id?: string;
449
+ link?: string;
450
+ caption?: string;
451
+ filename?: string;
452
+ };
453
+ type ImageMediaObject$2 = {
454
+ id?: string;
455
+ link?: string;
456
+ caption?: string;
457
+ };
458
+ type VideoMediaObject$2 = {
459
+ id?: string;
460
+ link?: string;
461
+ caption?: string;
462
+ };
463
+ type DocumentParametersObject = ParametersObject<ParametersTypesEnum.Document> & DocumentMediaObject$2;
464
+ type ImageParametersObject = ParametersObject<ParametersTypesEnum.Image> & ImageMediaObject$2;
465
+ type VideoParametersObject = ParametersObject<ParametersTypesEnum.Video> & VideoMediaObject$2;
466
+ type ComponentObject<T extends ComponentTypesEnum> = {
467
+ type: T;
468
+ parameters: (CurrencyParametersObject | DateTimeParametersObject | DocumentParametersObject | ImageParametersObject | TextParametersObject | VideoParametersObject | CouponCodeParametersObject)[];
469
+ };
470
+ type ButtonComponentObject = ComponentObject<ComponentTypesEnum.Button> & {
471
+ parameters?: (TextParametersObject | PayloadParametersObject)[];
472
+ sub_type: SubTypeEnum;
473
+ index: ButtonPositionEnum;
474
+ };
475
+ type PayloadParametersObject = ParametersObject<ParametersTypesEnum.Payload> & {
476
+ payload: string;
477
+ };
478
+ type MessageTemplateObject<T extends ComponentTypesEnum> = {
567
479
  name: string;
568
- language: LanguagesEnum;
569
- category?: CategoryEnum;
570
- components?: ComponentTypes[];
480
+ language: LanguageObject;
481
+ components?: (ComponentObject<T> | ButtonComponentObject)[];
571
482
  };
572
- type TemplateResponse = {
483
+ //#endregion
484
+ //#region src/api/messages/types/media.d.ts
485
+ type MetaMediaObject = {
573
486
  id: string;
574
- status: string;
575
- language: LanguagesEnum;
576
- category: CategoryEnum;
577
- name: string;
578
- components: ComponentTypes[];
487
+ link?: never;
579
488
  };
580
- type TemplateGetParams = {
581
- limit?: number;
582
- name?: string;
583
- language?: LanguagesEnum;
584
- category?: CategoryEnum;
585
- status?: TemplateStatusEnum;
489
+ type HostedMediaObject = {
490
+ id?: never;
491
+ link: string;
586
492
  };
587
- type TemplateDeleteParams = {
588
- hsm_id: string;
589
- name: string;
493
+ type AudioMediaObject = MetaMediaObject | HostedMediaObject;
494
+ type MetaDocumentMediaObject = MetaMediaObject & {
495
+ caption?: string;
496
+ filename?: string;
590
497
  };
591
- declare class TemplateClass {
592
- getTemplate(templateId: string): Promise<TemplateResponse>;
593
- updateTemplate(templateId: string, template: Partial<TemplateRequestBody>): Promise<ResponseSuccess>;
594
- getTemplates(params?: TemplateGetParams): Promise<ResponsePagination<TemplateResponse>>;
595
- createTemplate(template: TemplateRequestBody): Promise<TemplateResponse>;
596
- deleteTemplate(params: TemplateDeleteParams): Promise<ResponseSuccess>;
597
- }
498
+ type HostedDocumentMediaObject = HostedMediaObject & {
499
+ caption?: string;
500
+ filename?: string;
501
+ };
502
+ type DocumentMediaObject = MetaDocumentMediaObject | HostedDocumentMediaObject;
503
+ type MetaImageMediaObject = MetaMediaObject & {
504
+ caption?: string;
505
+ };
506
+ type HostedImageMediaObject = HostedMediaObject & {
507
+ caption?: string;
508
+ };
509
+ type ImageMediaObject = MetaImageMediaObject | HostedImageMediaObject;
510
+ type MetaVideoMediaObject = MetaMediaObject & {
511
+ caption?: string;
512
+ };
513
+ type HostedVideoMediaObject = HostedMediaObject & {
514
+ caption?: string;
515
+ };
516
+ type VideoMediaObject = MetaVideoMediaObject | HostedVideoMediaObject;
517
+ type StickerMediaObject = MetaMediaObject | HostedMediaObject;
598
518
  //#endregion
599
- //#region src/api/template/types/factory.d.ts
600
- interface TextParameter {
601
- type: 'text';
602
- value: string;
603
- }
604
- interface CurrencyParameter {
605
- type: 'currency';
606
- amount_1000: number;
607
- code: CurrencyCodesEnum;
608
- fallback_value: string;
609
- }
610
- interface DateTimeParameter {
611
- type: 'date_time';
612
- fallback_value: string;
613
- }
614
- interface MediaParameter {
615
- type: 'image' | 'video' | 'document';
616
- handle?: string;
617
- link?: string;
618
- }
619
- interface LocationParameter {
620
- type: 'location';
621
- latitude?: number;
622
- longitude?: number;
519
+ //#region src/api/messages/types/contact.d.ts
520
+ type AddressesObject = {
521
+ street?: string;
522
+ city?: string;
523
+ state?: string;
524
+ zip?: string;
525
+ country?: string;
526
+ country_code?: string;
527
+ type?: 'HOME' | 'WORK' | string;
528
+ };
529
+ type EmailObject = {
530
+ email?: string;
531
+ type?: 'HOME' | 'WORK' | string;
532
+ };
533
+ type NameObject = {
534
+ formatted_name: string;
535
+ first_name?: string;
536
+ last_name?: string;
537
+ middle_name?: string;
538
+ suffix?: string;
539
+ prefix?: string;
540
+ };
541
+ type OrgObject = {
542
+ company?: string;
543
+ department?: string;
544
+ title?: string;
545
+ };
546
+ type PhoneObject = {
547
+ phone?: string;
548
+ type?: 'CELL' | 'MAIN' | 'IPHONE' | 'HOME' | 'WORK' | string;
549
+ wa_id?: string;
550
+ };
551
+ type URLObject = {
552
+ url?: string;
553
+ type?: 'HOME' | 'WORK' | string;
554
+ };
555
+ type ContactObject = {
556
+ addresses?: AddressesObject[];
557
+ birthday?: `${number}${number}${number}${number}-${number}${number}-${number}${number}`;
558
+ emails?: EmailObject[];
559
+ name: NameObject;
560
+ org?: OrgObject;
561
+ phones?: PhoneObject[];
562
+ urls?: URLObject[];
563
+ };
564
+ //#endregion
565
+ //#region src/api/messages/types/location.d.ts
566
+ type LocationObject = {
567
+ longitude: number;
568
+ latitude: number;
623
569
  name?: string;
624
570
  address?: string;
625
- }
626
- interface ProductParameter {
627
- type: 'product';
571
+ };
572
+ //#endregion
573
+ //#region src/api/messages/types/interactive.d.ts
574
+ type DocumentMediaObject$1 = {
575
+ id?: string;
576
+ link?: string;
577
+ caption?: string;
578
+ filename?: string;
579
+ };
580
+ type ImageMediaObject$1 = {
581
+ id?: string;
582
+ link?: string;
583
+ caption?: string;
584
+ };
585
+ type VideoMediaObject$1 = {
586
+ id?: string;
587
+ link?: string;
588
+ caption?: string;
589
+ };
590
+ type ProductObject = {
628
591
  product_retailer_id: string;
629
- }
630
- type TemplateParameter = TextParameter | CurrencyParameter | DateTimeParameter | MediaParameter | LocationParameter | ProductParameter;
631
- interface HeaderOptions {
632
- format: TemplateFormat;
633
- text?: string;
634
- parameters?: TemplateParameter[];
635
- example?: {
636
- header_text?: string[];
637
- header_text_named_params?: Array<{
638
- param_name: string;
639
- example: string;
640
- }>;
641
- header_handle?: string[];
642
- };
643
- }
644
- interface BodyOptions {
645
- text: string;
646
- parameters?: TemplateParameter[];
647
- example?: {
648
- body_text?: string[][];
649
- body_text_named_params?: Array<{
650
- param_name: string;
651
- example: string;
652
- }>;
653
- };
654
- }
655
- interface FooterOptions {
592
+ };
593
+ type SimpleTextObject = {
656
594
  text: string;
657
- }
658
- interface ButtonOptions {
659
- phone_number?: {
660
- text: string;
661
- phone_number: string;
662
- };
663
- url?: {
664
- text: string;
665
- url: string;
666
- example?: string;
667
- };
668
- quick_reply?: {
669
- text: string;
670
- }[];
671
- copy_code?: {
672
- example: string;
673
- };
674
- flow?: {
675
- text: string;
676
- flow_id?: string;
677
- flow_name?: string;
678
- flow_json?: string;
679
- flow_action?: 'navigate' | 'data_exchange';
680
- navigate_screen?: string;
681
- };
682
- mpm?: boolean;
683
- otp?: boolean;
684
- spm?: boolean;
685
- }
686
- interface CarouselCard {
687
- image?: string;
688
- video?: string;
689
- product?: string;
690
- body?: string;
691
- bodyParameters?: TemplateParameter[];
692
- buttons?: ButtonOptions;
693
- }
694
- interface CarouselOptions {
695
- cards: CarouselCard[];
696
- }
697
- interface LimitedTimeOfferOptions {
698
- expiration_time_ms: number;
699
- }
700
- interface ProductSection {
595
+ };
596
+ type RowObject = {
597
+ id: string;
598
+ title: string;
599
+ description?: string;
600
+ };
601
+ type MultiProductSectionObject = {
602
+ product_items: ProductObject[];
603
+ rows?: never;
701
604
  title?: string;
702
- product_items: Array<{
703
- product_retailer_id: string;
704
- }>;
705
- }
706
- interface TemplateOptions {
707
- name: string;
708
- language: LanguagesEnum;
709
- category: CategoryEnum;
710
- header?: HeaderOptions;
711
- body?: BodyOptions;
712
- footer?: FooterOptions;
713
- buttons?: ButtonOptions;
714
- carousel?: CarouselOptions;
715
- limitedTimeOffer?: LimitedTimeOfferOptions;
716
- }
717
- interface OTPTemplateOptions {
718
- name: string;
719
- language: LanguagesEnum;
720
- code_expiration_minutes?: number;
721
- add_security_recommendation?: boolean;
722
- }
723
- interface AuthenticationTemplateOptions {
724
- name: string;
725
- language: LanguagesEnum;
726
- code_expiration_minutes?: number;
727
- add_security_recommendation?: boolean;
728
- copy_code_button?: boolean;
729
- }
730
- interface CatalogTemplateOptions {
731
- name: string;
732
- language: LanguagesEnum;
733
- header?: Omit<HeaderOptions, 'format'>;
734
- body: BodyOptions;
735
- footer?: FooterOptions;
736
- thumbnail_product_retailer_id: string;
737
- }
738
- interface CouponTemplateOptions {
739
- name: string;
740
- language: LanguagesEnum;
741
- header?: Omit<HeaderOptions, 'format'>;
742
- body: BodyOptions;
743
- footer?: FooterOptions;
744
- coupon_code: string;
745
- }
746
- interface LimitedTimeOfferTemplateOptions {
747
- name: string;
748
- language: LanguagesEnum;
749
- header?: Omit<HeaderOptions, 'format'>;
750
- body: BodyOptions;
751
- footer?: FooterOptions;
752
- expiration_time_ms: number;
753
- }
754
- interface MediaCardCarouselTemplateOptions {
755
- name: string;
756
- language: LanguagesEnum;
757
- cards: Array<{
758
- header: {
759
- format: 'IMAGE' | 'VIDEO';
760
- example: {
761
- header_handle: string[];
762
- };
763
- };
764
- body: BodyOptions;
765
- buttons?: ButtonOptions;
766
- }>;
767
- }
768
- interface MPMTemplateOptions {
769
- name: string;
770
- language: LanguagesEnum;
771
- header?: Omit<HeaderOptions, 'format'>;
772
- body: BodyOptions;
773
- footer?: FooterOptions;
774
- thumbnail_product_retailer_id: string;
775
- sections: ProductSection[];
776
- }
777
- interface ProductCardCarouselTemplateOptions {
778
- name: string;
779
- language: LanguagesEnum;
780
- header?: Omit<HeaderOptions, 'format'>;
781
- body: BodyOptions;
782
- footer?: FooterOptions;
783
- cards: Array<{
784
- product_retailer_id: string;
785
- }>;
786
- }
787
- interface SPMTemplateOptions {
788
- name: string;
789
- language: LanguagesEnum;
790
- header?: Omit<HeaderOptions, 'format'>;
791
- body: BodyOptions;
792
- footer?: FooterOptions;
793
- product_retailer_id: string;
794
- }
795
- //#endregion
796
- //#region src/api/messages/types/text.d.ts
797
- type TextObject = {
798
- body: string;
799
- preview_url?: boolean;
800
605
  };
801
- interface TextMessageParams extends MessageRequestParams<TextObject | string> {
802
- previewUrl?: boolean;
803
- }
804
- //#endregion
805
- //#region src/api/messages/types/template.d.ts
806
- type LanguageObject = {
807
- policy: 'deterministic';
808
- code: LanguagesEnum;
606
+ type ListSectionObject = {
607
+ product_items?: never;
608
+ rows: RowObject[];
609
+ title?: string;
809
610
  };
810
- type ParametersObject<T extends ParametersTypesEnum> = {
811
- type: T;
611
+ type SectionObject = MultiProductSectionObject | ListSectionObject;
612
+ type ButtonObject = {
613
+ title: string;
614
+ id: string;
812
615
  };
813
- type SimpleTextObject$1 = {
814
- text: string;
616
+ type ReplyButtonObject = {
617
+ type: 'reply';
618
+ reply: ButtonObject;
815
619
  };
816
- type TextParametersObject = ParametersObject<ParametersTypesEnum.Text> & SimpleTextObject$1;
817
- type CouponCodeParametersObject = ParametersObject<ParametersTypesEnum.CouponCode> & {
818
- coupon_code: string;
620
+ type ActionObject = {
621
+ buttons?: ReplyButtonObject[];
622
+ catalog_id?: string;
623
+ product_retailer_id?: string;
624
+ sections?: SectionObject[];
819
625
  };
820
- type CurrencyObject = {
821
- fallback_value: string;
822
- code: CurrencyCodesEnum;
823
- amount_1000: number;
626
+ type HeaderObject = {
627
+ type: 'document' | 'image' | 'text' | 'video';
628
+ document?: DocumentMediaObject$1;
629
+ image?: ImageMediaObject$1;
630
+ text?: string;
631
+ video?: VideoMediaObject$1;
824
632
  };
825
- type CurrencyParametersObject = ParametersObject<ParametersTypesEnum.Currency> & {
826
- currency: CurrencyObject;
633
+ type ButtonInteractiveObject = {
634
+ type: InteractiveTypesEnum.Button;
635
+ body: SimpleTextObject;
636
+ footer?: SimpleTextObject;
637
+ header?: HeaderObject;
638
+ action: ActionObject;
827
639
  };
828
- type DateTimeObject = {
829
- fallback_value: string;
640
+ type ListInteractiveObject = {
641
+ type: InteractiveTypesEnum.List;
642
+ body: SimpleTextObject;
643
+ footer?: SimpleTextObject;
644
+ header?: HeaderObject;
645
+ action: ActionObject;
830
646
  };
831
- type DateTimeParametersObject = ParametersObject<ParametersTypesEnum.Currency> & {
832
- date_time: DateTimeObject;
647
+ type ProductInteractiveObject = {
648
+ type: InteractiveTypesEnum.Product;
649
+ body?: SimpleTextObject;
650
+ footer?: SimpleTextObject;
651
+ header?: HeaderObject;
652
+ action: ActionObject;
833
653
  };
834
- type DocumentMediaObject$2 = {
835
- id?: string;
836
- link?: string;
837
- caption?: string;
838
- filename?: string;
654
+ type ProductListInteractiveObject = {
655
+ type: InteractiveTypesEnum.ProductList;
656
+ body: SimpleTextObject;
657
+ footer?: SimpleTextObject;
658
+ header: HeaderObject;
659
+ action: ActionObject;
839
660
  };
840
- type ImageMediaObject$2 = {
841
- id?: string;
842
- link?: string;
843
- caption?: string;
661
+ type CtaUrlParameters = {
662
+ display_text: string;
663
+ url: string;
664
+ };
665
+ type CtaUrlActionObject = {
666
+ name: 'cta_url';
667
+ parameters: CtaUrlParameters;
668
+ };
669
+ type CtaUrlInteractiveObject = {
670
+ type: InteractiveTypesEnum.CtaUrl;
671
+ body?: SimpleTextObject;
672
+ footer?: SimpleTextObject;
673
+ header?: HeaderObject;
674
+ action: CtaUrlActionObject;
675
+ };
676
+ type LocationRequestActionObject = {
677
+ name: 'send_location';
678
+ };
679
+ type LocationRequestInteractiveObject = {
680
+ type: InteractiveTypesEnum.LocationRequest;
681
+ body: SimpleTextObject;
682
+ footer?: SimpleTextObject;
683
+ header?: HeaderObject;
684
+ action: LocationRequestActionObject;
685
+ };
686
+ type AddressValues = {
687
+ name?: string;
688
+ phone_number?: string;
689
+ in_pin_code?: string;
690
+ house_number?: string;
691
+ floor_number?: string;
692
+ tower_number?: string;
693
+ building_name?: string;
694
+ address?: string;
695
+ landmark_area?: string;
696
+ city?: string;
697
+ state?: string;
698
+ };
699
+ type SavedAddress = {
700
+ id: string;
701
+ value: AddressValues;
702
+ };
703
+ type ValidationErrors = { [key in keyof AddressValues]?: string };
704
+ type AddressMessageParameters = {
705
+ country: string;
706
+ values?: AddressValues;
707
+ saved_addresses?: SavedAddress[];
708
+ validation_errors?: ValidationErrors;
709
+ };
710
+ type AddressMessageActionObject = {
711
+ name: 'address_message';
712
+ parameters: AddressMessageParameters;
713
+ };
714
+ type AddressMessageInteractiveObject = {
715
+ type: InteractiveTypesEnum.AddressMessage;
716
+ body: SimpleTextObject;
717
+ footer?: SimpleTextObject;
718
+ header?: HeaderObject;
719
+ action: AddressMessageActionObject;
720
+ };
721
+ type FlowParameters = {
722
+ flow_message_version: string;
723
+ flow_id?: string;
724
+ flow_name?: string;
725
+ flow_cta: string;
726
+ mode?: 'draft' | 'published';
727
+ flow_token: string;
728
+ flow_action: 'navigate' | 'data_exchange';
729
+ flow_action_payload?: {
730
+ screen?: string;
731
+ data?: Record<string, string>;
732
+ };
733
+ };
734
+ type FlowActionObject = {
735
+ name: 'flow';
736
+ parameters: FlowParameters;
737
+ };
738
+ type FlowInteractiveObject = {
739
+ type: InteractiveTypesEnum.Flow;
740
+ body: SimpleTextObject;
741
+ footer?: SimpleTextObject;
742
+ header?: HeaderObject;
743
+ action: FlowActionObject;
744
+ };
745
+ type CarouselHeaderObject = {
746
+ type: 'image' | 'video';
747
+ image?: ImageMediaObject$1;
748
+ video?: VideoMediaObject$1;
749
+ };
750
+ type CarouselQuickReply = {
751
+ id: string;
752
+ title: string;
753
+ };
754
+ type CarouselQuickReplyButton = {
755
+ type: 'quick_reply';
756
+ quick_reply: CarouselQuickReply;
757
+ };
758
+ type CarouselCtaUrlAction = {
759
+ name: 'cta_url';
760
+ parameters: CtaUrlParameters;
761
+ };
762
+ type CarouselQuickReplyAction = {
763
+ buttons: CarouselQuickReplyButton[];
764
+ };
765
+ type MediaCarouselCard$1 = {
766
+ card_index: number;
767
+ type: 'cta_url';
768
+ header: CarouselHeaderObject;
769
+ body?: SimpleTextObject;
770
+ action: CarouselCtaUrlAction | CarouselQuickReplyAction;
771
+ };
772
+ type ProductCarouselAction = {
773
+ product_retailer_id: string;
774
+ catalog_id: string;
775
+ };
776
+ type ProductCarouselCard$1 = {
777
+ card_index: number;
778
+ type: 'product';
779
+ action: ProductCarouselAction;
780
+ };
781
+ type CarouselActionObject = {
782
+ cards: Array<MediaCarouselCard$1 | ProductCarouselCard$1>;
783
+ };
784
+ type CarouselInteractiveObject = {
785
+ type: InteractiveTypesEnum.Carousel;
786
+ body: SimpleTextObject;
787
+ action: CarouselActionObject;
788
+ };
789
+ type InteractiveObject = ButtonInteractiveObject | ListInteractiveObject | ProductInteractiveObject | ProductListInteractiveObject | CtaUrlInteractiveObject | CarouselInteractiveObject | LocationRequestInteractiveObject | AddressMessageInteractiveObject | FlowInteractiveObject;
790
+ //#endregion
791
+ //#region src/api/messages/types/reaction.d.ts
792
+ interface ReactionParams {
793
+ messageId: string;
794
+ emoji: string;
795
+ to: string;
796
+ }
797
+ //#endregion
798
+ //#region src/types/config.d.ts
799
+ type WhatsAppConfig = {
800
+ accessToken: string;
801
+ appId?: string;
802
+ appSecret?: string;
803
+ phoneNumberId?: number;
804
+ businessAcctId?: string;
805
+ apiVersion?: string;
806
+ webhookEndpoint?: string;
807
+ webhookVerificationToken?: string;
808
+ listenerPort?: number;
809
+ debug?: boolean;
810
+ maxRetriesAfterWait?: number;
811
+ requestTimeout?: number;
812
+ privatePem?: string;
813
+ passphrase?: string;
814
+ };
815
+ type WabaConfigType = {
816
+ /**
817
+ * The Meta for Developers business application Id for this registered application.
818
+ */
819
+ [WabaConfigEnum.AppId]: string;
820
+ /**
821
+ * The Meta for Developers business application secret for this registered application.
822
+ */
823
+ [WabaConfigEnum.AppSecret]: string;
824
+ /**
825
+ * The Meta for Developers phone number id used by the registered business.
826
+ */
827
+ [WabaConfigEnum.PhoneNumberId]: number;
828
+ /**
829
+ * The Meta for Developers business id for the registered business.
830
+ */
831
+ [WabaConfigEnum.BusinessAcctId]: string;
832
+ /**
833
+ * The version of the Cloud API being used. Starts with a "v" and follows the major number.
834
+ */
835
+ [WabaConfigEnum.APIVersion]: string;
836
+ /**
837
+ * The access token to make calls on behalf of the signed in Meta for Developers account or business.
838
+ */
839
+ [WabaConfigEnum.AccessToken]: string;
840
+ /**
841
+ * The endpoint path (e.g. if the value here is webhook, the webhook URL would look like http/https://{host}/webhook).
842
+ */
843
+ [WabaConfigEnum.WebhookEndpoint]: string;
844
+ /**
845
+ * The verification token that needs to match what is sent by the Cloud API webhook in order to subscribe.
846
+ */
847
+ [WabaConfigEnum.WebhookVerificationToken]: string;
848
+ /**
849
+ * The listener port for the webhook web server.
850
+ */
851
+ [WabaConfigEnum.ListenerPort]: number;
852
+ /**
853
+ * To turn on global debugging of the logger to print verbose output across the APIs.
854
+ */
855
+ [WabaConfigEnum.Debug]: boolean;
856
+ /**
857
+ * The total number of times a request should be retried after the wait period if it fails.
858
+ */
859
+ [WabaConfigEnum.MaxRetriesAfterWait]: number;
860
+ /**
861
+ * The timeout period for a request to quit and destroy the attempt in ms.
862
+ */
863
+ [WabaConfigEnum.RequestTimeout]: number;
864
+ /**
865
+ * The private key for the Meta for Developers business.
866
+ */
867
+ [WabaConfigEnum.PrivatePem]: string;
868
+ /**
869
+ * The passphrase for the Meta for Developers business.
870
+ */
871
+ [WabaConfigEnum.Passphrase]: string;
844
872
  };
845
- type VideoMediaObject$2 = {
846
- id?: string;
847
- link?: string;
848
- caption?: string;
873
+ //#endregion
874
+ //#region src/types/base.d.ts
875
+ declare class BaseClass {
876
+ constructor(config: WabaConfigType);
877
+ }
878
+ //#endregion
879
+ //#region src/api/messages/types/common.d.ts
880
+ type GeneralMessageBody = GeneralRequestBody & {
881
+ /**
882
+ * The Meta messaging product name.
883
+ * @default 'whatsapp'
884
+ */
885
+ messaging_product: 'whatsapp';
849
886
  };
850
- type DocumentParametersObject = ParametersObject<ParametersTypesEnum.Document> & DocumentMediaObject$2;
851
- type ImageParametersObject = ParametersObject<ParametersTypesEnum.Image> & ImageMediaObject$2;
852
- type VideoParametersObject = ParametersObject<ParametersTypesEnum.Video> & VideoMediaObject$2;
853
- type ComponentObject<T extends ComponentTypesEnum> = {
854
- type: T;
855
- parameters: (CurrencyParametersObject | DateTimeParametersObject | DocumentParametersObject | ImageParametersObject | TextParametersObject | VideoParametersObject | CouponCodeParametersObject)[];
887
+ type ConTextObject = {
888
+ message_id: string;
856
889
  };
857
- type ButtonComponentObject = ComponentObject<ComponentTypesEnum.Button> & {
858
- parameters?: (TextParametersObject | PayloadParametersObject)[];
859
- sub_type: SubTypeEnum;
860
- index: ButtonPositionEnum;
890
+ type MessageRequestBody<T extends MessageTypesEnum> = GeneralMessageBody & {
891
+ recipient_type?: string;
892
+ to: string;
893
+ context?: ConTextObject;
894
+ type?: T;
861
895
  };
862
- type PayloadParametersObject = ParametersObject<ParametersTypesEnum.Payload> & {
863
- payload: string;
896
+ interface MessageRequestParams<T> {
897
+ body: T;
898
+ to: string;
899
+ replyMessageId?: string;
900
+ }
901
+ interface StatusParams {
902
+ status: string;
903
+ messageId: string;
904
+ typingIndicator?: {
905
+ type: string;
906
+ };
907
+ }
908
+ type MessagesResponse = GeneralMessageBody & {
909
+ contacts: [{
910
+ input: string;
911
+ wa_id: string;
912
+ }];
913
+ messages: [{
914
+ id: string;
915
+ }];
864
916
  };
865
- type MessageTemplateObject<T extends ComponentTypesEnum> = {
866
- name: string;
867
- language: LanguageObject;
868
- components?: (ComponentObject<T> | ButtonComponentObject)[];
917
+ declare class MessagesClass extends BaseClass {
918
+ text(params: TextMessageParams): Promise<MessagesResponse>;
919
+ template(params: MessageRequestParams<MessageTemplateObject<ComponentTypesEnum>>): Promise<MessagesResponse>;
920
+ audio(params: MessageRequestParams<AudioMediaObject>): Promise<MessagesResponse>;
921
+ document(params: MessageRequestParams<DocumentMediaObject>): Promise<MessagesResponse>;
922
+ image(params: MessageRequestParams<ImageMediaObject>): Promise<MessagesResponse>;
923
+ video(params: MessageRequestParams<VideoMediaObject>): Promise<MessagesResponse>;
924
+ sticker(params: MessageRequestParams<StickerMediaObject>): Promise<MessagesResponse>;
925
+ contacts(params: MessageRequestParams<[ContactObject]>): Promise<MessagesResponse>;
926
+ location(params: MessageRequestParams<LocationObject>): Promise<MessagesResponse>;
927
+ interactive(params: MessageRequestParams<InteractiveObject>): Promise<MessagesResponse>;
928
+ interactiveList(params: MessageRequestParams<InteractiveObject & {
929
+ type: InteractiveTypesEnum.List;
930
+ }>): Promise<MessagesResponse>;
931
+ interactiveCtaUrl(params: MessageRequestParams<InteractiveObject & {
932
+ type: InteractiveTypesEnum.CtaUrl;
933
+ }>): Promise<MessagesResponse>;
934
+ interactiveLocationRequest(params: MessageRequestParams<InteractiveObject & {
935
+ type: InteractiveTypesEnum.LocationRequest;
936
+ }>): Promise<MessagesResponse>;
937
+ interactiveAddressMessage(params: MessageRequestParams<InteractiveObject & {
938
+ type: InteractiveTypesEnum.AddressMessage;
939
+ }>): Promise<MessagesResponse>;
940
+ interactiveReplyButtons(params: MessageRequestParams<InteractiveObject & {
941
+ type: InteractiveTypesEnum.Button;
942
+ }>): Promise<MessagesResponse>;
943
+ interactiveFlow(params: MessageRequestParams<InteractiveObject & {
944
+ type: InteractiveTypesEnum.Flow;
945
+ }>): Promise<MessagesResponse>;
946
+ interactiveCarousel(params: MessageRequestParams<InteractiveObject & {
947
+ type: InteractiveTypesEnum.Carousel;
948
+ }>): Promise<MessagesResponse>;
949
+ reaction(params: ReactionParams): Promise<MessagesResponse>;
950
+ markAsRead(params: {
951
+ messageId: string;
952
+ }): Promise<MessagesResponse>;
953
+ showTypingIndicator(params: {
954
+ messageId: string;
955
+ }): Promise<MessagesResponse>;
956
+ status(params: StatusParams): Promise<MessagesResponse>;
957
+ }
958
+ //#endregion
959
+ //#region src/api/marketingMessages/types/marketingMessages.d.ts
960
+ /**
961
+ * Marketing Messages API Types
962
+ * @see https://developers.facebook.com/documentation/business-messaging/whatsapp/marketing-messages/send-marketing-messages/
963
+ */
964
+ type MarketingMessageRequest = {
965
+ to: string;
966
+ template: MessageTemplateObject<ComponentTypesEnum>;
967
+ message_activity_sharing?: boolean;
869
968
  };
969
+ interface MarketingMessagesClass {
970
+ sendTemplateMessage(params: MarketingMessageRequest): Promise<MessagesResponse>;
971
+ }
870
972
  //#endregion
871
- //#region src/api/messages/types/media.d.ts
872
- type MetaMediaObject = {
973
+ //#region src/api/media/types/common.d.ts
974
+ type MediaResponse = {
873
975
  id: string;
874
- link?: never;
875
- };
876
- type HostedMediaObject = {
877
- id?: never;
878
- link: string;
879
- };
880
- type AudioMediaObject = MetaMediaObject | HostedMediaObject;
881
- type MetaDocumentMediaObject = MetaMediaObject & {
882
- caption?: string;
883
- filename?: string;
884
- };
885
- type HostedDocumentMediaObject = HostedMediaObject & {
886
- caption?: string;
887
- filename?: string;
888
- };
889
- type DocumentMediaObject = MetaDocumentMediaObject | HostedDocumentMediaObject;
890
- type MetaImageMediaObject = MetaMediaObject & {
891
- caption?: string;
892
- };
893
- type HostedImageMediaObject = HostedMediaObject & {
894
- caption?: string;
976
+ url: string;
977
+ mime_type: string;
978
+ sha256: string;
979
+ file_size: number;
980
+ messaging_product: 'whatsapp';
895
981
  };
896
- type ImageMediaObject = MetaImageMediaObject | HostedImageMediaObject;
897
- type MetaVideoMediaObject = MetaMediaObject & {
898
- caption?: string;
982
+ type MediasResponse = {
983
+ data: MediaResponse[];
984
+ paging: {
985
+ cursors: {
986
+ before: string;
987
+ after: string;
988
+ };
989
+ };
899
990
  };
900
- type HostedVideoMediaObject = HostedMediaObject & {
901
- caption?: string;
991
+ type UploadMediaResponse = {
992
+ id: string;
902
993
  };
903
- type VideoMediaObject = MetaVideoMediaObject | HostedVideoMediaObject;
904
- type StickerMediaObject = MetaMediaObject | HostedMediaObject;
994
+ interface MediaClass {
995
+ getMediaById(mediaId: string): Promise<MediaResponse>;
996
+ uploadMedia(file: File, messagingProduct?: string): Promise<UploadMediaResponse>;
997
+ deleteMedia(mediaId: string): Promise<ResponseSuccess>;
998
+ downloadMedia(mediaUrl: string): Promise<Blob>;
999
+ }
905
1000
  //#endregion
906
- //#region src/api/messages/types/contact.d.ts
907
- type AddressesObject = {
908
- street?: string;
909
- city?: string;
910
- state?: string;
911
- zip?: string;
912
- country?: string;
913
- country_code?: string;
914
- type?: 'HOME' | 'WORK' | string;
915
- };
916
- type EmailObject = {
917
- email?: string;
918
- type?: 'HOME' | 'WORK' | string;
1001
+ //#region src/api/payments/types/payments.d.ts
1002
+ /**
1003
+ * Payments API Types (India Payment Configuration)
1004
+ * @see https://developers.facebook.com/documentation/business-messaging/whatsapp/payments/payments-in/onboarding-apis/
1005
+ */
1006
+ type PaymentConfigurationProvider = 'upi_vpa' | 'razorpay' | 'payu' | 'zaakpay';
1007
+ type PaymentConfigurationStatus = 'Active' | 'Needs_Connecting' | 'Needs_Testing';
1008
+ type PaymentConfigurationCode = {
1009
+ code: string;
1010
+ description?: string;
919
1011
  };
920
- type NameObject = {
921
- formatted_name: string;
922
- first_name?: string;
923
- last_name?: string;
924
- middle_name?: string;
925
- suffix?: string;
926
- prefix?: string;
1012
+ type PaymentConfiguration = {
1013
+ configuration_name: string;
1014
+ provider_name: string;
1015
+ provider_mid?: string;
1016
+ status?: PaymentConfigurationStatus;
1017
+ merchant_category_code?: PaymentConfigurationCode;
1018
+ purpose_code?: PaymentConfigurationCode;
1019
+ created_timestamp?: number;
1020
+ updated_timestamp?: number;
1021
+ };
1022
+ type PaymentConfigurationsResponse = {
1023
+ data: Array<{
1024
+ payment_configurations: PaymentConfiguration[];
1025
+ }>;
927
1026
  };
928
- type OrgObject = {
929
- company?: string;
930
- department?: string;
931
- title?: string;
1027
+ type PaymentConfigurationCreateRequest = {
1028
+ configuration_name: string;
1029
+ provider_name: PaymentConfigurationProvider;
1030
+ purpose_code?: string;
1031
+ merchant_category_code?: string;
1032
+ redirect_url?: string;
1033
+ merchant_vpa?: string;
1034
+ };
1035
+ type PaymentConfigurationUpdateRequest = {
1036
+ provider_name?: PaymentConfigurationProvider;
1037
+ purpose_code?: string;
1038
+ merchant_category_code?: string;
1039
+ redirect_url?: string;
1040
+ merchant_vpa?: string;
1041
+ };
1042
+ type PaymentConfigurationCreateResponse = {
1043
+ success: boolean;
1044
+ oauth_url?: string;
1045
+ expiration?: number;
932
1046
  };
933
- type PhoneObject = {
934
- phone?: 'PHONE_NUMBER';
935
- type?: 'CELL' | 'MAIN' | 'IPHONE' | 'HOME' | 'WORK' | string;
936
- wa_id?: string;
1047
+ type PaymentConfigurationUpdateResponse = PaymentConfigurationCreateResponse;
1048
+ type PaymentConfigurationOauthLinkRequest = {
1049
+ configuration_name: string;
1050
+ redirect_url?: string;
937
1051
  };
938
- type URLObject = {
939
- url?: string;
940
- type?: 'HOME' | 'WORK' | string;
1052
+ type PaymentConfigurationOauthLinkResponse = {
1053
+ oauth_url: string;
1054
+ expiration?: number;
941
1055
  };
942
- type ContactObject = {
943
- addresses?: AddressesObject[];
944
- birthday?: `${number}${number}${number}${number}-${number}${number}-${number}${number}`;
945
- emails?: EmailObject[];
946
- name: NameObject;
947
- org?: OrgObject;
948
- phones?: PhoneObject[];
949
- urls?: URLObject[];
1056
+ type PaymentConfigurationDeleteRequest = {
1057
+ configuration_name: string;
950
1058
  };
1059
+ interface PaymentsClass {
1060
+ listPaymentConfigurations(wabaId: string): Promise<PaymentConfigurationsResponse>;
1061
+ getPaymentConfiguration(wabaId: string, configurationName: string): Promise<PaymentConfigurationsResponse>;
1062
+ createPaymentConfiguration(wabaId: string, params: PaymentConfigurationCreateRequest): Promise<PaymentConfigurationCreateResponse>;
1063
+ updatePaymentConfiguration(wabaId: string, configurationName: string, params: PaymentConfigurationUpdateRequest): Promise<PaymentConfigurationUpdateResponse>;
1064
+ generatePaymentConfigurationOauthLink(wabaId: string, params: PaymentConfigurationOauthLinkRequest): Promise<PaymentConfigurationOauthLinkResponse>;
1065
+ deletePaymentConfiguration(wabaId: string, params: PaymentConfigurationDeleteRequest): Promise<ResponseSuccess>;
1066
+ }
951
1067
  //#endregion
952
- //#region src/api/messages/types/location.d.ts
953
- type LocationObject = {
954
- longitude: number;
955
- latitude: number;
956
- name?: string;
957
- address?: string;
1068
+ //#region src/api/phone/types/common.d.ts
1069
+ type QualityRating = 'GREEN' | 'YELLOW' | 'RED' | 'NA';
1070
+ type AccountMode = 'LIVE' | 'SANDBOX';
1071
+ type CodeVerificationStatus = 'NOT_VERIFIED' | 'VERIFIED' | 'EXPIRED' | 'PENDING' | 'DELETED' | 'MIGRATED' | 'BANNED' | 'RESTRICTED' | 'RATE_LIMITED' | 'FLAGGED' | 'CONNECTED' | 'DISCONNECTED' | 'UNKNOWN' | 'UNVERIFIED';
1072
+ type MessagingLimitTier = 'TIER_50' | 'TIER_250' | 'TIER_1K' | 'TIER_10K' | 'TIER_100K' | 'TIER_UNLIMITED';
1073
+ type PlatformType = 'CLOUD_API' | 'ON_PREMISE' | 'NOT_APPLICABLE';
1074
+ type ThroughputLevel = 'STANDARD' | 'HIGH' | 'NOT_APPLICABLE';
1075
+ type HealthStatusEntity = {
1076
+ entity_type: string;
1077
+ id: string;
1078
+ can_send_message: string;
1079
+ additional_info?: string[];
1080
+ errors?: Array<{
1081
+ error_code: number;
1082
+ error_description: string;
1083
+ possible_solution: string;
1084
+ }>;
1085
+ };
1086
+ type HealthStatus = {
1087
+ can_send_message: string;
1088
+ entities: HealthStatusEntity[];
958
1089
  };
959
- //#endregion
960
- //#region src/api/messages/types/interactive.d.ts
961
- type DocumentMediaObject$1 = {
962
- id?: string;
963
- link?: string;
964
- caption?: string;
965
- filename?: string;
1090
+ type QualityScore = {
1091
+ score: QualityRating;
966
1092
  };
967
- type ImageMediaObject$1 = {
968
- id?: string;
969
- link?: string;
970
- caption?: string;
1093
+ type Throughput = {
1094
+ level: ThroughputLevel;
971
1095
  };
972
- type VideoMediaObject$1 = {
973
- id?: string;
974
- link?: string;
975
- caption?: string;
1096
+ type PhoneNumberField = 'display_phone_number' | 'id' | 'quality_rating' | 'verified_name' | 'account_mode' | 'certificate' | 'code_verification_status' | 'conversational_automation' | 'eligibility_for_api_business_global_search' | 'health_status' | 'is_official_business_account' | 'is_on_biz_app' | 'is_pin_enabled' | 'is_preverified_number' | 'last_onboarded_time' | 'messaging_limit_tier' | 'name_status' | 'new_certificate' | 'new_name_status' | 'platform_type' | 'quality_score' | 'search_visibility' | 'status' | 'throughput';
1097
+ type PhoneNumberFieldsParam = PhoneNumberField[] | string;
1098
+ type PhoneNumberResponse = {
1099
+ display_phone_number: string;
1100
+ id: string;
1101
+ quality_rating: QualityRating;
1102
+ verified_name: string;
1103
+ account_mode?: AccountMode;
1104
+ certificate?: string;
1105
+ code_verification_status?: CodeVerificationStatus;
1106
+ conversational_automation?: Record<string, unknown>;
1107
+ eligibility_for_api_business_global_search?: string;
1108
+ health_status?: HealthStatus;
1109
+ is_official_business_account?: boolean;
1110
+ is_on_biz_app?: boolean;
1111
+ is_pin_enabled?: boolean;
1112
+ is_preverified_number?: boolean;
1113
+ last_onboarded_time?: string;
1114
+ messaging_limit_tier?: MessagingLimitTier;
1115
+ name_status?: string;
1116
+ new_certificate?: string;
1117
+ new_name_status?: string;
1118
+ platform_type?: PlatformType;
1119
+ quality_score?: QualityScore;
1120
+ search_visibility?: string;
1121
+ status?: CodeVerificationStatus;
1122
+ throughput?: Throughput;
976
1123
  };
977
- type ProductObject = {
978
- product_retailer_id: string;
1124
+ type Cursors = {
1125
+ before: string;
1126
+ after: string;
979
1127
  };
980
- type SimpleTextObject = {
981
- text: string;
1128
+ type PhoneNumbersResponse = {
1129
+ data: PhoneNumberResponse[];
1130
+ paging: Paging;
982
1131
  };
983
- type RowObject = {
984
- id: string;
985
- title: string;
986
- description?: string;
1132
+ type RequestVerificationCodeRequest = {
1133
+ code_method: 'SMS' | 'VOICE';
1134
+ language: string;
987
1135
  };
988
- type MultiProductSectionObject = {
989
- product_items: ProductObject[];
990
- rows?: never;
991
- title?: string;
1136
+ type VerifyCodeRequest = {
1137
+ code: string;
992
1138
  };
993
- type ListSectionObject = {
994
- product_items?: never;
995
- rows: RowObject[];
996
- title?: string;
1139
+ type TwoStepVerificationParams = {
1140
+ pin: string;
997
1141
  };
998
- type SectionObject = MultiProductSectionObject | ListSectionObject;
999
- type ButtonObject = {
1000
- title: string;
1001
- id: string;
1142
+ /**
1143
+ * Conversational Components - Commands
1144
+ */
1145
+ type ConversationalCommand = {
1146
+ command_name: string;
1147
+ command_description: string;
1002
1148
  };
1003
- type ReplyButtonObject = {
1004
- type: 'reply';
1005
- reply: ButtonObject;
1149
+ /**
1150
+ * Conversational Components - Ice Breakers (Prompts)
1151
+ */
1152
+ type ConversationalPrompt = string;
1153
+ /**
1154
+ * Request payload for configuring conversational automation
1155
+ */
1156
+ type ConversationalAutomationRequest = {
1157
+ enable_welcome_message?: boolean;
1158
+ commands?: ConversationalCommand[];
1159
+ prompts?: ConversationalPrompt[];
1006
1160
  };
1007
- type ActionObject = {
1008
- buttons?: ReplyButtonObject[];
1009
- catalog_id?: string;
1010
- product_retailer_id?: string;
1011
- sections?: SectionObject[];
1161
+ /**
1162
+ * Response from conversational automation GET endpoint
1163
+ */
1164
+ type ConversationalAutomationResponse = {
1165
+ enable_welcome_message?: boolean;
1166
+ commands?: ConversationalCommand[];
1167
+ prompts?: ConversationalPrompt[];
1168
+ id: string;
1012
1169
  };
1013
- type HeaderObject = {
1014
- type: 'document' | 'image' | 'text' | 'video';
1015
- document?: DocumentMediaObject$1;
1016
- image?: ImageMediaObject$1;
1017
- text?: string;
1018
- video?: VideoMediaObject$1;
1170
+ /**
1171
+ * Response from throughput GET endpoint
1172
+ */
1173
+ type ThroughputResponse = {
1174
+ throughput: Throughput;
1175
+ id: string;
1176
+ };
1177
+ interface PhoneNumberClass {
1178
+ getPhoneNumberById(fields?: PhoneNumberFieldsParam): Promise<PhoneNumberResponse>;
1179
+ getPhoneNumbers(): Promise<PhoneNumbersResponse>;
1180
+ requestVerificationCode(params: RequestVerificationCodeRequest): Promise<ResponseSuccess>;
1181
+ verifyCode(params: VerifyCodeRequest): Promise<ResponseSuccess>;
1182
+ setConversationalAutomation(params: ConversationalAutomationRequest): Promise<ResponseSuccess>;
1183
+ getConversationalAutomation(): Promise<ConversationalAutomationResponse>;
1184
+ getThroughput(): Promise<ThroughputResponse>;
1185
+ }
1186
+ //#endregion
1187
+ //#region src/api/profile/types/upload.d.ts
1188
+ /**
1189
+ * Response from creating an upload session.
1190
+ */
1191
+ interface UploadSessionResponse {
1192
+ id: string;
1193
+ }
1194
+ /**
1195
+ * Response from uploading business profile media.
1196
+ */
1197
+ interface UploadBusinessProfileResponse {
1198
+ h: string;
1199
+ }
1200
+ /**
1201
+ * Upload handle information containing file details and handle.
1202
+ */
1203
+ interface UploadHandle {
1204
+ handle: string;
1205
+ file_size: number;
1206
+ upload_result: {
1207
+ handle_type: string;
1208
+ name: string;
1209
+ };
1210
+ }
1211
+ //#endregion
1212
+ //#region src/api/profile/types/common.d.ts
1213
+ /**
1214
+ * Available fields that can be requested when retrieving a business profile.
1215
+ */
1216
+ type BusinessProfileField = 'about' | 'address' | 'description' | 'email' | 'messaging_product' | 'profile_picture_url' | 'websites' | 'vertical';
1217
+ type BusinessProfileFieldsParam = BusinessProfileField[] | string;
1218
+ /**
1219
+ * Business profile data structure containing all profile information.
1220
+ */
1221
+ interface BusinessProfileData {
1222
+ /**
1223
+ * The business's About text. This text appears in the business's profile, beneath its profile image,
1224
+ * phone number, and contact buttons.
1225
+ * - String cannot be empty
1226
+ * - Strings must be between 1 and 139 characters
1227
+ * - Rendered emojis are supported however their unicode values are not.
1228
+ * Emoji unicode values must be Java- or JavaScript-escape encoded
1229
+ * - Hyperlinks can be included but will not render as clickable links
1230
+ * - Markdown is not supported
1231
+ */
1232
+ about?: string;
1233
+ /**
1234
+ * Address of the business. Character limit 256.
1235
+ */
1236
+ address?: string;
1237
+ /**
1238
+ * Description of the business. Character limit 512.
1239
+ */
1240
+ description?: string;
1241
+ /**
1242
+ * The contact email address (in valid email format) of the business. Character limit 128.
1243
+ */
1244
+ email?: string;
1245
+ /**
1246
+ * The messaging service used for the request. Always set it to "whatsapp" if you are using
1247
+ * the WhatsApp Business API.
1248
+ */
1249
+ messaging_product: string;
1250
+ /**
1251
+ * Profile picture URL.
1252
+ */
1253
+ profile_picture_url?: string;
1254
+ /**
1255
+ * The URLs associated with the business. For instance, a website, Facebook Page, or Instagram.
1256
+ * - You must include the http:// or https:// portion of the URL
1257
+ * - There is a maximum of 2 websites with a maximum of 256 characters each
1258
+ */
1259
+ websites?: string[];
1260
+ /**
1261
+ * Business category. This can be either an empty string or one of the predefined business categories.
1262
+ * @see BusinessVerticalEnum for all available options
1263
+ */
1264
+ vertical?: BusinessVerticalEnum | string;
1265
+ }
1266
+ /**
1267
+ * Response structure for business profile GET requests.
1268
+ */
1269
+ interface BusinessProfileResponse {
1270
+ data: BusinessProfileData[];
1271
+ }
1272
+ /**
1273
+ * Request structure for updating business profile.
1274
+ */
1275
+ interface UpdateBusinessProfileRequest {
1276
+ /**
1277
+ * The messaging service used for the request. Always set it to "whatsapp" if you are using
1278
+ * the WhatsApp Business API.
1279
+ * @required
1280
+ */
1281
+ messaging_product: string;
1282
+ /**
1283
+ * The business's About text. This text appears in the business's profile, beneath its profile image,
1284
+ * phone number, and contact buttons.
1285
+ * - String cannot be empty
1286
+ * - Strings must be between 1 and 139 characters
1287
+ * - Rendered emojis are supported however their unicode values are not.
1288
+ * Emoji unicode values must be Java- or JavaScript-escape encoded
1289
+ * - Hyperlinks can be included but will not render as clickable links
1290
+ * - Markdown is not supported
1291
+ */
1292
+ about?: string;
1293
+ /**
1294
+ * Address of the business. Character limit 256.
1295
+ */
1296
+ address?: string;
1297
+ /**
1298
+ * Description of the business. Character limit 512.
1299
+ */
1300
+ description?: string;
1301
+ /**
1302
+ * Business category. This can be either an empty string or one of the predefined business categories.
1303
+ * @see BusinessVerticalEnum for all available options
1304
+ */
1305
+ vertical?: BusinessVerticalEnum | string;
1306
+ /**
1307
+ * The contact email address (in valid email format) of the business. Character limit 128.
1308
+ */
1309
+ email?: string;
1310
+ /**
1311
+ * The URLs associated with the business. For instance, a website, Facebook Page, or Instagram.
1312
+ * - You must include the http:// or https:// portion of the URL
1313
+ * - There is a maximum of 2 websites with a maximum of 256 characters each
1314
+ */
1315
+ websites?: string[];
1316
+ /**
1317
+ * Handle of the profile picture. This handle is generated when you upload the binary file
1318
+ * for the profile picture to Meta using the Resumable Upload API.
1319
+ */
1320
+ profile_picture_handle?: string;
1321
+ }
1322
+ declare class BusinessProfileClass extends BaseClass {
1323
+ /**
1324
+ * Get your business profile.
1325
+ * @param fields Specific fields to be returned in the response. If not specified, all fields will be returned.
1326
+ */
1327
+ getBusinessProfile(fields?: BusinessProfileFieldsParam): Promise<BusinessProfileResponse>;
1328
+ /**
1329
+ * Update your business profile.
1330
+ * @param updateRequest The request object containing the fields to update.
1331
+ */
1332
+ updateBusinessProfile(updateRequest: UpdateBusinessProfileRequest): Promise<ResponseSuccess>;
1333
+ /**
1334
+ * Create an upload session for profile picture.
1335
+ * @param fileLength Length of the file to be uploaded in bytes.
1336
+ * @param fileType MIME type of the file (e.g., 'image/jpeg').
1337
+ * @param fileName Name of the file.
1338
+ */
1339
+ createUploadSession(fileLength: number, fileType: string, fileName: string): Promise<UploadSessionResponse>;
1340
+ /**
1341
+ * Upload media file to the upload session.
1342
+ * @param uploadId The ID of the upload session.
1343
+ * @param file The binary data of the file.
1344
+ */
1345
+ uploadMedia(uploadId: string, file: Buffer): Promise<UploadBusinessProfileResponse>;
1346
+ /**
1347
+ * Get the upload handle information.
1348
+ * @param uploadId The ID of the upload session.
1349
+ */
1350
+ getUploadHandle(uploadId: string): Promise<UploadHandle>;
1351
+ }
1352
+ //#endregion
1353
+ //#region src/api/qrCode/types/common.d.ts
1354
+ type QrCodeResponse = {
1355
+ code: string;
1356
+ prefilled_message: string;
1357
+ deep_link_url: string;
1358
+ qr_image_url?: string;
1019
1359
  };
1020
- type ButtonInteractiveObject = {
1021
- type: InteractiveTypesEnum.Button;
1022
- body: SimpleTextObject;
1023
- footer?: SimpleTextObject;
1024
- header?: HeaderObject;
1025
- action: ActionObject;
1360
+ type QrCodesResponse = ResponseData<QrCodeResponse[]>;
1361
+ type CreateQrCodeRequest = {
1362
+ prefilled_message: string;
1363
+ generate_qr_image?: 'SVG' | 'PNG';
1026
1364
  };
1027
- type ListInteractiveObject = {
1028
- type: InteractiveTypesEnum.List;
1029
- body: SimpleTextObject;
1030
- footer?: SimpleTextObject;
1031
- header?: HeaderObject;
1032
- action: ActionObject;
1365
+ type UpdateQrCodeRequest = {
1366
+ code: string;
1367
+ prefilled_message: string;
1033
1368
  };
1034
- type ProductInteractiveObject = {
1035
- type: InteractiveTypesEnum.Product;
1036
- body?: SimpleTextObject;
1037
- footer?: SimpleTextObject;
1038
- header?: HeaderObject;
1039
- action: ActionObject;
1369
+ interface QrCodeClass {
1370
+ createQrCode(request: CreateQrCodeRequest): Promise<QrCodeResponse>;
1371
+ getQrCodes(): Promise<QrCodesResponse>;
1372
+ getQrCode(qrCodeId: string): Promise<QrCodeResponse>;
1373
+ updateQrCode(request: UpdateQrCodeRequest): Promise<QrCodeResponse>;
1374
+ deleteQrCode(qrCodeId: string): Promise<ResponseSuccess>;
1375
+ }
1376
+ //#endregion
1377
+ //#region src/api/registration/types/common.d.ts
1378
+ type RegistrationRequest = {
1379
+ messaging_product: 'whatsapp';
1380
+ pin: string;
1381
+ data_localization_region?: DataLocalizationRegionEnum;
1040
1382
  };
1041
- type ProductListInteractiveObject = {
1042
- type: InteractiveTypesEnum.ProductList;
1043
- body: SimpleTextObject;
1044
- footer?: SimpleTextObject;
1045
- header: HeaderObject;
1046
- action: ActionObject;
1383
+ interface RegistrationClass {
1384
+ register(pin: string, dataLocalizationRegion?: DataLocalizationRegionEnum): Promise<ResponseSuccess>;
1385
+ deregister(): Promise<ResponseSuccess>;
1386
+ }
1387
+ //#endregion
1388
+ //#region src/api/template/types/common.d.ts
1389
+ type TemplateFormat = 'TEXT' | 'IMAGE' | 'VIDEO' | 'DOCUMENT' | 'LOCATION' | 'PRODUCT';
1390
+ type PhoneNumberButton = {
1391
+ type: 'PHONE_NUMBER';
1392
+ text: string;
1393
+ phone_number: string;
1047
1394
  };
1048
- type CtaUrlParameters = {
1049
- display_text: string;
1395
+ type URLButton = {
1396
+ type: 'URL';
1397
+ text: string;
1050
1398
  url: string;
1399
+ example?: string[];
1051
1400
  };
1052
- type CtaUrlActionObject = {
1053
- name: 'cta_url';
1054
- parameters: CtaUrlParameters;
1401
+ type QuickReplyButton = {
1402
+ type: 'QUICK_REPLY';
1403
+ text: string;
1055
1404
  };
1056
- type CtaUrlInteractiveObject = {
1057
- type: InteractiveTypesEnum.CtaUrl;
1058
- body?: SimpleTextObject;
1059
- footer?: SimpleTextObject;
1060
- header?: HeaderObject;
1061
- action: CtaUrlActionObject;
1405
+ type CopyCodeButton = {
1406
+ type: 'COPY_CODE';
1407
+ example: string;
1062
1408
  };
1063
- type LocationRequestActionObject = {
1064
- name: 'send_location';
1409
+ type FlowButton = {
1410
+ type: 'FLOW';
1411
+ text: string;
1412
+ flow_id?: string;
1413
+ flow_name?: string;
1414
+ flow_json?: string;
1415
+ flow_action?: 'navigate' | 'data_exchange';
1416
+ navigate_screen?: string;
1065
1417
  };
1066
- type LocationRequestInteractiveObject = {
1067
- type: InteractiveTypesEnum.LocationRequest;
1068
- body: SimpleTextObject;
1069
- footer?: SimpleTextObject;
1070
- header?: HeaderObject;
1071
- action: LocationRequestActionObject;
1418
+ type MPMButton = {
1419
+ type: 'MPM';
1420
+ action?: {
1421
+ thumbnail_product_retailer_id: string;
1422
+ sections: Array<{
1423
+ title?: string;
1424
+ product_items: Array<{
1425
+ product_retailer_id: string;
1426
+ }>;
1427
+ }>;
1428
+ };
1072
1429
  };
1073
- type AddressValues = {
1074
- name?: string;
1075
- phone_number?: string;
1076
- in_pin_code?: string;
1077
- house_number?: string;
1078
- floor_number?: string;
1079
- tower_number?: string;
1080
- building_name?: string;
1081
- address?: string;
1082
- landmark_area?: string;
1083
- city?: string;
1084
- state?: string;
1430
+ type OTPButton = {
1431
+ type: 'OTP';
1085
1432
  };
1086
- type SavedAddress = {
1087
- id: string;
1088
- value: AddressValues;
1433
+ type SPMButton = {
1434
+ type: 'SPM';
1435
+ action?: {
1436
+ product_retailer_id: string;
1437
+ };
1089
1438
  };
1090
- type ValidationErrors = { [key in keyof AddressValues]?: string };
1091
- type AddressMessageParameters = {
1092
- country: string;
1093
- values?: AddressValues;
1094
- saved_addresses?: SavedAddress[];
1095
- validation_errors?: ValidationErrors;
1439
+ type CatalogButton = {
1440
+ type: 'CATALOG';
1441
+ action?: {
1442
+ thumbnail_product_retailer_id: string;
1443
+ };
1096
1444
  };
1097
- type AddressMessageActionObject = {
1098
- name: 'address_message';
1099
- parameters: AddressMessageParameters;
1445
+ type TemplateButton = PhoneNumberButton | URLButton | QuickReplyButton | CopyCodeButton | FlowButton | MPMButton | OTPButton | SPMButton | CatalogButton;
1446
+ type TemplateHeaderExample = {
1447
+ header_text?: string[];
1448
+ header_text_named_params?: Array<{
1449
+ param_name: string;
1450
+ example: string;
1451
+ }>;
1452
+ header_handle?: string[];
1100
1453
  };
1101
- type AddressMessageInteractiveObject = {
1102
- type: InteractiveTypesEnum.AddressMessage;
1103
- body: SimpleTextObject;
1104
- footer?: SimpleTextObject;
1105
- header?: HeaderObject;
1106
- action: AddressMessageActionObject;
1454
+ type TemplateHeader = {
1455
+ type: 'HEADER';
1456
+ format: TemplateFormat;
1457
+ text?: string;
1458
+ example?: TemplateHeaderExample;
1107
1459
  };
1108
- type FlowParameters = {
1109
- flow_message_version: string;
1110
- flow_id?: string;
1111
- flow_name?: string;
1112
- flow_cta: string;
1113
- mode?: 'draft' | 'published';
1114
- flow_token: string;
1115
- flow_action: 'navigate' | 'data_exchange';
1116
- flow_action_payload?: {
1117
- screen?: string;
1118
- data?: Record<string, string>;
1460
+ type TemplateBody = {
1461
+ type: 'BODY';
1462
+ text: string;
1463
+ example?: {
1464
+ body_text?: Array<Array<string>>;
1465
+ body_text_named_params?: Array<{
1466
+ param_name: string;
1467
+ example: string;
1468
+ }>;
1119
1469
  };
1120
1470
  };
1121
- type FlowActionObject = {
1122
- name: 'flow';
1123
- parameters: FlowParameters;
1124
- };
1125
- type FlowInteractiveObject = {
1126
- type: InteractiveTypesEnum.Flow;
1127
- body: SimpleTextObject;
1128
- footer?: SimpleTextObject;
1129
- header?: HeaderObject;
1130
- action: FlowActionObject;
1471
+ type TemplateFooter = {
1472
+ type: 'FOOTER';
1473
+ text: string;
1131
1474
  };
1132
- type InteractiveObject = ButtonInteractiveObject | ListInteractiveObject | ProductInteractiveObject | ProductListInteractiveObject | CtaUrlInteractiveObject | LocationRequestInteractiveObject | AddressMessageInteractiveObject | FlowInteractiveObject;
1133
- //#endregion
1134
- //#region src/api/messages/types/reaction.d.ts
1135
- interface ReactionParams {
1136
- messageId: string;
1137
- emoji: string;
1138
- to: string;
1139
- }
1140
- //#endregion
1141
- //#region src/api/messages/types/common.d.ts
1142
- type GeneralMessageBody = GeneralRequestBody & {
1143
- /**
1144
- * The Meta messaging product name.
1145
- * @default 'whatsapp'
1146
- */
1147
- messaging_product: 'whatsapp';
1475
+ type TemplateButtons = {
1476
+ type: 'BUTTONS';
1477
+ buttons: TemplateButton[];
1148
1478
  };
1149
- type ConTextObject = {
1150
- message_id: string;
1479
+ type TemplateLimitedTimeOffer = {
1480
+ type: 'LIMITED_TIME_OFFER';
1481
+ limited_time_offer: {
1482
+ expiration_time_ms: number;
1483
+ };
1151
1484
  };
1152
- type MessageRequestBody<T extends MessageTypesEnum> = GeneralMessageBody & {
1153
- recipient_type?: string;
1154
- to: string;
1155
- context?: ConTextObject;
1156
- type?: T;
1485
+ type TemplateCarousel = {
1486
+ type: 'CAROUSEL';
1487
+ cards: Array<{
1488
+ card_index: number;
1489
+ components: ComponentTypes[];
1490
+ }>;
1157
1491
  };
1158
- interface MessageRequestParams<T> {
1159
- body: T;
1160
- to: string;
1161
- replyMessageId?: string;
1162
- }
1163
- interface StatusParams {
1164
- status: string;
1165
- messageId: string;
1166
- typingIndicator?: {
1167
- type: string;
1168
- };
1169
- }
1170
- type MessagesResponse = GeneralMessageBody & {
1171
- contacts: [{
1172
- input: string;
1173
- wa_id: string;
1174
- }];
1175
- messages: [{
1176
- id: string;
1177
- }];
1492
+ type MediaCarouselCard = {
1493
+ card_index: number;
1494
+ components: (TemplateHeader | TemplateBody | TemplateButtons)[];
1178
1495
  };
1179
- declare class MessagesClass extends BaseClass {
1180
- text(params: TextMessageParams): Promise<MessagesResponse>;
1181
- template(params: MessageRequestParams<MessageTemplateObject<ComponentTypesEnum>>): Promise<MessagesResponse>;
1182
- audio(params: MessageRequestParams<AudioMediaObject>): Promise<MessagesResponse>;
1183
- document(params: MessageRequestParams<DocumentMediaObject>): Promise<MessagesResponse>;
1184
- image(params: MessageRequestParams<ImageMediaObject>): Promise<MessagesResponse>;
1185
- video(params: MessageRequestParams<VideoMediaObject>): Promise<MessagesResponse>;
1186
- sticker(params: MessageRequestParams<StickerMediaObject>): Promise<MessagesResponse>;
1187
- contacts(params: MessageRequestParams<[ContactObject]>): Promise<MessagesResponse>;
1188
- location(params: MessageRequestParams<LocationObject>): Promise<MessagesResponse>;
1189
- interactive(params: MessageRequestParams<InteractiveObject>): Promise<MessagesResponse>;
1190
- interactiveList(params: MessageRequestParams<InteractiveObject & {
1191
- type: InteractiveTypesEnum.List;
1192
- }>): Promise<MessagesResponse>;
1193
- interactiveCtaUrl(params: MessageRequestParams<InteractiveObject & {
1194
- type: InteractiveTypesEnum.CtaUrl;
1195
- }>): Promise<MessagesResponse>;
1196
- interactiveLocationRequest(params: MessageRequestParams<InteractiveObject & {
1197
- type: InteractiveTypesEnum.LocationRequest;
1198
- }>): Promise<MessagesResponse>;
1199
- interactiveAddressMessage(params: MessageRequestParams<InteractiveObject & {
1200
- type: InteractiveTypesEnum.AddressMessage;
1201
- }>): Promise<MessagesResponse>;
1202
- interactiveReplyButtons(params: MessageRequestParams<InteractiveObject & {
1203
- type: InteractiveTypesEnum.Button;
1204
- }>): Promise<MessagesResponse>;
1205
- interactiveFlow(params: MessageRequestParams<InteractiveObject & {
1206
- type: InteractiveTypesEnum.Flow;
1207
- }>): Promise<MessagesResponse>;
1208
- reaction(params: ReactionParams): Promise<MessagesResponse>;
1209
- markAsRead(params: {
1210
- messageId: string;
1211
- }): Promise<MessagesResponse>;
1212
- showTypingIndicator(params: {
1213
- messageId: string;
1214
- }): Promise<MessagesResponse>;
1215
- status(params: StatusParams): Promise<MessagesResponse>;
1216
- }
1217
- //#endregion
1218
- //#region src/api/media/types/common.d.ts
1219
- type MediaResponse = {
1220
- id: string;
1221
- url: string;
1222
- mime_type: string;
1223
- sha256: string;
1224
- file_size: number;
1225
- messaging_product: 'whatsapp';
1496
+ type ProductCarouselCard = {
1497
+ card_index: number;
1498
+ components: TemplateHeader[];
1226
1499
  };
1227
- type MediasResponse = {
1228
- data: MediaResponse[];
1229
- paging: {
1230
- cursors: {
1231
- before: string;
1232
- after: string;
1233
- };
1234
- };
1500
+ type ComponentTypes = TemplateHeader | TemplateBody | TemplateFooter | TemplateButtons | TemplateLimitedTimeOffer | TemplateCarousel;
1501
+ type TemplateRequestBody = GeneralRequestBody & {
1502
+ name: string;
1503
+ language: LanguagesEnum;
1504
+ category?: CategoryEnum;
1505
+ components?: ComponentTypes[];
1235
1506
  };
1236
- type UploadMediaResponse = {
1507
+ type TemplateResponse = {
1237
1508
  id: string;
1509
+ status: string;
1510
+ language: LanguagesEnum;
1511
+ category: CategoryEnum;
1512
+ name: string;
1513
+ components: ComponentTypes[];
1238
1514
  };
1239
- interface MediaClass {
1240
- getMediaById(mediaId: string, phone_number_id?: string): Promise<MediaResponse>;
1241
- uploadMedia(file: File, messagingProduct?: string): Promise<UploadMediaResponse>;
1242
- deleteMedia(mediaId: string, phone_number_id?: string): Promise<ResponseSuccess>;
1243
- downloadMedia(mediaUrl: string): Promise<Blob>;
1515
+ type TemplateGetParams = {
1516
+ limit?: number;
1517
+ name?: string;
1518
+ language?: LanguagesEnum;
1519
+ category?: CategoryEnum;
1520
+ status?: TemplateStatusEnum;
1521
+ };
1522
+ type TemplateDeleteParams = {
1523
+ hsm_id: string;
1524
+ name: string;
1525
+ };
1526
+ declare class TemplateClass {
1527
+ getTemplate(templateId: string): Promise<TemplateResponse>;
1528
+ updateTemplate(templateId: string, template: Partial<TemplateRequestBody>): Promise<ResponseSuccess>;
1529
+ getTemplates(params?: TemplateGetParams): Promise<ResponsePagination<TemplateResponse>>;
1530
+ createTemplate(template: TemplateRequestBody): Promise<TemplateResponse>;
1531
+ deleteTemplate(params: TemplateDeleteParams): Promise<ResponseSuccess>;
1244
1532
  }
1245
1533
  //#endregion
1246
- //#region src/core/webhook/types/common.d.ts
1247
- /**
1248
- * WhatsApp contact information
1249
- */
1250
- interface WebhookContact {
1251
- wa_id: string;
1252
- profile: {
1253
- name: string;
1254
- };
1255
- identity_key_hash?: string;
1256
- }
1257
- /**
1258
- * Metadata included in all webhooks
1259
- */
1260
- interface WebhookMetadata {
1261
- display_phone_number: string;
1262
- phone_number_id: string;
1263
- }
1264
- /**
1265
- * Error object structure
1266
- */
1267
- interface WebhookError {
1268
- code: number;
1269
- title: string;
1270
- message: string;
1271
- error_data?: {
1272
- details: string;
1273
- };
1274
- href?: string;
1275
- }
1276
- /**
1277
- * Click to WhatsApp ad referral information
1278
- */
1279
- interface ReferralInfo {
1280
- source_url: string;
1281
- source_id: string;
1282
- source_type: 'ad';
1283
- body?: string;
1284
- headline?: string;
1285
- media_type?: 'image' | 'video';
1286
- image_url?: string;
1287
- video_url?: string;
1288
- thumbnail_url?: string;
1289
- ctwa_clid?: string;
1290
- welcome_message?: {
1291
- text: string;
1292
- };
1534
+ //#region src/api/template/types/factory.d.ts
1535
+ interface TextParameter {
1536
+ type: 'text';
1537
+ value: string;
1293
1538
  }
1294
- /**
1295
- * Context for forwarded messages
1296
- */
1297
- interface ForwardedContext {
1298
- forwarded?: true;
1299
- frequently_forwarded?: true;
1539
+ interface CurrencyParameter {
1540
+ type: 'currency';
1541
+ amount_1000: number;
1542
+ code: CurrencyCodesEnum;
1543
+ fallback_value: string;
1300
1544
  }
1301
- /**
1302
- * Context for product inquiry messages
1303
- */
1304
- interface ProductContext {
1305
- from: string;
1306
- id: string;
1307
- referred_product: {
1308
- catalog_id: string;
1309
- product_retailer_id: string;
1310
- };
1545
+ interface DateTimeParameter {
1546
+ type: 'date_time';
1547
+ fallback_value: string;
1311
1548
  }
1312
- /**
1313
- * Context for interactive/button replies
1314
- */
1315
- interface ReplyContext {
1316
- from: string;
1317
- id: string;
1549
+ interface MediaParameter {
1550
+ type: 'image' | 'video' | 'document';
1551
+ handle?: string;
1552
+ link?: string;
1318
1553
  }
1319
- //#endregion
1320
- //#region src/core/webhook/types/message.d.ts
1321
- /**
1322
- * Base message properties common to all message types
1323
- */
1324
- interface BaseMessage {
1325
- from: string;
1326
- id: string;
1327
- timestamp: string;
1554
+ interface LocationParameter {
1555
+ type: 'location';
1556
+ latitude?: number;
1557
+ longitude?: number;
1558
+ name?: string;
1559
+ address?: string;
1328
1560
  }
1329
- interface TextMessage extends BaseMessage {
1330
- type: MessageTypesEnum.Text;
1331
- text: {
1332
- body: string;
1333
- };
1334
- context?: ForwardedContext | ProductContext;
1335
- referral?: ReferralInfo;
1561
+ interface ProductParameter {
1562
+ type: 'product';
1563
+ product_retailer_id: string;
1336
1564
  }
1337
- interface ImageMessage extends BaseMessage {
1338
- type: MessageTypesEnum.Image;
1339
- image: {
1340
- caption?: string;
1341
- mime_type: string;
1342
- sha256: string;
1343
- id: string;
1344
- url: string;
1565
+ type TemplateParameter = TextParameter | CurrencyParameter | DateTimeParameter | MediaParameter | LocationParameter | ProductParameter;
1566
+ interface HeaderOptions {
1567
+ format: TemplateFormat;
1568
+ text?: string;
1569
+ parameters?: TemplateParameter[];
1570
+ example?: {
1571
+ header_text?: string[];
1572
+ header_text_named_params?: Array<{
1573
+ param_name: string;
1574
+ example: string;
1575
+ }>;
1576
+ header_handle?: string[];
1345
1577
  };
1346
- context?: ForwardedContext;
1347
- referral?: ReferralInfo;
1348
1578
  }
1349
- interface VideoMessage extends BaseMessage {
1350
- type: MessageTypesEnum.Video;
1351
- video: {
1352
- caption?: string;
1353
- mime_type: string;
1354
- sha256: string;
1355
- id: string;
1356
- url: string;
1579
+ interface BodyOptions {
1580
+ text: string;
1581
+ parameters?: TemplateParameter[];
1582
+ example?: {
1583
+ body_text?: string[][];
1584
+ body_text_named_params?: Array<{
1585
+ param_name: string;
1586
+ example: string;
1587
+ }>;
1357
1588
  };
1358
- context?: ForwardedContext;
1359
- referral?: ReferralInfo;
1360
1589
  }
1361
- interface AudioMessage extends BaseMessage {
1362
- type: MessageTypesEnum.Audio;
1363
- audio: {
1364
- mime_type: string;
1365
- sha256: string;
1366
- id: string;
1367
- url: string;
1368
- voice: boolean;
1369
- };
1370
- referral?: ReferralInfo;
1590
+ interface FooterOptions {
1591
+ text: string;
1371
1592
  }
1372
- interface DocumentMessage extends BaseMessage {
1373
- type: MessageTypesEnum.Document;
1374
- document: {
1375
- caption?: string;
1376
- filename: string;
1377
- mime_type: string;
1378
- sha256: string;
1379
- id: string;
1380
- url: string;
1593
+ interface ButtonOptions {
1594
+ phone_number?: {
1595
+ text: string;
1596
+ phone_number: string;
1381
1597
  };
1382
- referral?: ReferralInfo;
1383
- }
1384
- interface StickerMessage extends BaseMessage {
1385
- type: MessageTypesEnum.Sticker;
1386
- sticker: {
1387
- mime_type: string;
1388
- sha256: string;
1389
- id: string;
1598
+ url?: {
1599
+ text: string;
1390
1600
  url: string;
1391
- animated: boolean;
1601
+ example?: string;
1392
1602
  };
1393
- referral?: ReferralInfo;
1394
- }
1395
- interface InteractiveListReplyMessage extends BaseMessage {
1396
- type: MessageTypesEnum.Interactive;
1397
- context: ReplyContext;
1398
- interactive: {
1399
- type: 'list_reply';
1400
- list_reply: {
1401
- id: string;
1402
- title: string;
1403
- description?: string;
1404
- };
1603
+ quick_reply?: {
1604
+ text: string;
1605
+ }[];
1606
+ copy_code?: {
1607
+ example: string;
1405
1608
  };
1406
- }
1407
- interface InteractiveButtonReplyMessage extends BaseMessage {
1408
- type: MessageTypesEnum.Interactive;
1409
- context: ReplyContext;
1410
- interactive: {
1411
- type: 'button_reply';
1412
- button_reply: {
1413
- id: string;
1414
- title: string;
1415
- };
1609
+ flow?: {
1610
+ text: string;
1611
+ flow_id?: string;
1612
+ flow_name?: string;
1613
+ flow_json?: string;
1614
+ flow_action?: 'navigate' | 'data_exchange';
1615
+ navigate_screen?: string;
1416
1616
  };
1617
+ mpm?: boolean;
1618
+ otp?: boolean;
1619
+ spm?: boolean;
1417
1620
  }
1418
- interface InteractiveNfmReplyMessage extends BaseMessage {
1419
- type: MessageTypesEnum.Interactive;
1420
- context: ReplyContext;
1421
- interactive: {
1422
- type: 'nfm_reply';
1423
- nfm_reply: {
1424
- name: string;
1425
- body: string;
1426
- response_json: string;
1427
- };
1428
- };
1621
+ interface CarouselCard {
1622
+ image?: string;
1623
+ video?: string;
1624
+ product?: string;
1625
+ body?: string;
1626
+ bodyParameters?: TemplateParameter[];
1627
+ buttons?: ButtonOptions;
1429
1628
  }
1430
- type InteractiveMessage = InteractiveListReplyMessage | InteractiveButtonReplyMessage | InteractiveNfmReplyMessage;
1431
- interface ButtonMessage extends BaseMessage {
1432
- type: MessageTypesEnum.Button;
1433
- context: ReplyContext;
1434
- button: {
1435
- payload: string;
1436
- text: string;
1437
- };
1629
+ interface CarouselOptions {
1630
+ cards: CarouselCard[];
1438
1631
  }
1439
- interface LocationMessage extends BaseMessage {
1440
- type: MessageTypesEnum.Location;
1441
- location: {
1442
- latitude: number;
1443
- longitude: number;
1444
- name?: string;
1445
- address?: string;
1446
- url?: string;
1447
- };
1448
- referral?: ReferralInfo;
1632
+ interface LimitedTimeOfferOptions {
1633
+ expiration_time_ms: number;
1449
1634
  }
1450
- interface ContactsMessage extends BaseMessage {
1451
- type: MessageTypesEnum.Contacts;
1452
- contacts: Array<{
1453
- addresses?: Array<{
1454
- city?: string;
1455
- country?: string;
1456
- country_code?: string;
1457
- state?: string;
1458
- street?: string;
1459
- type?: string;
1460
- zip?: string;
1461
- }>;
1462
- birthday?: string;
1463
- emails?: Array<{
1464
- email: string;
1465
- type?: string;
1466
- }>;
1467
- name: {
1468
- formatted_name: string;
1469
- first_name?: string;
1470
- last_name?: string;
1471
- middle_name?: string;
1472
- suffix?: string;
1473
- prefix?: string;
1474
- };
1475
- org?: {
1476
- company?: string;
1477
- department?: string;
1478
- title?: string;
1635
+ interface ProductSection {
1636
+ title?: string;
1637
+ product_items: Array<{
1638
+ product_retailer_id: string;
1639
+ }>;
1640
+ }
1641
+ interface TemplateOptions {
1642
+ name: string;
1643
+ language: LanguagesEnum;
1644
+ category: CategoryEnum;
1645
+ header?: HeaderOptions;
1646
+ body?: BodyOptions;
1647
+ footer?: FooterOptions;
1648
+ buttons?: ButtonOptions;
1649
+ carousel?: CarouselOptions;
1650
+ limitedTimeOffer?: LimitedTimeOfferOptions;
1651
+ }
1652
+ interface OTPTemplateOptions {
1653
+ name: string;
1654
+ language: LanguagesEnum;
1655
+ code_expiration_minutes?: number;
1656
+ add_security_recommendation?: boolean;
1657
+ }
1658
+ interface AuthenticationTemplateOptions {
1659
+ name: string;
1660
+ language: LanguagesEnum;
1661
+ code_expiration_minutes?: number;
1662
+ add_security_recommendation?: boolean;
1663
+ copy_code_button?: boolean;
1664
+ }
1665
+ interface CatalogTemplateOptions {
1666
+ name: string;
1667
+ language: LanguagesEnum;
1668
+ header?: Omit<HeaderOptions, 'format'>;
1669
+ body: BodyOptions;
1670
+ footer?: FooterOptions;
1671
+ thumbnail_product_retailer_id: string;
1672
+ }
1673
+ interface CouponTemplateOptions {
1674
+ name: string;
1675
+ language: LanguagesEnum;
1676
+ header?: Omit<HeaderOptions, 'format'>;
1677
+ body: BodyOptions;
1678
+ footer?: FooterOptions;
1679
+ coupon_code: string;
1680
+ }
1681
+ interface LimitedTimeOfferTemplateOptions {
1682
+ name: string;
1683
+ language: LanguagesEnum;
1684
+ header?: Omit<HeaderOptions, 'format'>;
1685
+ body: BodyOptions;
1686
+ footer?: FooterOptions;
1687
+ expiration_time_ms: number;
1688
+ }
1689
+ interface MediaCardCarouselTemplateOptions {
1690
+ name: string;
1691
+ language: LanguagesEnum;
1692
+ cards: Array<{
1693
+ header: {
1694
+ format: 'IMAGE' | 'VIDEO';
1695
+ example: {
1696
+ header_handle: string[];
1697
+ };
1479
1698
  };
1480
- phones?: Array<{
1481
- phone: string;
1482
- wa_id?: string;
1483
- type?: string;
1484
- }>;
1485
- urls?: Array<{
1486
- url: string;
1487
- type?: string;
1488
- }>;
1699
+ body: BodyOptions;
1700
+ buttons?: ButtonOptions;
1489
1701
  }>;
1490
- referral?: ReferralInfo;
1491
1702
  }
1492
- interface ReactionMessage extends BaseMessage {
1493
- type: MessageTypesEnum.Reaction;
1494
- reaction: {
1495
- message_id: string;
1496
- emoji?: string;
1497
- };
1703
+ interface MPMTemplateOptions {
1704
+ name: string;
1705
+ language: LanguagesEnum;
1706
+ header?: Omit<HeaderOptions, 'format'>;
1707
+ body: BodyOptions;
1708
+ footer?: FooterOptions;
1709
+ thumbnail_product_retailer_id: string;
1710
+ sections: ProductSection[];
1498
1711
  }
1499
- interface OrderMessage extends BaseMessage {
1500
- type: MessageTypesEnum.Order;
1501
- order: {
1502
- catalog_id: string;
1503
- text?: string;
1504
- product_items: Array<{
1505
- product_retailer_id: string;
1506
- quantity: number;
1507
- item_price: number;
1508
- currency: string;
1509
- }>;
1510
- };
1712
+ interface ProductCardCarouselTemplateOptions {
1713
+ name: string;
1714
+ language: LanguagesEnum;
1715
+ header?: Omit<HeaderOptions, 'format'>;
1716
+ body: BodyOptions;
1717
+ footer?: FooterOptions;
1718
+ cards: Array<{
1719
+ product_retailer_id: string;
1720
+ }>;
1511
1721
  }
1512
- interface SystemMessage extends BaseMessage {
1513
- type: MessageTypesEnum.System;
1514
- system: {
1515
- body: string;
1516
- wa_id: string;
1517
- type: 'user_changed_number';
1518
- };
1722
+ interface SPMTemplateOptions {
1723
+ name: string;
1724
+ language: LanguagesEnum;
1725
+ header?: Omit<HeaderOptions, 'format'>;
1726
+ body: BodyOptions;
1727
+ footer?: FooterOptions;
1728
+ product_retailer_id: string;
1519
1729
  }
1520
- interface UnsupportedMessage extends BaseMessage {
1521
- type: MessageTypesEnum.Unsupported;
1522
- errors: Array<WebhookError>;
1730
+ //#endregion
1731
+ //#region src/api/twoStepVerification/types/common.d.ts
1732
+ type TwoStepVerificationRequest = {
1733
+ pin: string;
1734
+ };
1735
+ interface TwoStepVerificationClass {
1736
+ setTwoStepVerificationCode(pin: string): Promise<ResponseSuccess>;
1523
1737
  }
1524
- type GroupMessage = {
1525
- group_id: string;
1526
- } & (TextMessage | ImageMessage | VideoMessage | AudioMessage | DocumentMessage | LocationMessage | ContactsMessage);
1527
- type WhatsAppMessage = TextMessage | ImageMessage | VideoMessage | AudioMessage | DocumentMessage | StickerMessage | InteractiveMessage | ButtonMessage | LocationMessage | ContactsMessage | ReactionMessage | OrderMessage | SystemMessage | UnsupportedMessage | GroupMessage;
1528
1738
  //#endregion
1529
- //#region src/core/webhook/types/status.d.ts
1530
- interface StatusWebhook {
1531
- id: string;
1532
- status: 'sent' | 'delivered' | 'read' | 'failed';
1533
- timestamp: string;
1534
- recipient_id: string;
1535
- recipient_type?: 'group';
1536
- recipient_participant_id?: string;
1537
- recipient_identity_key_hash?: string;
1538
- biz_opaque_callback_data?: string;
1539
- conversation?: {
1739
+ //#region src/api/waba/types/common.d.ts
1740
+ /**
1741
+ * WhatsApp Business Account subscription configuration
1742
+ */
1743
+ type WabaSubscription = {
1744
+ whatsapp_business_api_data: {
1540
1745
  id: string;
1541
- expiration_timestamp?: string;
1542
- origin: {
1543
- type: 'authentication' | 'authentication_international' | 'marketing' | 'marketing_lite' | 'referral_conversion' | 'service' | 'utility';
1544
- };
1545
- };
1546
- pricing?: {
1547
- billable: boolean;
1548
- pricing_model: 'CBP' | 'PMP';
1549
- type: 'regular' | 'free_customer_service' | 'free_entry_point';
1550
- category: 'authentication' | 'authentication_international' | 'marketing' | 'marketing_lite' | 'referral_conversion' | 'service' | 'utility';
1746
+ link: string;
1747
+ name: string;
1748
+ category: string;
1551
1749
  };
1552
- errors?: Array<WebhookError>;
1750
+ override_callback_uri?: string;
1751
+ };
1752
+ /**
1753
+ * Parameters for updating WABA subscription
1754
+ */
1755
+ interface UpdateWabaSubscription {
1756
+ override_callback_uri: string;
1757
+ verify_token: string;
1758
+ }
1759
+ /**
1760
+ * Response containing all WABA subscriptions
1761
+ */
1762
+ interface WabaSubscriptions {
1763
+ data: Array<WabaSubscription>;
1764
+ }
1765
+ /**
1766
+ * WABA account review status enumeration
1767
+ */
1768
+ declare enum WabaAccountReviewStatus {
1769
+ Approved = "APPROVED",
1770
+ Active = "ACTIVE",
1771
+ Inactive = "INACTIVE",
1772
+ Disabled = "DISABLED",
1773
+ }
1774
+ /**
1775
+ * WABA health status for message sending capability
1776
+ */
1777
+ declare enum WabaHealthStatusCanSendMessage {
1778
+ Blocked = "BLOCKED",
1779
+ Limited = "LIMITED",
1780
+ Available = "AVAILABLE",
1781
+ }
1782
+ /**
1783
+ * WABA account status enumeration
1784
+ */
1785
+ declare enum WabaAccountStatus {
1786
+ Approved = "APPROVED",
1787
+ Active = "ACTIVE",
1788
+ Inactive = "INACTIVE",
1789
+ Disabled = "DISABLED",
1790
+ }
1791
+ /**
1792
+ * Business verification status enumeration
1793
+ */
1794
+ declare enum WabaBusinessVerificationStatus {
1795
+ Verified = "verified",
1796
+ PendingSubmission = "pending_submission",
1797
+ Unverified = "unverified",
1798
+ Rejected = "rejected",
1799
+ }
1800
+ /**
1801
+ * WABA health status error details
1802
+ */
1803
+ interface WabaHealthStatusError {
1804
+ error_code?: number;
1805
+ error_description?: string;
1806
+ possible_solution?: string;
1807
+ }
1808
+ /**
1809
+ * WABA health status entity information
1810
+ */
1811
+ interface WabaHealthStatusEntity {
1812
+ entity_type?: string;
1813
+ id?: string;
1814
+ can_send_message?: string;
1815
+ errors?: WabaHealthStatusError[];
1816
+ }
1817
+ /**
1818
+ * Overall WABA health status
1819
+ */
1820
+ interface WabaHealthStatus {
1821
+ can_send_message?: WabaHealthStatusCanSendMessage;
1822
+ entities?: WabaHealthStatusEntity[];
1823
+ }
1824
+ /**
1825
+ * WhatsApp Business Account information
1826
+ */
1827
+ interface WabaAccount {
1828
+ account_review_status?: WabaAccountReviewStatus;
1829
+ id?: string;
1830
+ health_status?: WabaHealthStatus;
1831
+ status?: WabaAccountStatus;
1832
+ business_verification_status?: WabaBusinessVerificationStatus;
1833
+ message_template_namespace?: string;
1834
+ name?: string;
1835
+ ownership_type?: string;
1836
+ timezone_id?: string;
1837
+ primary_business_location?: Record<string, unknown> | string;
1838
+ currency?: string;
1839
+ }
1840
+ /**
1841
+ * Available fields for WABA account queries
1842
+ */
1843
+ type WabaAccountFields = 'id' | 'name' | 'timezone_id' | 'account_review_status' | 'auth_international_rate_eligibility' | 'business_verification_status' | 'country' | 'currency' | 'health_status' | 'status' | 'ownership_type' | 'message_template_namespace' | 'primary_business_location';
1844
+ /**
1845
+ * Parameter type for specifying which WABA account fields to retrieve
1846
+ */
1847
+ type WabaAccountFieldsParam = WabaAccountFields[];
1848
+ /**
1849
+ * Interface defining all WABA API methods
1850
+ */
1851
+ interface WABAClass {
1852
+ getWabaAccount(fields?: WabaAccountFieldsParam): Promise<WabaAccount>;
1853
+ getAllWabaSubscriptions(): Promise<WabaSubscriptions>;
1854
+ updateWabaSubscription(params: UpdateWabaSubscription): Promise<ResponseSuccess>;
1855
+ unsubscribeFromWaba(): Promise<ResponseSuccess>;
1553
1856
  }
1554
1857
  //#endregion
1555
1858
  //#region src/core/webhook/types/account.d.ts
@@ -1641,119 +1944,131 @@ interface AccountAlertsWebhookValue {
1641
1944
  value: AccountAlertsValue;
1642
1945
  }
1643
1946
  //#endregion
1644
- //#region src/core/webhook/types/business.d.ts
1947
+ //#region src/core/webhook/types/common.d.ts
1645
1948
  /**
1646
- * Business capability limits
1647
- * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#business-capability-updates
1949
+ * WhatsApp contact information
1648
1950
  */
1649
- interface BusinessCapabilityUpdateValue {
1650
- max_daily_conversation_per_phone?: number;
1651
- max_phone_numbers_per_business?: number;
1652
- max_phone_numbers_per_waba?: number;
1653
- }
1654
- interface BusinessCapabilityUpdateWebhookValue {
1655
- field: 'business_capability_update';
1656
- value: BusinessCapabilityUpdateValue;
1951
+ interface WebhookContact {
1952
+ wa_id: string;
1953
+ profile: {
1954
+ name: string;
1955
+ };
1956
+ identity_key_hash?: string;
1657
1957
  }
1658
- //#endregion
1659
- //#region src/core/webhook/types/phoneNumber.d.ts
1660
1958
  /**
1661
- * Phone number name update decision
1662
- * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#phone-number-updates
1959
+ * Metadata included in all webhooks
1663
1960
  */
1664
- type PhoneNumberDecision = 'APPROVED' | 'REJECTED' | 'DEFERRED';
1665
- interface PhoneNumberNameUpdateValue {
1961
+ interface WebhookMetadata {
1666
1962
  display_phone_number: string;
1667
- decision: PhoneNumberDecision;
1668
- requested_verified_name: string;
1669
- rejection_reason: string | null;
1963
+ phone_number_id: string;
1670
1964
  }
1671
- interface PhoneNumberNameUpdateWebhookValue {
1672
- field: 'phone_number_name_update';
1673
- value: PhoneNumberNameUpdateValue;
1965
+ /**
1966
+ * Error object structure
1967
+ */
1968
+ interface WebhookError {
1969
+ code: number;
1970
+ title: string;
1971
+ message: string;
1972
+ error_data?: {
1973
+ details: string;
1974
+ };
1975
+ href?: string;
1976
+ }
1977
+ /**
1978
+ * Click to WhatsApp ad referral information
1979
+ */
1980
+ interface ReferralInfo {
1981
+ source_url: string;
1982
+ source_id: string;
1983
+ source_type: 'ad';
1984
+ body?: string;
1985
+ headline?: string;
1986
+ media_type?: 'image' | 'video';
1987
+ image_url?: string;
1988
+ video_url?: string;
1989
+ thumbnail_url?: string;
1990
+ ctwa_clid?: string;
1991
+ welcome_message?: {
1992
+ text: string;
1993
+ };
1994
+ }
1995
+ /**
1996
+ * Context for forwarded messages
1997
+ */
1998
+ interface ForwardedContext {
1999
+ forwarded?: true;
2000
+ frequently_forwarded?: true;
1674
2001
  }
1675
2002
  /**
1676
- * Phone number quality events
1677
- * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#value--event
2003
+ * Context for product inquiry messages
1678
2004
  */
1679
- type PhoneNumberQualityEvent = 'FLAGGED' | 'UNFLAGGED' | 'UPGRADE' | 'DOWNGRADE' | 'ONBOARDING';
2005
+ interface ProductContext {
2006
+ from: string;
2007
+ id: string;
2008
+ referred_product: {
2009
+ catalog_id: string;
2010
+ product_retailer_id: string;
2011
+ };
2012
+ }
1680
2013
  /**
1681
- * Messaging tier limits
1682
- * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#value--current_limit
2014
+ * Context for interactive/button replies
1683
2015
  */
1684
- type CurrentLimit = 'TIER_50' | 'TIER_250' | 'TIER_1K' | 'TIER_10K' | 'TIER_100K' | 'TIER_UNLIMITED';
1685
- interface PhoneNumberQualityUpdateValue {
1686
- display_phone_number: string;
1687
- event: PhoneNumberQualityEvent;
1688
- current_limit: CurrentLimit;
1689
- }
1690
- interface PhoneNumberQualityUpdateWebhookValue {
1691
- field: 'phone_number_quality_update';
1692
- value: PhoneNumberQualityUpdateValue;
2016
+ interface ReplyContext {
2017
+ from: string;
2018
+ id: string;
1693
2019
  }
1694
2020
  //#endregion
1695
- //#region src/core/webhook/types/template.d.ts
2021
+ //#region src/core/webhook/types/appStateSync.d.ts
1696
2022
  /**
1697
- * Message template status events
1698
- * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#value--event
2023
+ * Contact data in state sync
1699
2024
  */
1700
- type TemplateStatusEvent = 'APPROVED' | 'REJECTED' | 'PENDING' | 'DISABLED' | 'REINSTATED' | 'IN_APPEAL' | 'FLAGGED' | 'PAUSED' | 'PENDING_DELETION';
2025
+ interface StateSyncContact {
2026
+ full_name: string;
2027
+ first_name: string;
2028
+ phone_number: string;
2029
+ }
1701
2030
  /**
1702
- * Template rejection reasons
1703
- * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#value--reason
2031
+ * State sync metadata
1704
2032
  */
1705
- type TemplateRejectionReason = 'NONE' | 'ABUSIVE_CONTENT' | 'INCORRECT_CATEGORY' | 'INVALID_FORMAT' | 'SCAM';
1706
- interface TemplateDisableInfo {
1707
- disable_date: string;
1708
- }
1709
- interface TemplatePauseInfo {
1710
- title: string;
1711
- description: string;
1712
- }
1713
- interface MessageTemplateStatusUpdateValue {
1714
- event: TemplateStatusEvent;
1715
- message_template_id: number;
1716
- message_template_name: string;
1717
- message_template_language: string;
1718
- reason: TemplateRejectionReason | null;
1719
- disable_info?: TemplateDisableInfo;
1720
- other_info?: TemplatePauseInfo;
2033
+ interface StateSyncMetadata {
2034
+ timestamp: string;
2035
+ version: number;
1721
2036
  }
1722
- interface MessageTemplateStatusUpdateWebhookValue {
1723
- field: 'message_template_status_update';
1724
- value: MessageTemplateStatusUpdateValue;
2037
+ /**
2038
+ * State sync data
2039
+ */
2040
+ interface StateSyncData {
2041
+ type: string;
2042
+ contact: StateSyncContact;
2043
+ action: string;
2044
+ metadata: StateSyncMetadata;
1725
2045
  }
1726
2046
  /**
1727
- * Template categories
1728
- * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#value--event
2047
+ * SMB App State Sync value
1729
2048
  */
1730
- type TemplateCategory = 'MARKETING' | 'OTP' | 'TRANSACTIONAL' | 'AUTHENTICATION' | 'UTILITY';
1731
- interface TemplateCategoryUpdateValue {
1732
- message_template_id: number;
1733
- message_template_name: string;
1734
- message_template_language: string;
1735
- previous_category: TemplateCategory;
1736
- new_category: TemplateCategory;
2049
+ interface SmbAppStateSyncValue {
2050
+ messaging_product: string;
2051
+ metadata: WebhookMetadata;
2052
+ state_sync: StateSyncData[];
1737
2053
  }
1738
- interface TemplateCategoryUpdateWebhookValue {
1739
- field: 'template_category_update';
1740
- value: TemplateCategoryUpdateValue;
2054
+ interface SmbAppStateSyncWebhookValue {
2055
+ field: 'smb_app_state_sync';
2056
+ value: SmbAppStateSyncValue;
1741
2057
  }
2058
+ //#endregion
2059
+ //#region src/core/webhook/types/business.d.ts
1742
2060
  /**
1743
- * Template quality scores
1744
- * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#value--event
2061
+ * Business capability limits
2062
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#business-capability-updates
1745
2063
  */
1746
- type TemplateQualityScore = 'GREEN' | 'YELLOW' | 'RED' | 'UNKNOWN';
1747
- interface MessageTemplateQualityUpdateValue {
1748
- previous_quality_score: TemplateQualityScore;
1749
- new_quality_score: TemplateQualityScore;
1750
- message_template_id: number;
1751
- message_template_name: string;
1752
- message_template_language: string;
2064
+ interface BusinessCapabilityUpdateValue {
2065
+ max_daily_conversation_per_phone?: number;
2066
+ max_phone_numbers_per_business?: number;
2067
+ max_phone_numbers_per_waba?: number;
1753
2068
  }
1754
- interface MessageTemplateQualityUpdateWebhookValue {
1755
- field: 'message_template_quality_update';
1756
- value: MessageTemplateQualityUpdateValue;
2069
+ interface BusinessCapabilityUpdateWebhookValue {
2070
+ field: 'business_capability_update';
2071
+ value: BusinessCapabilityUpdateValue;
1757
2072
  }
1758
2073
  //#endregion
1759
2074
  //#region src/core/webhook/types/flows.d.ts
@@ -1780,44 +2095,238 @@ interface FlowEndpointRequestError {
1780
2095
  error_message: string;
1781
2096
  error_count: number;
1782
2097
  }
1783
- /**
1784
- * Flow webhook value
1785
- */
1786
- interface FlowsValue {
1787
- event: FlowEvent;
1788
- message?: string;
1789
- flow_id: string;
1790
- old_status?: FlowStatus;
1791
- new_status?: FlowStatus;
1792
- warning?: string;
1793
- p90_latency?: number;
1794
- p50_latency?: number;
1795
- error_rate?: number;
1796
- errors?: FlowEndpointRequestError[];
1797
- requests_count?: number;
1798
- availability?: number;
1799
- threshold?: number;
1800
- alert_state?: FlowAlertState;
2098
+ /**
2099
+ * Flow webhook value
2100
+ */
2101
+ interface FlowsValue {
2102
+ event: FlowEvent;
2103
+ message?: string;
2104
+ flow_id: string;
2105
+ old_status?: FlowStatus;
2106
+ new_status?: FlowStatus;
2107
+ warning?: string;
2108
+ p90_latency?: number;
2109
+ p50_latency?: number;
2110
+ error_rate?: number;
2111
+ errors?: FlowEndpointRequestError[];
2112
+ requests_count?: number;
2113
+ availability?: number;
2114
+ threshold?: number;
2115
+ alert_state?: FlowAlertState;
2116
+ }
2117
+ interface FlowsWebhookValue {
2118
+ field: 'flows';
2119
+ value: FlowsValue;
2120
+ }
2121
+ //#endregion
2122
+ //#region src/core/webhook/types/message.d.ts
2123
+ /**
2124
+ * Base message properties common to all message types
2125
+ */
2126
+ interface BaseMessage {
2127
+ from: string;
2128
+ id: string;
2129
+ timestamp: string;
2130
+ }
2131
+ interface TextMessage extends BaseMessage {
2132
+ type: MessageTypesEnum.Text;
2133
+ text: {
2134
+ body: string;
2135
+ };
2136
+ context?: ForwardedContext | ProductContext;
2137
+ referral?: ReferralInfo;
2138
+ }
2139
+ interface ImageMessage extends BaseMessage {
2140
+ type: MessageTypesEnum.Image;
2141
+ image: {
2142
+ caption?: string;
2143
+ mime_type: string;
2144
+ sha256: string;
2145
+ id: string;
2146
+ url: string;
2147
+ };
2148
+ context?: ForwardedContext;
2149
+ referral?: ReferralInfo;
2150
+ }
2151
+ interface VideoMessage extends BaseMessage {
2152
+ type: MessageTypesEnum.Video;
2153
+ video: {
2154
+ caption?: string;
2155
+ mime_type: string;
2156
+ sha256: string;
2157
+ id: string;
2158
+ url: string;
2159
+ };
2160
+ context?: ForwardedContext;
2161
+ referral?: ReferralInfo;
2162
+ }
2163
+ interface AudioMessage extends BaseMessage {
2164
+ type: MessageTypesEnum.Audio;
2165
+ audio: {
2166
+ mime_type: string;
2167
+ sha256: string;
2168
+ id: string;
2169
+ url: string;
2170
+ voice: boolean;
2171
+ };
2172
+ referral?: ReferralInfo;
2173
+ }
2174
+ interface DocumentMessage extends BaseMessage {
2175
+ type: MessageTypesEnum.Document;
2176
+ document: {
2177
+ caption?: string;
2178
+ filename: string;
2179
+ mime_type: string;
2180
+ sha256: string;
2181
+ id: string;
2182
+ url: string;
2183
+ };
2184
+ referral?: ReferralInfo;
2185
+ }
2186
+ interface StickerMessage extends BaseMessage {
2187
+ type: MessageTypesEnum.Sticker;
2188
+ sticker: {
2189
+ mime_type: string;
2190
+ sha256: string;
2191
+ id: string;
2192
+ url: string;
2193
+ animated: boolean;
2194
+ };
2195
+ referral?: ReferralInfo;
2196
+ }
2197
+ interface InteractiveListReplyMessage extends BaseMessage {
2198
+ type: MessageTypesEnum.Interactive;
2199
+ context: ReplyContext;
2200
+ interactive: {
2201
+ type: 'list_reply';
2202
+ list_reply: {
2203
+ id: string;
2204
+ title: string;
2205
+ description?: string;
2206
+ };
2207
+ };
2208
+ }
2209
+ interface InteractiveButtonReplyMessage extends BaseMessage {
2210
+ type: MessageTypesEnum.Interactive;
2211
+ context: ReplyContext;
2212
+ interactive: {
2213
+ type: 'button_reply';
2214
+ button_reply: {
2215
+ id: string;
2216
+ title: string;
2217
+ };
2218
+ };
2219
+ }
2220
+ interface InteractiveNfmReplyMessage extends BaseMessage {
2221
+ type: MessageTypesEnum.Interactive;
2222
+ context: ReplyContext;
2223
+ interactive: {
2224
+ type: 'nfm_reply';
2225
+ nfm_reply: {
2226
+ name: string;
2227
+ body: string;
2228
+ response_json: string;
2229
+ };
2230
+ };
2231
+ }
2232
+ type InteractiveMessage = InteractiveListReplyMessage | InteractiveButtonReplyMessage | InteractiveNfmReplyMessage;
2233
+ interface ButtonMessage extends BaseMessage {
2234
+ type: MessageTypesEnum.Button;
2235
+ context: ReplyContext;
2236
+ button: {
2237
+ payload: string;
2238
+ text: string;
2239
+ };
2240
+ }
2241
+ interface LocationMessage extends BaseMessage {
2242
+ type: MessageTypesEnum.Location;
2243
+ location: {
2244
+ latitude: number;
2245
+ longitude: number;
2246
+ name?: string;
2247
+ address?: string;
2248
+ url?: string;
2249
+ };
2250
+ referral?: ReferralInfo;
1801
2251
  }
1802
- interface FlowsWebhookValue {
1803
- field: 'flows';
1804
- value: FlowsValue;
2252
+ interface ContactsMessage extends BaseMessage {
2253
+ type: MessageTypesEnum.Contacts;
2254
+ contacts: Array<{
2255
+ addresses?: Array<{
2256
+ city?: string;
2257
+ country?: string;
2258
+ country_code?: string;
2259
+ state?: string;
2260
+ street?: string;
2261
+ type?: string;
2262
+ zip?: string;
2263
+ }>;
2264
+ birthday?: string;
2265
+ emails?: Array<{
2266
+ email: string;
2267
+ type?: string;
2268
+ }>;
2269
+ name: {
2270
+ formatted_name: string;
2271
+ first_name?: string;
2272
+ last_name?: string;
2273
+ middle_name?: string;
2274
+ suffix?: string;
2275
+ prefix?: string;
2276
+ };
2277
+ org?: {
2278
+ company?: string;
2279
+ department?: string;
2280
+ title?: string;
2281
+ };
2282
+ phones?: Array<{
2283
+ phone: string;
2284
+ wa_id?: string;
2285
+ type?: string;
2286
+ }>;
2287
+ urls?: Array<{
2288
+ url: string;
2289
+ type?: string;
2290
+ }>;
2291
+ }>;
2292
+ referral?: ReferralInfo;
1805
2293
  }
1806
- //#endregion
1807
- //#region src/core/webhook/types/security.d.ts
1808
- /**
1809
- * Two-step verification security events
1810
- * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#value--event
1811
- */
1812
- type SecurityEvent = 'PIN_CHANGED' | 'PIN_RESET_REQUEST' | 'PIN_RESET_SUCCESS';
1813
- interface SecurityValue {
1814
- event: SecurityEvent;
1815
- requester?: string;
2294
+ interface ReactionMessage extends BaseMessage {
2295
+ type: MessageTypesEnum.Reaction;
2296
+ reaction: {
2297
+ message_id: string;
2298
+ emoji?: string;
2299
+ };
1816
2300
  }
1817
- interface SecurityWebhookValue {
1818
- field: 'security';
1819
- value: SecurityValue;
2301
+ interface OrderMessage extends BaseMessage {
2302
+ type: MessageTypesEnum.Order;
2303
+ order: {
2304
+ catalog_id: string;
2305
+ text?: string;
2306
+ product_items: Array<{
2307
+ product_retailer_id: string;
2308
+ quantity: number;
2309
+ item_price: number;
2310
+ currency: string;
2311
+ }>;
2312
+ };
2313
+ }
2314
+ interface SystemMessage extends BaseMessage {
2315
+ type: MessageTypesEnum.System;
2316
+ system: {
2317
+ body: string;
2318
+ wa_id: string;
2319
+ type: 'user_changed_number';
2320
+ };
1820
2321
  }
2322
+ interface UnsupportedMessage extends BaseMessage {
2323
+ type: MessageTypesEnum.Unsupported;
2324
+ errors: Array<WebhookError>;
2325
+ }
2326
+ type GroupMessage = {
2327
+ group_id: string;
2328
+ } & (TextMessage | ImageMessage | VideoMessage | AudioMessage | DocumentMessage | LocationMessage | ContactsMessage);
2329
+ type WhatsAppMessage = TextMessage | ImageMessage | VideoMessage | AudioMessage | DocumentMessage | StickerMessage | InteractiveMessage | ButtonMessage | LocationMessage | ContactsMessage | ReactionMessage | OrderMessage | SystemMessage | UnsupportedMessage | GroupMessage;
1821
2330
  //#endregion
1822
2331
  //#region src/core/webhook/types/history.d.ts
1823
2332
  /**
@@ -1886,376 +2395,317 @@ interface HistorySyncData {
1886
2395
  errors?: HistorySyncError[];
1887
2396
  }
1888
2397
  /**
1889
- * History webhook value
1890
- */
1891
- interface HistoryValue {
1892
- messaging_product: string;
1893
- metadata: HistorySyncMetadata;
1894
- history?: HistorySyncData[];
1895
- messages?: WhatsAppMessage[];
1896
- message_echoes?: HistoryMessageEcho[];
1897
- }
1898
- interface HistoryWebhookValue {
1899
- field: 'history';
1900
- value: HistoryValue;
1901
- }
1902
- //#endregion
1903
- //#region src/core/webhook/types/messageEchoes.d.ts
1904
- /**
1905
- * Message echo error
1906
- */
1907
- interface MessageEchoError {
1908
- message: string;
1909
- error_data?: {
1910
- details: string;
1911
- };
1912
- }
1913
- /**
1914
- * Message echo data (sent messages from business)
1915
- */
1916
- interface MessageEcho {
1917
- from: string;
1918
- to: string;
1919
- id: string;
1920
- timestamp: string;
1921
- text?: {
1922
- body: string;
1923
- };
1924
- interactive?: any;
1925
- location?: any;
1926
- image?: any;
1927
- document?: any;
1928
- voice?: any;
1929
- audio?: any;
1930
- video?: any;
1931
- sticker?: any;
1932
- button?: any;
1933
- contacts?: any;
1934
- reaction?: {
1935
- message_id: string;
1936
- emoji: string;
1937
- };
1938
- order?: any;
1939
- biz_opaque_callback_data?: string;
1940
- template?: any;
1941
- system?: {
1942
- type: string;
1943
- };
1944
- user_actions?: any[];
1945
- }
1946
- /**
1947
- * SMB Message Echoes value
1948
- */
1949
- interface SmbMessageEchoesValue {
1950
- metadata: WebhookMetadata;
1951
- errors?: MessageEchoError[];
1952
- message_echoes: MessageEcho[];
1953
- }
1954
- interface SmbMessageEchoesWebhookValue {
1955
- field: 'smb_message_echoes';
1956
- value: SmbMessageEchoesValue;
1957
- }
1958
- //#endregion
1959
- //#region src/core/webhook/types/appStateSync.d.ts
1960
- /**
1961
- * Contact data in state sync
1962
- */
1963
- interface StateSyncContact {
1964
- full_name: string;
1965
- first_name: string;
1966
- phone_number: string;
1967
- }
1968
- /**
1969
- * State sync metadata
1970
- */
1971
- interface StateSyncMetadata {
1972
- timestamp: string;
1973
- version: number;
1974
- }
1975
- /**
1976
- * State sync data
1977
- */
1978
- interface StateSyncData {
1979
- type: string;
1980
- contact: StateSyncContact;
1981
- action: string;
1982
- metadata: StateSyncMetadata;
1983
- }
1984
- /**
1985
- * SMB App State Sync value
1986
- */
1987
- interface SmbAppStateSyncValue {
1988
- messaging_product: string;
1989
- metadata: WebhookMetadata;
1990
- state_sync: StateSyncData[];
1991
- }
1992
- interface SmbAppStateSyncWebhookValue {
1993
- field: 'smb_app_state_sync';
1994
- value: SmbAppStateSyncValue;
1995
- }
1996
- //#endregion
1997
- //#region src/core/webhook/types/index.d.ts
1998
- /**
1999
- * Webhook value for incoming messages
2000
- */
2001
- interface MessageWebhookValue {
2002
- messaging_product: 'whatsapp';
2003
- metadata: WebhookMetadata;
2004
- contacts: Array<WebhookContact>;
2005
- messages: Array<WhatsAppMessage>;
2006
- }
2007
- /**
2008
- * Webhook value for status updates
2009
- */
2010
- interface StatusWebhookValue {
2011
- messaging_product: 'whatsapp';
2012
- metadata: WebhookMetadata;
2013
- statuses: Array<StatusWebhook>;
2014
- }
2015
- /**
2016
- * Webhook value for errors (no contacts or messages)
2017
- */
2018
- interface ErrorWebhookValue {
2019
- messaging_product: 'whatsapp';
2020
- metadata: WebhookMetadata;
2021
- errors: Array<WebhookError>;
2022
- }
2023
- /**
2024
- * Union type for all webhook value types
2398
+ * History webhook value
2025
2399
  */
2026
- type WebhookValue = MessageWebhookValue | StatusWebhookValue | ErrorWebhookValue;
2400
+ interface HistoryValue {
2401
+ messaging_product: string;
2402
+ metadata: HistorySyncMetadata;
2403
+ history?: HistorySyncData[];
2404
+ messages?: WhatsAppMessage[];
2405
+ message_echoes?: HistoryMessageEcho[];
2406
+ }
2407
+ interface HistoryWebhookValue {
2408
+ field: 'history';
2409
+ value: HistoryValue;
2410
+ }
2411
+ //#endregion
2412
+ //#region src/core/webhook/types/messageEchoes.d.ts
2027
2413
  /**
2028
- * Union type for all webhook field values
2414
+ * Message echo error
2029
2415
  */
2030
- type WebhookFieldValue = AccountUpdateWebhookValue | AccountReviewUpdateWebhookValue | AccountAlertsWebhookValue | BusinessCapabilityUpdateWebhookValue | PhoneNumberNameUpdateWebhookValue | PhoneNumberQualityUpdateWebhookValue | MessageTemplateStatusUpdateWebhookValue | TemplateCategoryUpdateWebhookValue | MessageTemplateQualityUpdateWebhookValue | FlowsWebhookValue | SecurityWebhookValue | HistoryWebhookValue | SmbMessageEchoesWebhookValue | SmbAppStateSyncWebhookValue;
2031
- interface WebhookPayload {
2032
- object: 'whatsapp_business_account';
2033
- entry: Array<{
2034
- id: string;
2035
- changes: Array<{
2036
- value: WebhookValue;
2037
- field: 'messages';
2038
- } | WebhookFieldValue>;
2039
- }>;
2416
+ interface MessageEchoError {
2417
+ message: string;
2418
+ error_data?: {
2419
+ details: string;
2420
+ };
2040
2421
  }
2041
2422
  /**
2042
- * @deprecated Use specific message types instead
2043
- * Represents a message received through the webhook
2423
+ * Message echo data (sent messages from business)
2044
2424
  */
2045
- interface WebhookMessage {
2046
- wabaId: string;
2047
- id: string;
2425
+ interface MessageEcho {
2048
2426
  from: string;
2427
+ to: string;
2428
+ id: string;
2049
2429
  timestamp: string;
2050
- type: any;
2051
- phoneNumberId: string;
2052
- displayPhoneNumber: string;
2053
- profileName: string;
2054
- text?: any;
2430
+ text?: {
2431
+ body: string;
2432
+ };
2433
+ interactive?: any;
2434
+ location?: any;
2055
2435
  image?: any;
2056
- video?: any;
2057
- audio?: any;
2058
2436
  document?: any;
2437
+ voice?: any;
2438
+ audio?: any;
2439
+ video?: any;
2059
2440
  sticker?: any;
2060
- location?: any;
2061
- contacts?: any;
2062
- interactive?: any;
2063
2441
  button?: any;
2442
+ contacts?: any;
2443
+ reaction?: {
2444
+ message_id: string;
2445
+ emoji: string;
2446
+ };
2064
2447
  order?: any;
2065
- system?: any;
2066
- reaction?: any;
2067
- statuses?: StatusWebhook;
2068
- originalData: any;
2448
+ biz_opaque_callback_data?: string;
2449
+ template?: any;
2450
+ system?: {
2451
+ type: string;
2452
+ };
2453
+ user_actions?: any[];
2069
2454
  }
2070
2455
  /**
2071
- * Webhook event received from WhatsApp
2456
+ * SMB Message Echoes value
2072
2457
  */
2073
- interface WebhookEvent {
2074
- field: string;
2075
- value: any;
2076
- timestamp: number;
2458
+ interface SmbMessageEchoesValue {
2459
+ metadata: WebhookMetadata;
2460
+ errors?: MessageEchoError[];
2461
+ message_echoes: MessageEcho[];
2077
2462
  }
2078
- //#endregion
2079
- //#region src/api/qrCode/types/common.d.ts
2080
- type QrCodeResponse = {
2081
- code: string;
2082
- prefilled_message: string;
2083
- deep_link_url: string;
2084
- qr_image_url?: string;
2085
- };
2086
- type QrCodesResponse = ResponseData<QrCodeResponse[]>;
2087
- type CreateQrCodeRequest = {
2088
- prefilled_message: string;
2089
- generate_qr_image?: 'SVG' | 'PNG';
2090
- };
2091
- type UpdateQrCodeRequest = {
2092
- code: string;
2093
- prefilled_message: string;
2094
- };
2095
- interface QrCodeClass {
2096
- createQrCode(request: CreateQrCodeRequest): Promise<QrCodeResponse>;
2097
- getQrCodes(): Promise<QrCodesResponse>;
2098
- getQrCode(qrCodeId: string): Promise<QrCodeResponse>;
2099
- updateQrCode(request: UpdateQrCodeRequest): Promise<QrCodeResponse>;
2100
- deleteQrCode(qrCodeId: string): Promise<ResponseSuccess>;
2463
+ interface SmbMessageEchoesWebhookValue {
2464
+ field: 'smb_message_echoes';
2465
+ value: SmbMessageEchoesValue;
2101
2466
  }
2102
2467
  //#endregion
2103
- //#region src/api/waba/types/common.d.ts
2468
+ //#region src/core/webhook/types/phoneNumber.d.ts
2104
2469
  /**
2105
- * WhatsApp Business Account subscription configuration
2470
+ * Phone number name update decision
2471
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#phone-number-updates
2106
2472
  */
2107
- type WabaSubscription = {
2108
- whatsapp_business_api_data: {
2109
- id: string;
2110
- link: string;
2111
- name: string;
2112
- category: string;
2113
- };
2114
- override_callback_uri?: string;
2115
- };
2473
+ type PhoneNumberDecision = 'APPROVED' | 'REJECTED' | 'DEFERRED';
2474
+ interface PhoneNumberNameUpdateValue {
2475
+ display_phone_number: string;
2476
+ decision: PhoneNumberDecision;
2477
+ requested_verified_name: string;
2478
+ rejection_reason: string | null;
2479
+ }
2480
+ interface PhoneNumberNameUpdateWebhookValue {
2481
+ field: 'phone_number_name_update';
2482
+ value: PhoneNumberNameUpdateValue;
2483
+ }
2116
2484
  /**
2117
- * Parameters for updating WABA subscription
2485
+ * Phone number quality events
2486
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#value--event
2118
2487
  */
2119
- interface UpdateWabaSubscription {
2120
- override_callback_uri: string;
2121
- verify_token: string;
2122
- }
2488
+ type PhoneNumberQualityEvent = 'FLAGGED' | 'UNFLAGGED' | 'UPGRADE' | 'DOWNGRADE' | 'ONBOARDING';
2123
2489
  /**
2124
- * Response containing all WABA subscriptions
2490
+ * Messaging tier limits
2491
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#value--current_limit
2125
2492
  */
2126
- interface WabaSubscriptions {
2127
- data: Array<WabaSubscription>;
2493
+ type CurrentLimit = 'TIER_50' | 'TIER_250' | 'TIER_1K' | 'TIER_10K' | 'TIER_100K' | 'TIER_UNLIMITED';
2494
+ interface PhoneNumberQualityUpdateValue {
2495
+ display_phone_number: string;
2496
+ event: PhoneNumberQualityEvent;
2497
+ current_limit: CurrentLimit;
2498
+ }
2499
+ interface PhoneNumberQualityUpdateWebhookValue {
2500
+ field: 'phone_number_quality_update';
2501
+ value: PhoneNumberQualityUpdateValue;
2128
2502
  }
2503
+ //#endregion
2504
+ //#region src/core/webhook/types/security.d.ts
2129
2505
  /**
2130
- * WABA account review status enumeration
2506
+ * Two-step verification security events
2507
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#value--event
2131
2508
  */
2132
- declare enum WabaAccountReviewStatus {
2133
- Approved = "APPROVED",
2134
- Active = "ACTIVE",
2135
- Inactive = "INACTIVE",
2136
- Disabled = "DISABLED",
2509
+ type SecurityEvent = 'PIN_CHANGED' | 'PIN_RESET_REQUEST' | 'PIN_RESET_SUCCESS';
2510
+ interface SecurityValue {
2511
+ event: SecurityEvent;
2512
+ requester?: string;
2513
+ }
2514
+ interface SecurityWebhookValue {
2515
+ field: 'security';
2516
+ value: SecurityValue;
2517
+ }
2518
+ //#endregion
2519
+ //#region src/core/webhook/types/status.d.ts
2520
+ interface StatusWebhook {
2521
+ id: string;
2522
+ status: 'sent' | 'delivered' | 'read' | 'failed';
2523
+ timestamp: string;
2524
+ recipient_id: string;
2525
+ recipient_type?: 'group';
2526
+ recipient_participant_id?: string;
2527
+ recipient_identity_key_hash?: string;
2528
+ biz_opaque_callback_data?: string;
2529
+ conversation?: {
2530
+ id: string;
2531
+ expiration_timestamp?: string;
2532
+ origin: {
2533
+ type: 'authentication' | 'authentication_international' | 'marketing' | 'marketing_lite' | 'referral_conversion' | 'service' | 'utility';
2534
+ };
2535
+ };
2536
+ pricing?: {
2537
+ billable: boolean;
2538
+ pricing_model: 'CBP' | 'PMP';
2539
+ type: 'regular' | 'free_customer_service' | 'free_entry_point';
2540
+ category: 'authentication' | 'authentication_international' | 'marketing' | 'marketing_lite' | 'referral_conversion' | 'service' | 'utility';
2541
+ };
2542
+ errors?: Array<WebhookError>;
2137
2543
  }
2544
+ //#endregion
2545
+ //#region src/core/webhook/types/template.d.ts
2138
2546
  /**
2139
- * WABA health status for message sending capability
2547
+ * Message template status events
2548
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#value--event
2140
2549
  */
2141
- declare enum WabaHealthStatusCanSendMessage {
2142
- Blocked = "BLOCKED",
2143
- Limited = "LIMITED",
2144
- Available = "AVAILABLE",
2145
- }
2550
+ type TemplateStatusEvent = 'APPROVED' | 'REJECTED' | 'PENDING' | 'DISABLED' | 'REINSTATED' | 'IN_APPEAL' | 'FLAGGED' | 'PAUSED' | 'PENDING_DELETION';
2146
2551
  /**
2147
- * WABA account status enumeration
2552
+ * Template rejection reasons
2553
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#value--reason
2148
2554
  */
2149
- declare enum WabaAccountStatus {
2150
- Approved = "APPROVED",
2151
- Active = "ACTIVE",
2152
- Inactive = "INACTIVE",
2153
- Disabled = "DISABLED",
2555
+ type TemplateRejectionReason = 'NONE' | 'ABUSIVE_CONTENT' | 'INCORRECT_CATEGORY' | 'INVALID_FORMAT' | 'SCAM';
2556
+ interface TemplateDisableInfo {
2557
+ disable_date: string;
2558
+ }
2559
+ interface TemplatePauseInfo {
2560
+ title: string;
2561
+ description: string;
2562
+ }
2563
+ interface MessageTemplateStatusUpdateValue {
2564
+ event: TemplateStatusEvent;
2565
+ message_template_id: number;
2566
+ message_template_name: string;
2567
+ message_template_language: string;
2568
+ reason: TemplateRejectionReason | null;
2569
+ disable_info?: TemplateDisableInfo;
2570
+ other_info?: TemplatePauseInfo;
2571
+ }
2572
+ interface MessageTemplateStatusUpdateWebhookValue {
2573
+ field: 'message_template_status_update';
2574
+ value: MessageTemplateStatusUpdateValue;
2154
2575
  }
2155
2576
  /**
2156
- * Business verification status enumeration
2577
+ * Template categories
2578
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#value--event
2157
2579
  */
2158
- declare enum WabaBusinessVerificationStatus {
2159
- Verified = "verified",
2160
- PendingSubmission = "pending_submission",
2161
- Unverified = "unverified",
2162
- Rejected = "rejected",
2580
+ type TemplateCategory = 'MARKETING' | 'OTP' | 'TRANSACTIONAL' | 'AUTHENTICATION' | 'UTILITY';
2581
+ interface TemplateCategoryUpdateValue {
2582
+ message_template_id: number;
2583
+ message_template_name: string;
2584
+ message_template_language: string;
2585
+ previous_category: TemplateCategory;
2586
+ new_category: TemplateCategory;
2587
+ }
2588
+ interface TemplateCategoryUpdateWebhookValue {
2589
+ field: 'template_category_update';
2590
+ value: TemplateCategoryUpdateValue;
2163
2591
  }
2164
2592
  /**
2165
- * WABA health status error details
2593
+ * Template quality scores
2594
+ * @see https://developers.facebook.com/docs/whatsapp/business-management-api/webhooks/components#value--event
2166
2595
  */
2167
- interface WabaHealthStatusError {
2168
- error_code?: number;
2169
- error_description?: string;
2170
- possible_solution?: string;
2596
+ type TemplateQualityScore = 'GREEN' | 'YELLOW' | 'RED' | 'UNKNOWN';
2597
+ interface MessageTemplateQualityUpdateValue {
2598
+ previous_quality_score: TemplateQualityScore;
2599
+ new_quality_score: TemplateQualityScore;
2600
+ message_template_id: number;
2601
+ message_template_name: string;
2602
+ message_template_language: string;
2603
+ }
2604
+ interface MessageTemplateQualityUpdateWebhookValue {
2605
+ field: 'message_template_quality_update';
2606
+ value: MessageTemplateQualityUpdateValue;
2171
2607
  }
2608
+ //#endregion
2609
+ //#region src/core/webhook/types/index.d.ts
2172
2610
  /**
2173
- * WABA health status entity information
2611
+ * Webhook value for incoming messages
2174
2612
  */
2175
- interface WabaHealthStatusEntity {
2176
- entity_type?: string;
2177
- id?: string;
2178
- can_send_message?: string;
2179
- errors?: WabaHealthStatusError[];
2613
+ interface MessageWebhookValue {
2614
+ messaging_product: 'whatsapp';
2615
+ metadata: WebhookMetadata;
2616
+ contacts: Array<WebhookContact>;
2617
+ messages: Array<WhatsAppMessage>;
2180
2618
  }
2181
2619
  /**
2182
- * Overall WABA health status
2620
+ * Webhook value for status updates
2183
2621
  */
2184
- interface WabaHealthStatus {
2185
- can_send_message?: WabaHealthStatusCanSendMessage;
2186
- entities?: WabaHealthStatusEntity[];
2622
+ interface StatusWebhookValue {
2623
+ messaging_product: 'whatsapp';
2624
+ metadata: WebhookMetadata;
2625
+ statuses: Array<StatusWebhook>;
2187
2626
  }
2188
2627
  /**
2189
- * WhatsApp Business Account information
2628
+ * Webhook value for errors (no contacts or messages)
2190
2629
  */
2191
- interface WabaAccount {
2192
- account_review_status?: WabaAccountReviewStatus;
2193
- id?: string;
2194
- health_status?: WabaHealthStatus;
2195
- status?: WabaAccountStatus;
2196
- business_verification_status?: WabaBusinessVerificationStatus;
2197
- message_template_namespace?: string;
2198
- name?: string;
2199
- ownership_type?: string;
2200
- currency?: string;
2630
+ interface ErrorWebhookValue {
2631
+ messaging_product: 'whatsapp';
2632
+ metadata: WebhookMetadata;
2633
+ errors: Array<WebhookError>;
2201
2634
  }
2202
2635
  /**
2203
- * Available fields for WABA account queries
2636
+ * Union type for all webhook value types
2204
2637
  */
2205
- type WabaAccountFields = 'id' | 'name' | 'account_review_status' | 'auth_international_rate_eligibility' | 'business_verification_status' | 'country' | 'currency' | 'health_status' | 'status' | 'ownership_type' | 'message_template_namespace';
2638
+ type WebhookValue = MessageWebhookValue | StatusWebhookValue | ErrorWebhookValue;
2206
2639
  /**
2207
- * Parameter type for specifying which WABA account fields to retrieve
2640
+ * Union type for all webhook field values
2208
2641
  */
2209
- type WabaAccountFieldsParam = WabaAccountFields[];
2642
+ type WebhookFieldValue = AccountUpdateWebhookValue | AccountReviewUpdateWebhookValue | AccountAlertsWebhookValue | BusinessCapabilityUpdateWebhookValue | PhoneNumberNameUpdateWebhookValue | PhoneNumberQualityUpdateWebhookValue | MessageTemplateStatusUpdateWebhookValue | TemplateCategoryUpdateWebhookValue | MessageTemplateQualityUpdateWebhookValue | FlowsWebhookValue | SecurityWebhookValue | HistoryWebhookValue | SmbMessageEchoesWebhookValue | SmbAppStateSyncWebhookValue;
2643
+ interface WebhookPayload {
2644
+ object: 'whatsapp_business_account';
2645
+ entry: Array<{
2646
+ id: string;
2647
+ changes: Array<{
2648
+ value: WebhookValue;
2649
+ field: 'messages';
2650
+ } | WebhookFieldValue>;
2651
+ }>;
2652
+ }
2210
2653
  /**
2211
- * Interface defining all WABA API methods
2654
+ * @deprecated Use specific message types instead
2655
+ * Represents a message received through the webhook
2212
2656
  */
2213
- interface WABAClass {
2214
- getWabaAccount(fields?: WabaAccountFieldsParam): Promise<WabaAccount>;
2215
- getAllWabaSubscriptions(): Promise<WabaSubscriptions>;
2216
- updateWabaSubscription(params: UpdateWabaSubscription): Promise<ResponseSuccess>;
2217
- unsubscribeFromWaba(): Promise<ResponseSuccess>;
2218
- }
2219
- //#endregion
2220
- //#region src/api/registration/types/common.d.ts
2221
- type RegistrationRequest = {
2222
- messaging_product: 'whatsapp';
2223
- pin: string;
2224
- data_localization_region?: DataLocalizationRegionEnum;
2225
- };
2226
- interface RegistrationClass {
2227
- register(pin: string, dataLocalizationRegion?: DataLocalizationRegionEnum): Promise<ResponseSuccess>;
2228
- deregister(): Promise<ResponseSuccess>;
2657
+ interface WebhookMessage {
2658
+ wabaId: string;
2659
+ id: string;
2660
+ from: string;
2661
+ timestamp: string;
2662
+ type: any;
2663
+ phoneNumberId: string;
2664
+ displayPhoneNumber: string;
2665
+ profileName: string;
2666
+ text?: any;
2667
+ image?: any;
2668
+ video?: any;
2669
+ audio?: any;
2670
+ document?: any;
2671
+ sticker?: any;
2672
+ location?: any;
2673
+ contacts?: any;
2674
+ interactive?: any;
2675
+ button?: any;
2676
+ order?: any;
2677
+ system?: any;
2678
+ reaction?: any;
2679
+ statuses?: StatusWebhook;
2680
+ originalData: any;
2229
2681
  }
2230
- //#endregion
2231
- //#region src/api/twoStepVerification/types/common.d.ts
2232
- type TwoStepVerificationRequest = {
2233
- pin: string;
2234
- };
2235
- interface TwoStepVerificationClass {
2236
- setTwoStepVerificationCode(pin: string): Promise<ResponseSuccess>;
2682
+ /**
2683
+ * Webhook event received from WhatsApp
2684
+ */
2685
+ interface WebhookEvent {
2686
+ field: string;
2687
+ value: any;
2688
+ timestamp: number;
2237
2689
  }
2238
2690
  //#endregion
2239
- //#region src/api/encryption/types/publicKey.d.ts
2240
- type EncryptionPublicKeyResponse = ResponseData<{
2241
- business_public_key: string;
2242
- business_public_key_signature_status: 'VALID' | 'MISMATCH';
2243
- }>;
2244
- //#endregion
2245
2691
  //#region src/utils/isMetaError.d.ts
2246
- interface MetaError extends Error {
2247
- error: {
2248
- message: string;
2249
- type: string;
2250
- code: number;
2251
- error_data?: {
2252
- messaging_product: 'whatsapp';
2253
- details: string;
2254
- };
2255
- error_subcode?: number;
2256
- fbtrace_id: string;
2692
+ type MetaErrorData = {
2693
+ message: string;
2694
+ type: string;
2695
+ code: number;
2696
+ error_data?: {
2697
+ messaging_product?: 'whatsapp';
2698
+ details?: string;
2257
2699
  };
2700
+ error_subcode?: number;
2701
+ fbtrace_id: string;
2702
+ };
2703
+ interface MetaError extends Error {
2704
+ error: MetaErrorData;
2258
2705
  }
2706
+ declare const WHATSAPP_ERROR_CODES: readonly [0, 1, 2, 3, 4, 10, 33, 100, 190, 200, 299, 368, 613, 80007, 130429, 130472, 130497, 131000, 131005, 131008, 131009, 131016, 131020, 131021, 131026, 131030, 131031, 131037, 131041, 131042, 131044, 131045, 131047, 131048, 131049, 131050, 131051, 131052, 131053, 131055, 131056, 131057, 131059, 131201, 131202, 131203, 131204, 131207, 131208, 131209, 131210, 131211, 131212, 131213, 131214, 131215, 132000, 132001, 132005, 132007, 132008, 132012, 132015, 132016, 132068, 132069, 133000, 133004, 133005, 133006, 133008, 133009, 133010, 133015, 133016, 134011, 134100, 134101, 134102, 135000, 137000, 138000, 138001, 138002, 138003, 138004, 138005, 138006, 138007, 138009, 138012, 138013, 138018, 139000, 139001, 139002, 139003, 139004, 139100, 139101, 139102, 139103, 200005, 200006, 200007, 1752041, 2388001, 2388012, 2388019, 2388040, 2388047, 2388072, 2388073, 2388091, 2388093, 2388103, 2388293, 2388299, 2494100, 2593079, 2593085, 2593107, 2593108];
2707
+ type ApiPermissionErrorCode = number;
2708
+ type WhatsAppErrorCode = (typeof WHATSAPP_ERROR_CODES)[number] | ApiPermissionErrorCode;
2259
2709
  //#endregion
2260
2710
  //#region src/api/flow/types/common.d.ts
2261
2711
  /**
@@ -2657,90 +3107,31 @@ interface FlowClass {
2657
3107
  }): Promise<FlowMigrationResponse>;
2658
3108
  }
2659
3109
  //#endregion
2660
- //#region src/api/blockUsers/types/blockUsers.d.ts
2661
- /**
2662
- * Blocked user information in response
2663
- */
2664
- type BlockedUserInfo = {
2665
- input: string;
2666
- wa_id: string;
2667
- };
2668
- /**
2669
- * Failed user information with error details
2670
- * Uses common MetaErrorDetail type for consistency across APIs
2671
- */
2672
- type FailedUserInfo = BlockedUserInfo & {
2673
- errors?: MetaErrorDetail[];
2674
- };
2675
- /**
2676
- * Response for block/unblock operations
2677
- */
2678
- type BlockUsersResponse = {
2679
- messaging_product: 'whatsapp';
2680
- block_users: {
2681
- added_users?: BlockedUserInfo[];
2682
- failed_users?: FailedUserInfo[];
2683
- };
2684
- };
2685
- /**
2686
- * Pagination cursors for list operations
2687
- */
2688
- type PagingCursors = {
2689
- after?: string;
2690
- before?: string;
2691
- };
2692
- /**
2693
- * Pagination information
2694
- */
2695
- type PagingInfo = {
2696
- cursors?: PagingCursors;
2697
- previous?: string;
2698
- next?: string;
2699
- };
2700
- /**
2701
- * List blocked users response
2702
- */
2703
- type ListBlockedUsersResponse = {
2704
- data: Array<{
2705
- block_users: BlockedUserInfo[];
2706
- }>;
2707
- paging?: PagingInfo;
2708
- };
2709
- /**
2710
- * Query parameters for listing blocked users
2711
- */
2712
- type ListBlockedUsersParams = {
2713
- limit?: number;
2714
- after?: string;
2715
- before?: string;
2716
- };
2717
- /**
2718
- * Block Users API Interface
2719
- */
2720
- interface BlockUsersClass {
2721
- /**
2722
- * Block one or more WhatsApp users
2723
- * @param users - Array of phone numbers or WhatsApp IDs to block
2724
- * @returns Response with successfully blocked and failed users
2725
- * @throws Error if users have not messaged in last 24 hours
2726
- * @see https://developers.facebook.com/docs/whatsapp/cloud-api/block-users#block-users
2727
- */
2728
- block(users: string[]): Promise<BlockUsersResponse>;
2729
- /**
2730
- * Unblock one or more WhatsApp users
2731
- * @param users - Array of phone numbers or WhatsApp IDs to unblock
2732
- * @returns Response with successfully unblocked and failed users
2733
- * @see https://developers.facebook.com/docs/whatsapp/cloud-api/block-users#unblock-users
2734
- */
2735
- unblock(users: string[]): Promise<BlockUsersResponse>;
2736
- /**
2737
- * Get list of blocked WhatsApp users with pagination
2738
- * @param params - Optional pagination parameters
2739
- * @returns List of blocked users with pagination info
2740
- * @see https://developers.facebook.com/docs/whatsapp/cloud-api/block-users#get-list-of-blocked-numbers
2741
- */
2742
- listBlockedUsers(params?: ListBlockedUsersParams): Promise<ListBlockedUsersResponse>;
3110
+ //#region src/types/httpsClient.d.ts
3111
+ type ResponseHeaderValue = string | string[] | undefined;
3112
+ type ResponseHeaders = Record<string, ResponseHeaderValue>;
3113
+ type ResponseJSONBody = Record<string, unknown>;
3114
+ declare class HttpsClientResponseClass {
3115
+ constructor(resp: Response);
3116
+ statusCode: () => number;
3117
+ headers: () => ResponseHeaders;
3118
+ rawResponse: () => Response;
3119
+ json: () => Promise<ResponseJSONBody>;
3120
+ }
3121
+ declare class HttpsClientClass {
3122
+ constructor();
3123
+ clearSockets: () => boolean;
3124
+ sendRequest: (host: string, path: string, method: HttpMethodsEnum, headers: HeadersInit, timeout: number, body?: BodyInit | null) => Promise<HttpsClientResponseClass>;
3125
+ }
3126
+ //#endregion
3127
+ //#region src/types/logger.d.ts
3128
+ interface LoggerInterface {
3129
+ log(...data: any[]): void;
3130
+ error(...data: any[]): void;
3131
+ warn(...data: any[]): void;
3132
+ info(...data: any[]): void;
3133
+ debug(...data: any[]): void;
2743
3134
  }
2744
3135
  //#endregion
2745
- export { type AccountMode, type AudioMediaObject, AudioMediaTypesEnum, type AudioMessage, type AuthenticationTemplateOptions, type BaseClass, type BlockUsersClass, type BlockUsersResponse, type BlockedUserInfo, type BodyOptions, type BusinessProfileClass, type BusinessProfileData, type BusinessProfileField, type BusinessProfileFieldsParam, type BusinessProfileResponse, BusinessVerticalEnum, type ButtonMessage, type ButtonOptions, ButtonPositionEnum, type CarouselCard, type CarouselOptions, type CatalogButton, type CatalogTemplateOptions, CategoryEnum, type CodeVerificationStatus, type ComponentTypes, ComponentTypesEnum, type ContactObject, type ContactsMessage, ConversationTypesEnum, type CopyCodeButton, type CouponTemplateOptions, CreateFlowResponse, type CreateQrCodeRequest, CurrencyCodesEnum, type CurrencyParameter, type Cursors, DataLocalizationRegionEnum, type DateTimeParameter, type DocumentMediaObject, DocumentMediaTypesEnum, type DocumentMessage, type EncryptionPublicKeyResponse, type ErrorWebhookValue, type FailedUserInfo, type Flow, FlowActionEnum, type FlowAsset, type FlowAssetsResponse, type FlowButton, FlowCategoryEnum, type FlowClass, type FlowDataExchangeRequest, type FlowDataExchangeResponse, type FlowDecryptedRequestResponse, type FlowEncryptedRequestPayload, type FlowEndpointRequest, type FlowEndpointResponse, type FlowErrorNotificationRequest, type FlowErrorNotificationResponse, type FlowHealthCheckRequest, type FlowHealthCheckResponse, type FlowHttpRequest, type FlowMigrationFailure, type FlowMigrationResponse, type FlowMigrationResult, type FlowPreview, type FlowPreviewResponse, FlowStatusEnum, type FlowSuccessScreenResponse, type FlowType, FlowTypeEnum, type FlowValidationError, type FlowValidationErrorPointer, type FlowsListResponse, type FooterOptions, type GeneralHeaderInterface, type GeneralMessageBody, type GeneralRequestBody, type GroupMessage, type HeaderOptions, type HealthStatus, type HealthStatusEntity, HttpMethodsEnum, type HttpsClientClass, type HttpsClientResponseClass, type ImageMediaObject, ImageMediaTypesEnum, type ImageMessage, type InteractiveButtonReplyMessage, type InteractiveListReplyMessage, type InteractiveMessage, type InteractiveObject, InteractiveTypesEnum, LanguagesEnum, type LimitedTimeOfferOptions, type LimitedTimeOfferTemplateOptions, type ListBlockedUsersParams, type ListBlockedUsersResponse, type LocationMessage, type LocationObject, type LocationParameter, type LoggerInterface, type MPMButton, type MPMTemplateOptions, type MediaCardCarouselTemplateOptions, type MediaCarouselCard, MediaClass, type MediaParameter, MediaResponse, MediasResponse, type MessageRequestBody, type MessageRequestParams, type MessageTemplateObject, MessageTypesEnum, type MessageWebhookValue, type MessagesClass, type MessagesResponse, type MessagingLimitTier, type MetaError, type MetaErrorDetail, type OTPButton, type OTPTemplateOptions, type OrderMessage, type Pagination, type PaginationCursors, type Paging, ParametersTypesEnum, type PhoneNumberButton, type PhoneNumberClass, type PhoneNumberResponse, type PhoneNumbersResponse, type PlatformType, type ProductCardCarouselTemplateOptions, type ProductCarouselCard, type ProductParameter, type ProductSection, type QrCodeClass, type QrCodeResponse, type QrCodesResponse, type QualityRating, type QualityScore, type QuickReplyButton, type ReactionMessage, type ReactionParams, ReferralSourceTypesEnum, type RegistrationClass, type RegistrationRequest, RequestCodeMethodsEnum, type RequestVerificationCodeRequest, type RequesterClass, type RequesterResponseInterface, type ResponseData, type ResponseHeaderValue, type ResponseHeaders, type ResponseJSONBody, type ResponsePagination, type ResponseSuccess, type SPMButton, type SPMTemplateOptions, StatusEnum, type StatusParams, type StatusWebhook, type StatusWebhookValue, type StickerMediaObject, StickerMediaTypesEnum, type StickerMessage, SubTypeEnum, SystemChangeTypesEnum, type SystemMessage, type TemplateBody, type TemplateButton, type TemplateButtons, type TemplateCarousel, type TemplateClass, type TemplateDeleteParams, type TemplateFooter, type TemplateFormat, type TemplateGetParams, type TemplateHeader, type TemplateHeaderExample, type TemplateLimitedTimeOffer, type TemplateOptions, type TemplateParameter, type TemplateRequestBody, type TemplateResponse, TemplateStatusEnum, type TextMessage, type TextMessageParams, type TextObject, type TextParameter, type Throughput, type ThroughputLevel, type TwoStepVerificationClass, type TwoStepVerificationParams, type TwoStepVerificationRequest, type URLButton, type UnsupportedMessage, type UpdateBusinessProfileRequest, type UpdateFlowResponse, type UpdateQrCodeRequest, type UpdateWabaSubscription, UploadMediaResponse, type ValidateFlowJsonResponse, type VerifyCodeRequest, type VideoMediaObject, VideoMediaTypesEnum, type VideoMessage, type WABAClass, type WabaAccount, type WabaAccountFields, type WabaAccountFieldsParam, WabaAccountReviewStatus, WabaAccountStatus, WabaBusinessVerificationStatus, WabaConfigEnum, type WabaConfigType, type WabaHealthStatus, WabaHealthStatusCanSendMessage, type WabaHealthStatusEntity, type WabaHealthStatusError, type WabaSubscription, type WabaSubscriptions, type WebhookContact, type WebhookEvent, type WebhookMessage, type WebhookPayload, WebhookTypesEnum, type WebhookValue, type WhatsAppConfig, type WhatsAppMessage };
3136
+ export { type AcceptCallRequest, type AccountMode, type ApiPermissionErrorCode, type AudioMediaObject, AudioMediaTypesEnum, type AudioMessage, type AuthenticationTemplateOptions, type BaseClass, type BlockUsersClass, type BlockUsersResponse, type BlockedUserInfo, type BodyOptions, type BusinessProfileClass, type BusinessProfileData, type BusinessProfileField, type BusinessProfileFieldsParam, type BusinessProfileResponse, BusinessVerticalEnum, type ButtonMessage, type ButtonOptions, ButtonPositionEnum, type CallAction, type CallActionResponse, type CallHours, type CallHoursDay, type CallHoursStatus, type CallIconVisibility, type CallPermission, type CallPermissionAction, type CallPermissionLimit, type CallPermissionsResponse, type CallSdpType, type CallSession, type CallbackPermissionStatus, type CallingClass, type CallingSettings, type CallingSettingsResponse, type CallingStatus, type CarouselCard, type CarouselOptions, type CatalogButton, type CatalogTemplateOptions, CategoryEnum, type CodeVerificationStatus, type CommerceClass, type CommerceSetting, type CommerceSettingsResponse, type ComponentTypes, ComponentTypesEnum, type ContactObject, type ContactsMessage, ConversationTypesEnum, type CopyCodeButton, type CouponTemplateOptions, CreateFlowResponse, type CreateQrCodeRequest, CurrencyCodesEnum, type CurrencyParameter, type Cursors, DataLocalizationRegionEnum, type DateTimeParameter, type DocumentMediaObject, DocumentMediaTypesEnum, type DocumentMessage, type EncryptionPublicKeyResponse, type ErrorWebhookValue, type FailedUserInfo, type Flow, FlowActionEnum, type FlowAsset, type FlowAssetsResponse, type FlowButton, FlowCategoryEnum, type FlowClass, type FlowDataExchangeRequest, type FlowDataExchangeResponse, type FlowDecryptedRequestResponse, type FlowEncryptedRequestPayload, type FlowEndpointRequest, type FlowEndpointResponse, type FlowErrorNotificationRequest, type FlowErrorNotificationResponse, type FlowHealthCheckRequest, type FlowHealthCheckResponse, type FlowHttpRequest, type FlowMigrationFailure, type FlowMigrationResponse, type FlowMigrationResult, type FlowPreview, type FlowPreviewResponse, FlowStatusEnum, type FlowSuccessScreenResponse, type FlowType, FlowTypeEnum, type FlowValidationError, type FlowValidationErrorPointer, type FlowsListResponse, type FooterOptions, type GeneralHeaderInterface, type GeneralMessageBody, type GeneralRequestBody, type GroupCreateRequest, type GroupCreateResponse, type GroupInfoField, type GroupInfoFieldsParam, type GroupInfoResponse, type GroupInviteLinkResponse, type GroupJoinApprovalMode, type GroupJoinRequest, type GroupJoinRequestError, type GroupJoinRequestFailure, type GroupJoinRequestsActionResponse, type GroupJoinRequestsResponse, type GroupListParams, type GroupListResponse, type GroupMessage, type GroupParticipant, type GroupSettingsResponse, type GroupsClass, type HeaderOptions, type HealthStatus, type HealthStatusEntity, type HolidaySchedule, HttpMethodsEnum, type HttpsClientClass, type HttpsClientResponseClass, type ImageMediaObject, ImageMediaTypesEnum, type ImageMessage, type InitiateCallRequest, type InitiateCallResponse, type InteractiveButtonReplyMessage, type InteractiveListReplyMessage, type InteractiveMessage, type InteractiveObject, InteractiveTypesEnum, LanguagesEnum, type LimitedTimeOfferOptions, type LimitedTimeOfferTemplateOptions, type ListBlockedUsersParams, type ListBlockedUsersResponse, type LocationMessage, type LocationObject, type LocationParameter, type LoggerInterface, type MPMButton, type MPMTemplateOptions, type MarketingMessageRequest, type MarketingMessagesClass, type MediaCardCarouselTemplateOptions, type MediaCarouselCard, MediaClass, type MediaParameter, MediaResponse, MediasResponse, type MessageRequestBody, type MessageRequestParams, type MessageTemplateObject, MessageTypesEnum, type MessageWebhookValue, type MessagesClass, type MessagesResponse, type MessagingLimitTier, type MetaError, type MetaErrorData, type MetaErrorDetail, type OTPButton, type OTPTemplateOptions, type OrderMessage, type Pagination, type PaginationCursors, type Paging, ParametersTypesEnum, type PaymentConfiguration, type PaymentConfigurationCode, type PaymentConfigurationCreateRequest, type PaymentConfigurationCreateResponse, type PaymentConfigurationDeleteRequest, type PaymentConfigurationOauthLinkRequest, type PaymentConfigurationOauthLinkResponse, type PaymentConfigurationProvider, type PaymentConfigurationStatus, type PaymentConfigurationUpdateRequest, type PaymentConfigurationUpdateResponse, type PaymentConfigurationsResponse, type PaymentsClass, type PhoneNumberButton, type PhoneNumberClass, type PhoneNumberResponse, type PhoneNumbersResponse, type PlatformType, type PreAcceptCallRequest, type ProductCardCarouselTemplateOptions, type ProductCarouselCard, type ProductParameter, type ProductSection, type QrCodeClass, type QrCodeResponse, type QrCodesResponse, type QualityRating, type QualityScore, type QuickReplyButton, type ReactionMessage, type ReactionParams, ReferralSourceTypesEnum, type RegistrationClass, type RegistrationRequest, type RejectCallRequest, RequestCodeMethodsEnum, type RequestVerificationCodeRequest, type RequesterClass, type RequesterResponseInterface, type ResponseData, type ResponseHeaderValue, type ResponseHeaders, type ResponseJSONBody, type ResponsePagination, type ResponseSuccess, type SPMButton, type SPMTemplateOptions, type SipServer, type SipSettings, type SipStatus, StatusEnum, type StatusParams, type StatusWebhook, type StatusWebhookValue, type StickerMediaObject, StickerMediaTypesEnum, type StickerMessage, SubTypeEnum, SystemChangeTypesEnum, type SystemMessage, type TemplateBody, type TemplateButton, type TemplateButtons, type TemplateCarousel, type TemplateClass, type TemplateDeleteParams, type TemplateFooter, type TemplateFormat, type TemplateGetParams, type TemplateHeader, type TemplateHeaderExample, type TemplateLimitedTimeOffer, type TemplateOptions, type TemplateParameter, type TemplateRequestBody, type TemplateResponse, TemplateStatusEnum, type TerminateCallRequest, type TextMessage, type TextMessageParams, type TextObject, type TextParameter, type Throughput, type ThroughputLevel, type TwoStepVerificationClass, type TwoStepVerificationParams, type TwoStepVerificationRequest, type URLButton, type UnsupportedMessage, type UpdateBusinessProfileRequest, type UpdateCallingSettingsRequest, type UpdateCommerceSettingsRequest, type UpdateFlowResponse, type UpdateGroupSettingsRequest, type UpdateQrCodeRequest, type UpdateWabaSubscription, UploadMediaResponse, type ValidateFlowJsonResponse, type VerifyCodeRequest, type VideoMediaObject, VideoMediaTypesEnum, type VideoMessage, type WABAClass, type WabaAccount, type WabaAccountFields, type WabaAccountFieldsParam, WabaAccountReviewStatus, WabaAccountStatus, WabaBusinessVerificationStatus, WabaConfigEnum, type WabaConfigType, type WabaHealthStatus, WabaHealthStatusCanSendMessage, type WabaHealthStatusEntity, type WabaHealthStatusError, type WabaSubscription, type WabaSubscriptions, type WebhookContact, type WebhookEvent, type WebhookMessage, type WebhookPayload, WebhookTypesEnum, type WebhookValue, type WeeklyOperatingHours, type WhatsAppConfig, type WhatsAppErrorCode, type WhatsAppMessage };
2746
3137
  //# sourceMappingURL=index.d.ts.map