meta-cloud-api 0.2.18 → 0.2.19

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.
Files changed (52) hide show
  1. package/dist/{BusinessProfileApi-DDkv2WQK.d.ts → BusinessProfileApi-BjOyDR-8.d.ts} +3 -3
  2. package/dist/{EncryptionApi-CwxQlC-2.d.ts → EncryptionApi-B3hzgZwc.d.ts} +1 -1
  3. package/dist/{FlowApi-BIBrWYEv.d.ts → FlowApi-OEAji2dP.d.ts} +2 -2
  4. package/dist/{MediaApi-VqxndaBJ.d.ts → MediaApi-C2-eC3BR.d.ts} +1 -1
  5. package/dist/{MessageApi-CHc6bn3g.d.ts → MessageApi-BQhqbAOY.d.ts} +2 -2
  6. package/dist/{PhoneNumberApi-C-bs6YAe.d.ts → PhoneNumberApi-BgfYrui-.d.ts} +2 -2
  7. package/dist/{QrCodeApi-BjlyPUXV.d.ts → QrCodeApi-CimaUuYP.d.ts} +1 -1
  8. package/dist/{RegistrationApi-D7Bg8BUz.d.ts → RegistrationApi-BSDXRJlL.d.ts} +2 -2
  9. package/dist/{TemplateApi-dmZbvMkO.d.ts → TemplateApi-B7dTBIlN.d.ts} +3 -3
  10. package/dist/{TwoStepVerificationApi-DaYWPjY_.d.ts → TwoStepVerificationApi-BY0eD8R2.d.ts} +1 -1
  11. package/dist/{WabaApi-CMoTCWiH.d.ts → WabaApi-BFbVUUlw.d.ts} +1 -1
  12. package/dist/{base-BG2gtoDs.d.ts → base-B4QLc9vb.d.ts} +2 -2
  13. package/dist/chunk-34SVEEB7.js +3 -0
  14. package/dist/chunk-34SVEEB7.js.map +1 -0
  15. package/dist/chunk-BSNA6RYF.js +3 -0
  16. package/dist/chunk-BSNA6RYF.js.map +1 -0
  17. package/dist/{chunk-FFOE5YKT.js → chunk-GT3XQN7Y.js} +2 -2
  18. package/dist/chunk-GT3XQN7Y.js.map +1 -0
  19. package/dist/chunk-H55VIWDI.js +2 -0
  20. package/dist/chunk-H55VIWDI.js.map +1 -0
  21. package/dist/chunk-I222VSWK.js +2 -0
  22. package/dist/chunk-I222VSWK.js.map +1 -0
  23. package/dist/{chunk-XIIJD6SG.js → chunk-R36L2XYO.js} +2 -2
  24. package/dist/chunk-R36L2XYO.js.map +1 -0
  25. package/dist/core/webhook/index.d.ts +630 -0
  26. package/dist/core/webhook/index.js +2 -0
  27. package/dist/core/webhook/index.js.map +1 -0
  28. package/dist/core/whatsapp/index.d.ts +100 -0
  29. package/dist/core/whatsapp/index.js +2 -0
  30. package/dist/core/whatsapp/index.js.map +1 -0
  31. package/dist/{enums-Z1f7QuVx.d.ts → enums-CL4CRQAe.d.ts} +1 -1
  32. package/dist/features/encryption/index.d.ts +4 -4
  33. package/dist/features/flow/index.d.ts +4 -4
  34. package/dist/features/media/index.d.ts +4 -4
  35. package/dist/features/messages/index.d.ts +4 -4
  36. package/dist/features/phone/index.d.ts +4 -4
  37. package/dist/features/profile/index.d.ts +4 -4
  38. package/dist/features/qrCode/index.d.ts +4 -4
  39. package/dist/features/qrCode/index.js +1 -1
  40. package/dist/features/registration/index.d.ts +4 -4
  41. package/dist/features/template/index.d.ts +4 -4
  42. package/dist/features/template/index.js +1 -1
  43. package/dist/features/twoStepVerification/index.d.ts +4 -4
  44. package/dist/features/waba/index.d.ts +4 -4
  45. package/dist/index.d.ts +18 -674
  46. package/dist/index.js +1 -2
  47. package/dist/index.js.map +1 -1
  48. package/dist/shared/types/config.d.ts +1 -1
  49. package/dist/shared/types/enums.d.ts +1 -1
  50. package/package.json +1 -1
  51. package/dist/chunk-FFOE5YKT.js.map +0 -1
  52. package/dist/chunk-XIIJD6SG.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,679 +1,23 @@
1
- import { M as MessageTypesEnum, H as HttpMethodsEnum, S as SDKEnums } from './enums-Z1f7QuVx.js';
2
- export { a as StatusEnum, W as WebhookTypesEnum } from './enums-Z1f7QuVx.js';
1
+ export { EventField, EventHandler, IRequest, IResponse, MessageHandler, MessageStatus, WebhookContact, WebhookEvent, WebhookHandler, WebhookMessage } from './core/webhook/index.js';
2
+ export { A as AudioMediaObject, C as ContactObject, D as DocumentMediaObject, I as ImageMediaObject, a as InteractiveObject, L as LocationObject, b as MessageRequestParams, d as MessageTemplateObject, M as MessagesApi, c as MessagesResponse, R as ReactionParams, S as StatusParams, e as StickerMediaObject, T as TextMessageParams, f as TextObject, V as VideoMediaObject } from './MessageApi-BQhqbAOY.js';
3
3
  import { WhatsAppConfig, WabaConfigType } from './shared/types/config.js';
4
- import { IncomingMessage } from 'http';
5
- import { F as FlowApi, a as FlowEndpointRequest, b as FlowTypeEnum } from './FlowApi-BIBrWYEv.js';
6
- export { c as Flow, d as FlowClass, e as FlowEndpointResponse } from './FlowApi-BIBrWYEv.js';
7
- import { E as EncryptionApi } from './EncryptionApi-CwxQlC-2.js';
8
- import { M as MediaApi } from './MediaApi-VqxndaBJ.js';
9
- export { a as MediaClass, b as MediaResponse, c as MediasResponse, U as UploadMediaResponse } from './MediaApi-VqxndaBJ.js';
10
- import { M as MessagesApi } from './MessageApi-CHc6bn3g.js';
11
- export { A as AudioMediaObject, C as ContactObject, D as DocumentMediaObject, I as ImageMediaObject, a as InteractiveObject, L as LocationObject, b as MessageRequestParams, d as MessageTemplateObject, c as MessagesResponse, R as ReactionParams, S as StatusParams, e as StickerMediaObject, T as TextMessageParams, f as TextObject, V as VideoMediaObject } from './MessageApi-CHc6bn3g.js';
12
- import { P as PhoneNumberApi } from './PhoneNumberApi-C-bs6YAe.js';
13
- export { a as PhoneNumberClass, b as PhoneNumberResponse } from './PhoneNumberApi-C-bs6YAe.js';
14
- import { B as BusinessProfileApi } from './BusinessProfileApi-DDkv2WQK.js';
15
- export { a as BusinessProfileClass, b as BusinessProfileResponse } from './BusinessProfileApi-DDkv2WQK.js';
16
- import { Q as QrCodeApi } from './QrCodeApi-BjlyPUXV.js';
17
- export { a as QrCodeClass, b as QrCodeResponse } from './QrCodeApi-BjlyPUXV.js';
18
- import { R as RegistrationApi } from './RegistrationApi-D7Bg8BUz.js';
19
- export { a as RegistrationClass } from './RegistrationApi-D7Bg8BUz.js';
20
- import { T as TemplateApi } from './TemplateApi-dmZbvMkO.js';
21
- export { a as TemplateClass, b as TemplateResponse } from './TemplateApi-dmZbvMkO.js';
22
- import { T as TwoStepVerificationApi } from './TwoStepVerificationApi-DaYWPjY_.js';
23
- import { W as WabaApi } from './WabaApi-CMoTCWiH.js';
24
- export { b as WABAClass, a as WabaAccount } from './WabaApi-CMoTCWiH.js';
25
- import { Agent } from 'https';
26
- import { R as RequesterClass } from './base-BG2gtoDs.js';
4
+ export { H as HttpMethodsEnum, M as MessageTypesEnum, S as StatusEnum, a as WebhookTypesEnum } from './enums-CL4CRQAe.js';
5
+ export { a as MediaClass, b as MediaResponse, c as MediasResponse, U as UploadMediaResponse } from './MediaApi-C2-eC3BR.js';
6
+ export { B as BusinessProfileApi, a as BusinessProfileClass, e as BusinessProfileResponse } from './BusinessProfileApi-BjOyDR-8.js';
7
+ export { E as EncryptionApi } from './EncryptionApi-B3hzgZwc.js';
8
+ export { a as Flow, F as FlowApi, e as FlowClass, f as FlowEndpointRequest, g as FlowEndpointResponse } from './FlowApi-OEAji2dP.js';
9
+ export { P as PhoneNumberApi, c as PhoneNumberClass, d as PhoneNumberResponse } from './PhoneNumberApi-BgfYrui-.js';
10
+ export { R as RegistrationApi, a as RegistrationClass } from './RegistrationApi-BSDXRJlL.js';
11
+ export { T as TemplateApi, a as TemplateClass, e as TemplateResponse } from './TemplateApi-B7dTBIlN.js';
12
+ export { Q as QrCodeApi, a as QrCodeClass, b as QrCodeResponse } from './QrCodeApi-CimaUuYP.js';
13
+ export { T as TwoStepVerificationApi } from './TwoStepVerificationApi-BY0eD8R2.js';
14
+ export { b as WABAClass, a as WabaAccount, W as WabaApi } from './WabaApi-BFbVUUlw.js';
15
+ import { WhatsApp } from './core/whatsapp/index.js';
27
16
  export { MetaError, isMetaError } from './shared/utils/isMetaError.js';
28
-
29
- /**
30
- * Represents a message received through the webhook
31
- * Based on Meta's documentation: https://developers.facebook.com/docs/whatsapp/cloud-api/webhooks/components#messages-object
32
- */
33
- interface WebhookMessage {
34
- /**
35
- * The message ID
36
- */
37
- id: string;
38
- /**
39
- * The sender's phone number
40
- */
41
- from: string;
42
- /**
43
- * The timestamp of the message
44
- */
45
- timestamp: string;
46
- /**
47
- * The type of message (text, image, etc.)
48
- */
49
- type: MessageTypesEnum;
50
- /**
51
- * The phone number ID that received the message
52
- */
53
- phoneNumberId: string;
54
- /**
55
- * The display phone number that received the message
56
- */
57
- displayPhoneNumber: string;
58
- /**
59
- * The profile name of the sender
60
- */
61
- profileName: string;
62
- /**
63
- * Text object for text messages
64
- */
65
- text?: {
66
- /**
67
- * The text content of the message
68
- */
69
- body: string;
70
- };
71
- /**
72
- * Image object for image messages
73
- */
74
- image?: {
75
- /**
76
- * The image caption (if provided)
77
- */
78
- caption?: string;
79
- /**
80
- * The SHA256 hash of the image
81
- */
82
- sha256?: string;
83
- /**
84
- * The ID for the image
85
- */
86
- id: string;
87
- /**
88
- * The MIME type of the image
89
- */
90
- mime_type: string;
91
- };
92
- /**
93
- * Video object for video messages
94
- */
95
- video?: {
96
- /**
97
- * The video caption (if provided)
98
- */
99
- caption?: string;
100
- /**
101
- * The SHA256 hash of the video
102
- */
103
- sha256?: string;
104
- /**
105
- * The ID for the video
106
- */
107
- id: string;
108
- /**
109
- * The MIME type of the video
110
- */
111
- mime_type: string;
112
- };
113
- /**
114
- * Audio object for audio messages
115
- */
116
- audio?: {
117
- /**
118
- * The ID for the audio file
119
- */
120
- id: string;
121
- /**
122
- * The MIME type of the audio file
123
- */
124
- mime_type: string;
125
- /**
126
- * Whether the audio is a voice message
127
- */
128
- voice?: boolean;
129
- };
130
- /**
131
- * Document object for document messages
132
- */
133
- document?: {
134
- /**
135
- * The document caption (if provided)
136
- */
137
- caption?: string;
138
- /**
139
- * The document filename
140
- */
141
- filename: string;
142
- /**
143
- * The SHA256 hash of the document
144
- */
145
- sha256?: string;
146
- /**
147
- * The ID for the document
148
- */
149
- id: string;
150
- /**
151
- * The MIME type of the document
152
- */
153
- mime_type: string;
154
- };
155
- /**
156
- * Sticker object for sticker messages
157
- */
158
- sticker?: {
159
- /**
160
- * The ID for the sticker
161
- */
162
- id: string;
163
- /**
164
- * Whether this is an animated sticker
165
- */
166
- animated: boolean;
167
- /**
168
- * The MIME type of the sticker
169
- */
170
- mime_type: string;
171
- };
172
- /**
173
- * Reaction object for reaction messages
174
- */
175
- reaction?: {
176
- /**
177
- * The ID of the message being reacted to
178
- */
179
- message_id: string;
180
- /**
181
- * Emoji used for the reaction
182
- */
183
- emoji: string;
184
- };
185
- /**
186
- * Contacts object for contact messages
187
- */
188
- contacts?: Array<{
189
- /**
190
- * The contact's name
191
- */
192
- name: {
193
- /**
194
- * The formatted name
195
- */
196
- formatted_name: string;
197
- /**
198
- * The first name
199
- */
200
- first_name?: string;
201
- /**
202
- * The last name
203
- */
204
- last_name?: string;
205
- /**
206
- * The middle name
207
- */
208
- middle_name?: string;
209
- /**
210
- * The suffix
211
- */
212
- suffix?: string;
213
- /**
214
- * The prefix
215
- */
216
- prefix?: string;
217
- };
218
- /**
219
- * The contact's phone numbers
220
- */
221
- phones?: Array<{
222
- phone: string;
223
- type?: string;
224
- wa_id?: string;
225
- }>;
226
- /**
227
- * The contact's emails
228
- */
229
- emails?: Array<{
230
- email: string;
231
- type?: string;
232
- }>;
233
- /**
234
- * The contact's addresses
235
- */
236
- addresses?: Array<{
237
- street?: string;
238
- city?: string;
239
- state?: string;
240
- zip?: string;
241
- country?: string;
242
- country_code?: string;
243
- type?: string;
244
- }>;
245
- /**
246
- * The contact's organizations
247
- */
248
- org?: {
249
- company?: string;
250
- department?: string;
251
- title?: string;
252
- };
253
- /**
254
- * The contact's URLs
255
- */
256
- urls?: Array<{
257
- url: string;
258
- type?: string;
259
- }>;
260
- /**
261
- * The contact's birthday (YYYY-MM-DD format)
262
- */
263
- birthday?: string;
264
- }>;
265
- /**
266
- * Location object for location messages
267
- */
268
- location?: {
269
- /**
270
- * Latitude of the location
271
- */
272
- latitude: number;
273
- /**
274
- * Longitude of the location
275
- */
276
- longitude: number;
277
- /**
278
- * Name of the location
279
- */
280
- name?: string;
281
- /**
282
- * Address of the location
283
- */
284
- address?: string;
285
- };
286
- /**
287
- * Interactive object for interactive messages
288
- */
289
- interactive?: {
290
- /**
291
- * Type of the interactive message
292
- * Can be: button_reply, list_reply, flow, nfm_reply, etc.
293
- */
294
- type: string;
295
- /**
296
- * ID for the button that was clicked
297
- */
298
- button_reply?: {
299
- id: string;
300
- title: string;
301
- };
302
- /**
303
- * ID for the list item that was selected
304
- */
305
- list_reply?: {
306
- id: string;
307
- title: string;
308
- description?: string;
309
- };
310
- /**
311
- * NFM (No-Code Flow Message) reply data
312
- */
313
- nfm_reply?: {
314
- /**
315
- * Response data in JSON format
316
- */
317
- response_json: string;
318
- /**
319
- * Body text of the reply
320
- */
321
- body: string;
322
- /**
323
- * Name of the flow
324
- */
325
- name: string;
326
- };
327
- };
328
- /**
329
- * System object for system messages (like user phone number changes)
330
- */
331
- system?: {
332
- /**
333
- * The type of system update
334
- */
335
- type: string;
336
- /**
337
- * User's identity if the update is a customer identity change
338
- */
339
- identity?: string;
340
- /**
341
- * Old and new phone numbers if the update is a phone number change
342
- */
343
- customer?: {
344
- /**
345
- * The previous phone number
346
- */
347
- previous_wa_id: string;
348
- /**
349
- * The new phone number
350
- */
351
- wa_id: string;
352
- };
353
- };
354
- /**
355
- * Order object for order messages
356
- */
357
- order?: {
358
- /**
359
- * Catalog ID
360
- */
361
- catalog_id: string;
362
- /**
363
- * Product items in the order
364
- */
365
- product_items: Array<{
366
- /**
367
- * Product ID
368
- */
369
- product_retailer_id: string;
370
- /**
371
- * Quantity of the product
372
- */
373
- quantity: number;
374
- /**
375
- * Item price
376
- */
377
- item_price: number;
378
- /**
379
- * Currency code
380
- */
381
- currency: string;
382
- }>;
383
- /**
384
- * Text message included with the order
385
- */
386
- text?: string;
387
- };
388
- /**
389
- * Context object, included when a user replies or interacts
390
- */
391
- context?: {
392
- /**
393
- * ID of the message
394
- */
395
- id?: string;
396
- /**
397
- * ID of the sender
398
- */
399
- from?: string;
400
- /**
401
- * ID of the message being replied to or interacted with
402
- */
403
- message_id: string;
404
- /**
405
- * ID of the forwarded message, if applicable
406
- */
407
- forwarded?: boolean;
408
- /**
409
- * Frequently forwarded status
410
- */
411
- frequently_forwarded?: boolean;
412
- /**
413
- * Original message information if the message was referred
414
- */
415
- referred_product?: {
416
- /**
417
- * Catalog ID
418
- */
419
- catalog_id: string;
420
- /**
421
- * Product ID
422
- */
423
- product_retailer_id: string;
424
- };
425
- };
426
- /**
427
- * Errors array, if the message had errors
428
- */
429
- errors?: Array<{
430
- /**
431
- * Error code
432
- */
433
- code: number;
434
- /**
435
- * Error title
436
- */
437
- title: string;
438
- /**
439
- * Error message
440
- */
441
- message: string;
442
- /**
443
- * Error details object
444
- */
445
- error_data?: {
446
- /**
447
- * Describes the error details
448
- */
449
- details: string;
450
- };
451
- }>;
452
- /**
453
- * Button object for button messages
454
- */
455
- button?: {
456
- /**
457
- * The payload for the button
458
- */
459
- payload: string;
460
- /**
461
- * Button text
462
- */
463
- text: string;
464
- };
465
- /**
466
- * The original message data as received from the webhook
467
- */
468
- originalData: any;
469
- }
470
- /**
471
- * Webhook event received from WhatsApp
472
- */
473
- interface WebhookEvent {
474
- /**
475
- * The field type of the event
476
- */
477
- field: string;
478
- /**
479
- * The event data
480
- */
481
- value: any;
482
- /**
483
- * The timestamp when the event was received
484
- */
485
- timestamp: number;
486
- }
487
-
488
- type ResponseHeaderValue = string | string[] | undefined;
489
- type ResponseHeaders = Record<string, ResponseHeaderValue>;
490
- type ResponseJSONBody = Record<string, unknown>;
491
- declare class HttpsClientResponseClass {
492
- constructor(resp: Response);
493
- statusCode: () => number;
494
- headers: () => ResponseHeaders;
495
- rawResponse: () => Response;
496
- json: () => Promise<ResponseJSONBody>;
497
- }
498
- declare class HttpsClientClass {
499
- constructor();
500
- clearSockets: () => boolean;
501
- sendRequest: (host: string, path: string, method: HttpMethodsEnum, headers: HeadersInit, timeout: number, body?: BodyInit | null) => Promise<HttpsClientResponseClass>;
502
- }
503
-
504
- declare class WhatsAppClass {
505
- constructor(config?: WhatsAppConfig);
506
- readonly messages: MessagesApi;
507
- readonly templates: TemplateApi;
508
- readonly phoneNumber: PhoneNumberApi;
509
- readonly qrCode: QrCodeApi;
510
- readonly encryption: EncryptionApi;
511
- readonly twoStepVerification: TwoStepVerificationApi;
512
- readonly registration: RegistrationApi;
513
- readonly media: MediaApi;
514
- readonly waba: WabaApi;
515
- readonly flow: FlowApi;
516
- readonly businessProfile: BusinessProfileApi;
517
- updateTimeout(ms: number): boolean;
518
- updatePhoneNumberId(phoneNumberId: number): boolean;
519
- updateAccessToken(accessToken: string): boolean;
520
- updateWabaId(wabaId: string): boolean;
521
- }
522
-
523
- declare class HttpsClient implements HttpsClientClass {
524
- agent: Agent;
525
- constructor();
526
- clearSockets(): boolean;
527
- sendRequest(hostname: string, path: string, method: HttpMethodsEnum, headers: HeadersInit, timeout: number, body?: BodyInit | null): Promise<HttpsClientResponseClass>;
528
- }
17
+ import 'http';
18
+ import './base-B4QLc9vb.js';
19
+ import 'https';
529
20
 
530
21
  declare const importConfig: (inputConfig?: WhatsAppConfig) => WabaConfigType;
531
22
 
532
- declare class Requester implements RequesterClass {
533
- client: Readonly<HttpsClient>;
534
- accessToken: Readonly<string>;
535
- phoneNumberId: Readonly<number>;
536
- businessAcctId: Readonly<string>;
537
- apiVersion: Readonly<string>;
538
- userAgent: Readonly<string>;
539
- host: Readonly<string>;
540
- protocol: Readonly<string>;
541
- constructor(apiVersion: string, phoneNumberId: number, accessToken: string, businessAcctId: string, userAgent: string);
542
- buildHeader(contentType: string, additionalHeaders?: Record<string, string>): HeadersInit;
543
- buildCAPIPath(endpoint: string): string;
544
- sendRequest(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any, contentType?: string, additionalHeaders?: Record<string, string>): Promise<HttpsClientResponseClass>;
545
- getJson<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any, additionalHeaders?: Record<string, string>): Promise<T>;
546
- sendFormData<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: FormData, additionalHeaders?: Record<string, string>): Promise<T>;
547
- sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: Record<string, string>, additionalHeaders?: Record<string, string>): Promise<T>;
548
- }
549
-
550
- declare class WhatsApp implements WhatsAppClass {
551
- config: WabaConfigType;
552
- requester: Readonly<Requester>;
553
- readonly messages: MessagesApi;
554
- readonly templates: TemplateApi;
555
- readonly phoneNumber: PhoneNumberApi;
556
- readonly qrCode: QrCodeApi;
557
- readonly encryption: EncryptionApi;
558
- readonly twoStepVerification: TwoStepVerificationApi;
559
- readonly registration: RegistrationApi;
560
- readonly media: MediaApi;
561
- readonly waba: WabaApi;
562
- readonly flow: FlowApi;
563
- readonly businessProfile: BusinessProfileApi;
564
- static readonly Enums: typeof SDKEnums;
565
- constructor(config?: WhatsAppConfig);
566
- private userAgent;
567
- updateTimeout(ms: number): boolean;
568
- updatePhoneNumberId(phoneNumberId: number): boolean;
569
- updateAccessToken(accessToken: string): boolean;
570
- updateWabaId(wabaId: string): boolean;
571
- }
572
-
573
- interface IRequest extends IncomingMessage {
574
- body: any;
575
- query: Record<string, any>;
576
- method?: string;
577
- }
578
- interface IResponse {
579
- status: (code: number) => IResponse;
580
- send: (body: any) => IResponse | void;
581
- json: (body: any) => IResponse | void;
582
- end: () => void;
583
- }
584
- /**
585
- * Webhook handler for WhatsApp Cloud API
586
- */
587
- declare class WebhookHandler {
588
- private config;
589
- private client;
590
- private messageHandlers;
591
- private eventHandlers;
592
- private preProcessHandler;
593
- private postProcessHandler;
594
- private flowHandlers;
595
- /**
596
- * Create a new WebhookHandler
597
- * @param config The WhatsApp configuration
598
- */
599
- constructor(config: WhatsAppConfig);
600
- /**
601
- * Handle a GET request for webhook verification
602
- */
603
- handleVerificationRequest<Req extends IRequest, Res extends IResponse>(req: Req, res: Res): void;
604
- handleVerificationRequest<Req extends IRequest>(req: Req): string;
605
- /**
606
- * Handle a POST request for webhook events
607
- */
608
- handleWebhookRequest<Req extends IRequest, Res extends IResponse>(req: Req, res: Res): Promise<void>;
609
- handleWebhookRequest<Req extends IRequest>(req: Req): Promise<{
610
- success: boolean;
611
- errors?: string[];
612
- }>;
613
- /**
614
- * Handle webhook requests (both verification and events)
615
- */
616
- handleRequest<Req extends IRequest, Res extends IResponse>(req: Req, res: Res): void | Promise<void>;
617
- handleRequest<Req extends IRequest>(req: Req): string | Promise<{
618
- success: boolean;
619
- errors?: string[];
620
- }>;
621
- /**
622
- * Process incoming messages
623
- */
624
- private processMessages;
625
- /**
626
- * Process other webhook events
627
- */
628
- private processEvent;
629
- /**
630
- * Register a message handler for a specific message type
631
- */
632
- onMessage(type: MessageTypesEnum, handler: (whatsapp: WhatsApp, message: WebhookMessage) => void | Promise<void>): void;
633
- /**
634
- * Register an event handler for a specific field
635
- */
636
- onEvent(field: string, handler: (event: WebhookEvent) => void | Promise<void>): void;
637
- /**
638
- * Register a pre-process handler that runs before all message handlers
639
- */
640
- onMessagePreProcess(handler: (whatsapp: WhatsApp, message: WebhookMessage) => void | Promise<void>): void;
641
- /**
642
- * Register a post-process handler that runs after all message handlers
643
- */
644
- onMessagePostProcess(handler: (whatsapp: WhatsApp, message: WebhookMessage) => void | Promise<void>): void;
645
- handleFlowRequest<Req extends IRequest & {
646
- rawBody: string;
647
- }, Res extends IResponse>(req: Req, res: Res): Promise<void>;
648
- handleFlowRequest<Req extends IRequest & {
649
- rawBody: string;
650
- }>(req: Req): Promise<{
651
- statusCode: number;
652
- body: any;
653
- headers?: Record<string, string>;
654
- }>;
655
- /**
656
- * Validate the request signature
657
- */
658
- isRequestSignatureValid(req: IRequest & {
659
- rawBody: string;
660
- }): boolean;
661
- /**
662
- * Decrypt a flow request
663
- */
664
- decryptRequest(body: any): {
665
- decryptedBody: FlowEndpointRequest;
666
- aesKeyBuffer: Buffer;
667
- initialVectorBuffer: Buffer;
668
- };
669
- /**
670
- * Encrypt a flow response
671
- */
672
- private encryptResponse;
673
- /**
674
- * Register a flow handler for a specific flow type
675
- */
676
- onFlow(type: FlowTypeEnum, handler: (whatsapp: WhatsApp, request: FlowEndpointRequest) => any | Promise<any>): void;
677
- }
678
-
679
- export { BusinessProfileApi, EncryptionApi, FlowApi, FlowEndpointRequest, HttpMethodsEnum, type IRequest, type IResponse, MessageTypesEnum, MessagesApi, PhoneNumberApi, QrCodeApi, RegistrationApi, TemplateApi, TwoStepVerificationApi, WabaApi, WabaConfigType, WebhookHandler, WhatsApp as default, importConfig };
23
+ export { WabaConfigType, WhatsApp as default, importConfig };