meta-cloud-api 0.2.29 → 0.2.31

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 (74) hide show
  1. package/dist/chunk-AQTZR5SI.js +2 -0
  2. package/dist/chunk-AQTZR5SI.js.map +1 -0
  3. package/dist/chunk-EYGUX4EA.js +2 -0
  4. package/dist/chunk-EYGUX4EA.js.map +1 -0
  5. package/dist/{chunk-GT3XQN7Y.js → chunk-FFOE5YKT.js} +2 -2
  6. package/dist/chunk-FFOE5YKT.js.map +1 -0
  7. package/dist/{chunk-R36L2XYO.js → chunk-XIIJD6SG.js} +2 -2
  8. package/dist/chunk-XIIJD6SG.js.map +1 -0
  9. package/dist/features/encryption/index.js +1 -1
  10. package/dist/features/flow/index.js +1 -1
  11. package/dist/features/media/index.js +1 -1
  12. package/dist/features/messages/index.js +1 -1
  13. package/dist/features/phone/index.js +1 -1
  14. package/dist/features/profile/index.js +1 -1
  15. package/dist/features/qrCode/index.js +1 -1
  16. package/dist/features/registration/index.js +1 -1
  17. package/dist/features/template/index.js +1 -1
  18. package/dist/features/twoStepVerification/index.js +1 -1
  19. package/dist/features/waba/index.js +1 -1
  20. package/dist/index.js +2 -1
  21. package/dist/index.js.map +1 -1
  22. package/dist/shared/types/config.js +1 -1
  23. package/dist/shared/types/enums.js +1 -1
  24. package/package.json +2 -1
  25. package/dist/BusinessProfileApi-Dt8jkESv.d.ts +0 -352
  26. package/dist/EncryptionApi-CwGwcpiZ.d.ts +0 -21
  27. package/dist/FlowApi-bENOxS_4.d.ts +0 -471
  28. package/dist/MediaApi-DvAoklbt.d.ts +0 -89
  29. package/dist/MessageApi-vNrieuce.d.ts +0 -591
  30. package/dist/PhoneNumberApi-DiGL3drr.d.ts +0 -141
  31. package/dist/QrCodeApi-BYUCrcp3.d.ts +0 -97
  32. package/dist/RegistrationApi-CS9TCeHz.d.ts +0 -46
  33. package/dist/TemplateApi-DfzQkRxJ.d.ts +0 -117
  34. package/dist/TwoStepVerificationApi-B2pZzlUJ.d.ts +0 -32
  35. package/dist/WabaApi-GGQLjvio.d.ts +0 -174
  36. package/dist/base-DwevK2tJ.d.ts +0 -46
  37. package/dist/chunk-A264MT4Q.js +0 -2
  38. package/dist/chunk-A264MT4Q.js.map +0 -1
  39. package/dist/chunk-GT3XQN7Y.js.map +0 -1
  40. package/dist/chunk-H55VIWDI.js +0 -2
  41. package/dist/chunk-H55VIWDI.js.map +0 -1
  42. package/dist/chunk-HEVRZRB4.js +0 -3
  43. package/dist/chunk-HEVRZRB4.js.map +0 -1
  44. package/dist/chunk-I222VSWK.js +0 -2
  45. package/dist/chunk-I222VSWK.js.map +0 -1
  46. package/dist/chunk-NTQYJXAZ.js +0 -3
  47. package/dist/chunk-NTQYJXAZ.js.map +0 -1
  48. package/dist/chunk-R36L2XYO.js.map +0 -1
  49. package/dist/chunk-SMHCU5MN.js +0 -2
  50. package/dist/chunk-SMHCU5MN.js.map +0 -1
  51. package/dist/chunk-W2U7MN7M.js +0 -2
  52. package/dist/chunk-W2U7MN7M.js.map +0 -1
  53. package/dist/core/webhook/index.d.ts +0 -837
  54. package/dist/core/webhook/index.js +0 -2
  55. package/dist/core/webhook/index.js.map +0 -1
  56. package/dist/core/whatsapp/index.d.ts +0 -100
  57. package/dist/core/whatsapp/index.js +0 -2
  58. package/dist/core/whatsapp/index.js.map +0 -1
  59. package/dist/enums-iedeomKw.d.ts +0 -688
  60. package/dist/features/encryption/index.d.ts +0 -9
  61. package/dist/features/flow/index.d.ts +0 -9
  62. package/dist/features/media/index.d.ts +0 -9
  63. package/dist/features/messages/index.d.ts +0 -9
  64. package/dist/features/phone/index.d.ts +0 -9
  65. package/dist/features/profile/index.d.ts +0 -9
  66. package/dist/features/qrCode/index.d.ts +0 -9
  67. package/dist/features/registration/index.d.ts +0 -9
  68. package/dist/features/template/index.d.ts +0 -9
  69. package/dist/features/twoStepVerification/index.d.ts +0 -9
  70. package/dist/features/waba/index.d.ts +0 -9
  71. package/dist/index.d.ts +0 -21
  72. package/dist/shared/types/config.d.ts +0 -78
  73. package/dist/shared/types/enums.d.ts +0 -1
  74. package/dist/shared/utils/isMetaError.d.ts +0 -21
@@ -1,837 +0,0 @@
1
- import { M as MessageTypesEnum } from '../../enums-iedeomKw.js';
2
- import { c as FlowEndpointRequest, m as FlowTypeEnum } from '../../FlowApi-bENOxS_4.js';
3
- import { WabaConfigType, WhatsAppConfig } from '../../shared/types/config.js';
4
- import { WhatsApp } from '../whatsapp/index.js';
5
- import '../../base-DwevK2tJ.js';
6
- import '../../MessageApi-vNrieuce.js';
7
- import '../../MediaApi-DvAoklbt.js';
8
- import '../../BusinessProfileApi-Dt8jkESv.js';
9
- import '../../EncryptionApi-CwGwcpiZ.js';
10
- import '../../PhoneNumberApi-DiGL3drr.js';
11
- import '../../RegistrationApi-CS9TCeHz.js';
12
- import '../../TemplateApi-DfzQkRxJ.js';
13
- import '../../QrCodeApi-BYUCrcp3.js';
14
- import '../../TwoStepVerificationApi-B2pZzlUJ.js';
15
- import '../../WabaApi-GGQLjvio.js';
16
- import 'https';
17
-
18
- interface WebhookContact {
19
- /**
20
- * WhatsApp ID of the contact. Business can respond to this contact using this ID.
21
- */
22
- wa_id: string;
23
- /**
24
- * Additional unique, alphanumeric identifier for a WhatsApp user
25
- */
26
- user_id?: string;
27
- /**
28
- * Profile of Whatsapp user
29
- */
30
- profile: {
31
- /**
32
- * The display name of the contact
33
- */
34
- name: string;
35
- };
36
- }
37
- /**
38
- * Base message interface with common properties
39
- */
40
- interface BaseMessage {
41
- id: string;
42
- from: string;
43
- timestamp: string;
44
- type: MessageTypesEnum;
45
- /**
46
- * Context object, included when a user replies or interacts
47
- */
48
- context?: {
49
- /**
50
- * ID of the message
51
- */
52
- id?: string;
53
- /**
54
- * ID of the sender
55
- */
56
- from?: string;
57
- /**
58
- * ID of the message being replied to or interacted with
59
- */
60
- message_id: string;
61
- /**
62
- * ID of the forwarded message, if applicable
63
- */
64
- forwarded?: boolean;
65
- /**
66
- * Frequently forwarded status
67
- */
68
- frequently_forwarded?: boolean;
69
- /**
70
- * Original message information if the message was referred
71
- */
72
- referred_product?: {
73
- /**
74
- * Catalog ID
75
- */
76
- catalog_id: string;
77
- /**
78
- * Product ID
79
- */
80
- product_retailer_id: string;
81
- };
82
- };
83
- /**
84
- * Errors array, if the message had errors
85
- */
86
- errors?: Array<{
87
- /**
88
- * Error code
89
- */
90
- code: number;
91
- /**
92
- * Error title
93
- */
94
- title: string;
95
- /**
96
- * Error message
97
- */
98
- message: string;
99
- /**
100
- * Error details object
101
- */
102
- error_data?: {
103
- /**
104
- * Describes the error details
105
- */
106
- details: string;
107
- };
108
- }>;
109
- }
110
- /**
111
- * Text message interface
112
- */
113
- interface TextMessage extends BaseMessage {
114
- type: MessageTypesEnum.Text;
115
- text: {
116
- /**
117
- * The text content of the message
118
- */
119
- body: string;
120
- preview_url?: boolean;
121
- };
122
- }
123
- /**
124
- * Image message interface
125
- */
126
- interface ImageMessage extends BaseMessage {
127
- type: MessageTypesEnum.Image;
128
- image: {
129
- /**
130
- * The image caption (if provided)
131
- */
132
- caption?: string;
133
- /**
134
- * The SHA256 hash of the image
135
- */
136
- sha256?: string;
137
- /**
138
- * The ID for the image
139
- */
140
- id: string;
141
- /**
142
- * The MIME type of the image
143
- */
144
- mime_type: string;
145
- };
146
- }
147
- /**
148
- * Video message interface
149
- */
150
- interface VideoMessage extends BaseMessage {
151
- type: MessageTypesEnum.Video;
152
- video: {
153
- /**
154
- * The video caption (if provided)
155
- */
156
- caption?: string;
157
- /**
158
- * The SHA256 hash of the video
159
- */
160
- sha256?: string;
161
- /**
162
- * The ID for the video
163
- */
164
- id: string;
165
- /**
166
- * The MIME type of the video
167
- */
168
- mime_type: string;
169
- };
170
- }
171
- /**
172
- * Audio message interface
173
- */
174
- interface AudioMessage extends BaseMessage {
175
- type: MessageTypesEnum.Audio;
176
- audio: {
177
- /**
178
- * The ID for the audio file
179
- */
180
- id: string;
181
- /**
182
- * The MIME type of the audio file
183
- */
184
- mime_type: string;
185
- /**
186
- * Whether the audio is a voice message
187
- */
188
- voice?: boolean;
189
- };
190
- }
191
- /**
192
- * Document message interface
193
- */
194
- interface DocumentMessage extends BaseMessage {
195
- type: MessageTypesEnum.Document;
196
- document: {
197
- /**
198
- * The document caption (if provided)
199
- */
200
- caption?: string;
201
- /**
202
- * The document filename
203
- */
204
- filename: string;
205
- /**
206
- * The SHA256 hash of the document
207
- */
208
- sha256?: string;
209
- /**
210
- * The ID for the document
211
- */
212
- id: string;
213
- /**
214
- * The MIME type of the document
215
- */
216
- mime_type: string;
217
- };
218
- }
219
- /**
220
- * Sticker message interface
221
- */
222
- interface StickerMessage extends BaseMessage {
223
- type: MessageTypesEnum.Sticker;
224
- sticker: {
225
- /**
226
- * The ID for the sticker
227
- */
228
- id: string;
229
- /**
230
- * Whether this is an animated sticker
231
- */
232
- animated: boolean;
233
- /**
234
- * The MIME type of the sticker
235
- */
236
- mime_type: string;
237
- };
238
- }
239
- /**
240
- * Reaction message interface
241
- */
242
- interface ReactionMessage extends BaseMessage {
243
- type: MessageTypesEnum.Reaction;
244
- reaction: {
245
- /**
246
- * The ID of the message being reacted to
247
- */
248
- message_id: string;
249
- /**
250
- * Emoji used for the reaction
251
- */
252
- emoji: string;
253
- };
254
- }
255
- /**
256
- * Contacts message interface
257
- */
258
- interface ContactsMessage extends BaseMessage {
259
- type: MessageTypesEnum.Contacts;
260
- contacts: Array<{
261
- /**
262
- * The contact's name
263
- */
264
- name: {
265
- /**
266
- * The formatted name
267
- */
268
- formatted_name: string;
269
- /**
270
- * The first name
271
- */
272
- first_name?: string;
273
- /**
274
- * The last name
275
- */
276
- last_name?: string;
277
- /**
278
- * The middle name
279
- */
280
- middle_name?: string;
281
- /**
282
- * The suffix
283
- */
284
- suffix?: string;
285
- /**
286
- * The prefix
287
- */
288
- prefix?: string;
289
- };
290
- /**
291
- * The contact's phone numbers
292
- */
293
- phones?: Array<{
294
- phone: string;
295
- type?: string;
296
- wa_id?: string;
297
- }>;
298
- /**
299
- * The contact's emails
300
- */
301
- emails?: Array<{
302
- email: string;
303
- type?: string;
304
- }>;
305
- /**
306
- * The contact's addresses
307
- */
308
- addresses?: Array<{
309
- street?: string;
310
- city?: string;
311
- state?: string;
312
- zip?: string;
313
- country?: string;
314
- country_code?: string;
315
- type?: string;
316
- }>;
317
- /**
318
- * The contact's organizations
319
- */
320
- org?: {
321
- company?: string;
322
- department?: string;
323
- title?: string;
324
- };
325
- /**
326
- * The contact's URLs
327
- */
328
- urls?: Array<{
329
- url: string;
330
- type?: string;
331
- }>;
332
- /**
333
- * The contact's birthday (YYYY-MM-DD format)
334
- */
335
- birthday?: string;
336
- }>;
337
- }
338
- /**
339
- * Location message interface
340
- */
341
- interface LocationMessage extends BaseMessage {
342
- type: MessageTypesEnum.Location;
343
- location: {
344
- /**
345
- * Latitude of the location
346
- */
347
- latitude: number;
348
- /**
349
- * Longitude of the location
350
- */
351
- longitude: number;
352
- /**
353
- * Name of the location
354
- */
355
- name?: string;
356
- /**
357
- * Address of the location
358
- */
359
- address?: string;
360
- };
361
- }
362
- /**
363
- * Interactive message interface
364
- */
365
- interface InteractiveMessage extends BaseMessage {
366
- type: MessageTypesEnum.Interactive;
367
- interactive: {
368
- /**
369
- * Type of the interactive message
370
- * Can be: button_reply, list_reply, flow, nfm_reply, etc.
371
- */
372
- type: string;
373
- /**
374
- * ID for the button that was clicked
375
- */
376
- button_reply?: {
377
- id: string;
378
- title: string;
379
- };
380
- /**
381
- * ID for the list item that was selected
382
- */
383
- list_reply?: {
384
- id: string;
385
- title: string;
386
- description?: string;
387
- };
388
- /**
389
- * NFM (No-Code Flow Message) reply data
390
- */
391
- nfm_reply?: {
392
- /**
393
- * Response data in JSON format
394
- */
395
- response_json: string;
396
- /**
397
- * Body text of the reply
398
- */
399
- body: string;
400
- /**
401
- * Name of the flow
402
- */
403
- name: string;
404
- };
405
- };
406
- }
407
- /**
408
- * System message interface
409
- */
410
- interface SystemMessage extends BaseMessage {
411
- type: MessageTypesEnum.System;
412
- system: {
413
- /**
414
- * The type of system update
415
- */
416
- type: string;
417
- /**
418
- * User's identity if the update is a customer identity change
419
- */
420
- identity?: string;
421
- /**
422
- * Old and new phone numbers if the update is a phone number change
423
- */
424
- customer?: {
425
- /**
426
- * The previous phone number
427
- */
428
- previous_wa_id: string;
429
- /**
430
- * The new phone number
431
- */
432
- wa_id: string;
433
- };
434
- };
435
- }
436
- /**
437
- * Order message interface
438
- */
439
- interface OrderMessage extends BaseMessage {
440
- type: MessageTypesEnum.Order;
441
- order: {
442
- /**
443
- * Catalog ID
444
- */
445
- catalog_id: string;
446
- /**
447
- * Product items in the order
448
- */
449
- product_items: Array<{
450
- /**
451
- * Product ID
452
- */
453
- product_retailer_id: string;
454
- /**
455
- * Quantity of the product
456
- */
457
- quantity: number;
458
- /**
459
- * Item price
460
- */
461
- item_price: number;
462
- /**
463
- * Currency code
464
- */
465
- currency: string;
466
- }>;
467
- /**
468
- * Text message included with the order
469
- */
470
- text?: string;
471
- };
472
- }
473
- /**
474
- * Button message interface
475
- */
476
- interface ButtonMessage extends BaseMessage {
477
- type: MessageTypesEnum.Button;
478
- button: {
479
- /**
480
- * The payload for the button
481
- */
482
- payload: string;
483
- /**
484
- * Button text
485
- */
486
- text: string;
487
- };
488
- }
489
- /**
490
- * Union type for all message types
491
- */
492
- type WhatsAppMessage = TextMessage | ImageMessage | VideoMessage | AudioMessage | DocumentMessage | StickerMessage | ReactionMessage | ContactsMessage | LocationMessage | InteractiveMessage | SystemMessage | OrderMessage | ButtonMessage;
493
- interface WebhookMessageValue {
494
- /**
495
- * The messaging product
496
- */
497
- messaging_product: string;
498
- /**
499
- * The metadata
500
- */
501
- metadata: {
502
- /**
503
- * The display phone number of the whatsapp business account
504
- */
505
- display_phone_number: string;
506
- /**
507
- * The phone number ID of the whatsapp business account
508
- */
509
- phone_number_id: string;
510
- };
511
- contacts?: Array<{
512
- profile: {
513
- /**
514
- * The display name of the whatsapp user
515
- */
516
- name: string;
517
- };
518
- /**
519
- * The whatsapp ID of the user
520
- */
521
- wa_id: string;
522
- }>;
523
- messages: Array<{
524
- from: string;
525
- id: string;
526
- timestamp: string;
527
- type: MessageTypesEnum;
528
- text?: TextMessage;
529
- image?: ImageMessage;
530
- video?: VideoMessage;
531
- audio?: AudioMessage;
532
- document?: DocumentMessage;
533
- sticker?: StickerMessage;
534
- location?: LocationMessage;
535
- contacts?: ContactsMessage;
536
- interactive?: InteractiveMessage;
537
- button?: ButtonMessage;
538
- order?: OrderMessage;
539
- system?: SystemMessage;
540
- reaction?: ReactionMessage;
541
- }>;
542
- statuses?: Array<{
543
- /**
544
- * The ID of the message
545
- */
546
- id: string;
547
- /**
548
- * The status of the message
549
- */
550
- status: MessageStatus;
551
- /**
552
- * The timestamp of the message
553
- */
554
- timestamp: string;
555
- /**
556
- * The recipient ID ( phone number of the user )
557
- */
558
- recipient_id: string;
559
- }>;
560
- errors?: Array<{
561
- /**
562
- * The error code
563
- */
564
- code: number;
565
- /**
566
- * The error title
567
- */
568
- title: string;
569
- /**
570
- * The error data
571
- */
572
- error_data?: {
573
- /**
574
- * The error details
575
- */
576
- details: string;
577
- };
578
- }>;
579
- }
580
- /**
581
- * Represents a message received through the webhook
582
- * Based on Meta's documentation: https://developers.facebook.com/docs/whatsapp/cloud-api/webhooks/components#messages-object
583
- */
584
- interface WebhookMessage {
585
- /**
586
- * The WhatsApp Business Account ID
587
- */
588
- wabaId: string;
589
- /**
590
- * The message ID
591
- */
592
- id: string;
593
- /**
594
- * The sender's phone number
595
- */
596
- from: string;
597
- /**
598
- * The timestamp of the message
599
- */
600
- timestamp: string;
601
- /**
602
- * The type of message (text, image, etc.)
603
- */
604
- type: MessageTypesEnum;
605
- /**
606
- * The phone number ID that received the message
607
- */
608
- phoneNumberId: string;
609
- /**
610
- * The display phone number that received the message
611
- */
612
- displayPhoneNumber: string;
613
- /**
614
- * The profile name of the sender
615
- */
616
- profileName: string;
617
- text?: TextMessage;
618
- image?: ImageMessage;
619
- video?: VideoMessage;
620
- audio?: AudioMessage;
621
- document?: DocumentMessage;
622
- sticker?: StickerMessage;
623
- location?: LocationMessage;
624
- contacts?: ContactsMessage;
625
- interactive?: InteractiveMessage;
626
- button?: ButtonMessage;
627
- order?: OrderMessage;
628
- system?: SystemMessage;
629
- statuses?: {
630
- /**
631
- * Arbitrary string included in sent message
632
- */
633
- biz_opaque_callback_data?: string;
634
- /**
635
- * Information about the conversation
636
- */
637
- conversation?: {
638
- /**
639
- * Represents the ID of the conversation the given status notification belongs to
640
- */
641
- id: string;
642
- /**
643
- * Describes conversation category
644
- */
645
- origin: {
646
- /**
647
- * Indicates conversation category. This can also be referred to as a conversation entry point
648
- * - authentication: Conversation opened by business sending template categorized as AUTHENTICATION
649
- * - marketing: Conversation opened by business sending template categorized as MARKETING
650
- * - utility: Conversation opened by business sending template categorized as UTILITY
651
- * - service: Conversation opened by business replying to customer within service window
652
- * - referral_conversion: Free entry point conversation
653
- */
654
- type: 'authentication' | 'marketing' | 'utility' | 'service' | 'referral_conversion';
655
- };
656
- /**
657
- * Date when the conversation expires. Only present for messages with status 'sent'
658
- */
659
- expiration_timestamp?: string;
660
- };
661
- /**
662
- * Array of error objects describing the error
663
- */
664
- errors?: Array<{
665
- /**
666
- * Error code
667
- */
668
- code: number;
669
- /**
670
- * Error code title
671
- */
672
- title: string;
673
- /**
674
- * Error code message
675
- */
676
- message: string;
677
- /**
678
- * Error details object
679
- */
680
- error_data?: {
681
- /**
682
- * Describes the error details
683
- */
684
- details: string;
685
- };
686
- }>;
687
- /**
688
- * The ID for the message that the business sent to a customer
689
- */
690
- id: string;
691
- /**
692
- * Pricing information for the message/conversation
693
- */
694
- pricing?: {
695
- /**
696
- * Indicates if the given message or conversation is billable
697
- * @deprecated This field is deprecated. Visit the WhatsApp Changelog for more information.
698
- */
699
- billable?: boolean;
700
- /**
701
- * Indicates the conversation category:
702
- * - authentication: Authentication conversation
703
- * - authentication_international: Authentication-international conversation
704
- * - marketing: Marketing conversation
705
- * - utility: Utility conversation
706
- * - service: Service conversation
707
- * - referral_conversion: Free entry point conversation
708
- */
709
- category: 'authentication' | 'authentication_international' | 'marketing' | 'utility' | 'service' | 'referral_conversion';
710
- /**
711
- * Type of pricing model used by the business. Current supported value is CBP
712
- */
713
- pricing_model: 'CBP';
714
- };
715
- /**
716
- * The customer's WhatsApp ID. Business can respond to customer using this ID.
717
- * This ID may not match the customer's phone number.
718
- */
719
- recipient_id: string;
720
- /**
721
- * Status of the message:
722
- * - delivered: Message has been delivered
723
- * - read: Message has been read by the customer
724
- * - sent: Message has been sent to the customer
725
- */
726
- status: 'delivered' | 'read' | 'sent';
727
- /**
728
- * Unix timestamp for the status message
729
- */
730
- timestamp: string;
731
- };
732
- /**
733
- * The original message data as received from the webhook
734
- */
735
- originalData: any;
736
- }
737
- /**
738
- * Webhook event received from WhatsApp
739
- */
740
- interface WebhookEvent {
741
- /**
742
- * The field type of the event
743
- */
744
- field: string;
745
- /**
746
- * The event data
747
- */
748
- value: any;
749
- /**
750
- * The timestamp when the event was received
751
- */
752
- timestamp: number;
753
- }
754
- /**
755
- * Message status enum
756
- */
757
- declare enum MessageStatus {
758
- DELIVERED = "delivered",
759
- READ = "read",
760
- SENT = "sent"
761
- }
762
-
763
- interface WebhookRequest {
764
- method: string;
765
- query: Record<string, any>;
766
- body: any;
767
- headers: Record<string, string | string[] | undefined>;
768
- rawBody?: string;
769
- }
770
- interface WebhookResponse {
771
- statusCode: number;
772
- body?: any;
773
- headers?: Record<string, string>;
774
- }
775
- type MessageHandler = (whatsapp: WhatsApp, message: WebhookMessage) => void | Promise<void>;
776
- type FlowHandler = (whatsapp: WhatsApp, request: FlowEndpointRequest) => any | Promise<any>;
777
- /**
778
- * Pure function to handle webhook verification
779
- */
780
- declare function verifyWebhook(request: Pick<WebhookRequest, 'query'>, verificationToken: string): WebhookResponse;
781
- /**
782
- * Pure function to process webhook messages
783
- */
784
- declare function processWebhookMessages(request: WebhookRequest, whatsapp: WhatsApp, handlers: {
785
- messageHandlers: Map<MessageTypesEnum, MessageHandler>;
786
- preProcessHandler?: MessageHandler;
787
- postProcessHandler?: MessageHandler;
788
- }): Promise<WebhookResponse>;
789
- /**
790
- * Pure function to handle flow requests
791
- */
792
- declare function processFlowRequest(request: WebhookRequest, config: WabaConfigType, whatsapp: WhatsApp, flowHandlers: Map<FlowTypeEnum, FlowHandler>): Promise<WebhookResponse>;
793
-
794
- /**
795
- * Framework-agnostic WebhookHandler using pure functions
796
- */
797
- declare class WebhookHandler {
798
- private config;
799
- private client;
800
- private messageHandlers;
801
- private preProcessHandler;
802
- private postProcessHandler;
803
- private flowHandlers;
804
- constructor(config: WhatsAppConfig);
805
- /**
806
- * Handle webhook verification (framework-agnostic)
807
- */
808
- handleVerification: (request: Pick<WebhookRequest, "query">) => WebhookResponse;
809
- /**
810
- * Handle webhook messages (framework-agnostic)
811
- */
812
- handleWebhook: (request: WebhookRequest) => Promise<WebhookResponse>;
813
- /**
814
- * Handle flow requests (framework-agnostic)
815
- */
816
- handleFlow: (request: WebhookRequest) => Promise<WebhookResponse>;
817
- /**
818
- * Register a message handler for a specific message type
819
- */
820
- onMessage(type: MessageTypesEnum, handler: MessageHandler): void;
821
- /**
822
- * Register a pre-process handler that runs before all message handlers
823
- */
824
- onMessagePreProcess(handler: MessageHandler): void;
825
- /**
826
- * Register a post-process handler that runs after all message handlers
827
- */
828
- onMessagePostProcess(handler: MessageHandler): void;
829
- /**
830
- * Register a flow handler for a specific flow type
831
- */
832
- onFlow(type: FlowTypeEnum, handler: FlowHandler): void;
833
- }
834
-
835
- declare const generateXHub256Sig: (body: string, appSecret: string) => string;
836
-
837
- export { type AudioMessage, type BaseMessage, type ButtonMessage, type ContactsMessage, type DocumentMessage, type FlowHandler, type ImageMessage, type InteractiveMessage, type LocationMessage, type MessageHandler, MessageStatus, type OrderMessage, type ReactionMessage, type StickerMessage, type SystemMessage, type TextMessage, type VideoMessage, type WebhookContact, type WebhookEvent, WebhookHandler, type WebhookMessage, type WebhookMessageValue, type WebhookRequest, type WebhookResponse, type WhatsAppMessage, generateXHub256Sig, processFlowRequest, processWebhookMessages, verifyWebhook };