meta-cloud-api 0.2.30 → 0.2.33

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 (73) hide show
  1. package/dist/{BusinessProfileApi-Dt8jkESv.d.ts → BusinessProfileApi-DDkv2WQK.d.ts} +2 -2
  2. package/dist/{EncryptionApi-CwGwcpiZ.d.ts → EncryptionApi-CwxQlC-2.d.ts} +1 -1
  3. package/dist/{FlowApi-bENOxS_4.d.ts → FlowApi-C5-2BGAw.d.ts} +38 -2
  4. package/dist/{MediaApi-DvAoklbt.d.ts → MediaApi-VqxndaBJ.d.ts} +2 -2
  5. package/dist/{MessageApi-vNrieuce.d.ts → MessageApi-CHc6bn3g.d.ts} +2 -2
  6. package/dist/{PhoneNumberApi-DiGL3drr.d.ts → PhoneNumberApi-C-bs6YAe.d.ts} +1 -1
  7. package/dist/{QrCodeApi-BYUCrcp3.d.ts → QrCodeApi-BjlyPUXV.d.ts} +1 -1
  8. package/dist/{RegistrationApi-CS9TCeHz.d.ts → RegistrationApi-D7Bg8BUz.d.ts} +2 -2
  9. package/dist/{TemplateApi-DfzQkRxJ.d.ts → TemplateApi-dmZbvMkO.d.ts} +2 -2
  10. package/dist/{TwoStepVerificationApi-B2pZzlUJ.d.ts → TwoStepVerificationApi-DaYWPjY_.d.ts} +1 -1
  11. package/dist/{WabaApi-GGQLjvio.d.ts → WabaApi-CMoTCWiH.d.ts} +1 -1
  12. package/dist/{base-DwevK2tJ.d.ts → base-BG2gtoDs.d.ts} +2 -2
  13. package/dist/chunk-AQTZR5SI.js +2 -0
  14. package/dist/chunk-AQTZR5SI.js.map +1 -0
  15. package/dist/chunk-EYGUX4EA.js +2 -0
  16. package/dist/chunk-EYGUX4EA.js.map +1 -0
  17. package/dist/{chunk-GT3XQN7Y.js → chunk-FFOE5YKT.js} +2 -2
  18. package/dist/chunk-FFOE5YKT.js.map +1 -0
  19. package/dist/{chunk-R36L2XYO.js → chunk-XIIJD6SG.js} +2 -2
  20. package/dist/chunk-XIIJD6SG.js.map +1 -0
  21. package/dist/{enums-iedeomKw.d.ts → enums-Z1f7QuVx.d.ts} +1 -2
  22. package/dist/features/encryption/index.d.ts +4 -4
  23. package/dist/features/encryption/index.js +1 -1
  24. package/dist/features/flow/index.d.ts +4 -4
  25. package/dist/features/flow/index.js +1 -1
  26. package/dist/features/media/index.d.ts +4 -4
  27. package/dist/features/media/index.js +1 -1
  28. package/dist/features/messages/index.d.ts +4 -4
  29. package/dist/features/messages/index.js +1 -1
  30. package/dist/features/phone/index.d.ts +4 -4
  31. package/dist/features/phone/index.js +1 -1
  32. package/dist/features/profile/index.d.ts +4 -4
  33. package/dist/features/profile/index.js +1 -1
  34. package/dist/features/qrCode/index.d.ts +4 -4
  35. package/dist/features/qrCode/index.js +1 -1
  36. package/dist/features/registration/index.d.ts +4 -4
  37. package/dist/features/registration/index.js +1 -1
  38. package/dist/features/template/index.d.ts +4 -4
  39. package/dist/features/template/index.js +1 -1
  40. package/dist/features/twoStepVerification/index.d.ts +4 -4
  41. package/dist/features/twoStepVerification/index.js +1 -1
  42. package/dist/features/waba/index.d.ts +4 -4
  43. package/dist/features/waba/index.js +1 -1
  44. package/dist/index.d.ts +719 -21
  45. package/dist/index.js +2 -1
  46. package/dist/index.js.map +1 -1
  47. package/dist/shared/types/config.d.ts +1 -1
  48. package/dist/shared/types/config.js +1 -1
  49. package/dist/shared/types/enums.d.ts +1 -1
  50. package/dist/shared/types/enums.js +1 -1
  51. package/package.json +2 -1
  52. package/dist/chunk-A264MT4Q.js +0 -2
  53. package/dist/chunk-A264MT4Q.js.map +0 -1
  54. package/dist/chunk-GT3XQN7Y.js.map +0 -1
  55. package/dist/chunk-H55VIWDI.js +0 -2
  56. package/dist/chunk-H55VIWDI.js.map +0 -1
  57. package/dist/chunk-HEVRZRB4.js +0 -3
  58. package/dist/chunk-HEVRZRB4.js.map +0 -1
  59. package/dist/chunk-I222VSWK.js +0 -2
  60. package/dist/chunk-I222VSWK.js.map +0 -1
  61. package/dist/chunk-R36L2XYO.js.map +0 -1
  62. package/dist/chunk-SMHCU5MN.js +0 -2
  63. package/dist/chunk-SMHCU5MN.js.map +0 -1
  64. package/dist/chunk-TEJIY4ZS.js +0 -3
  65. package/dist/chunk-TEJIY4ZS.js.map +0 -1
  66. package/dist/chunk-W2U7MN7M.js +0 -2
  67. package/dist/chunk-W2U7MN7M.js.map +0 -1
  68. package/dist/core/webhook/index.d.ts +0 -820
  69. package/dist/core/webhook/index.js +0 -2
  70. package/dist/core/webhook/index.js.map +0 -1
  71. package/dist/core/whatsapp/index.d.ts +0 -100
  72. package/dist/core/whatsapp/index.js +0 -2
  73. package/dist/core/whatsapp/index.js.map +0 -1
@@ -1,820 +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<WhatsAppMessage>;
524
- statuses?: Array<{
525
- /**
526
- * The ID of the message
527
- */
528
- id: string;
529
- /**
530
- * The status of the message
531
- */
532
- status: MessageStatus;
533
- /**
534
- * The timestamp of the message
535
- */
536
- timestamp: string;
537
- /**
538
- * The recipient ID ( phone number of the user )
539
- */
540
- recipient_id: string;
541
- }>;
542
- errors?: Array<{
543
- /**
544
- * The error code
545
- */
546
- code: number;
547
- /**
548
- * The error title
549
- */
550
- title: string;
551
- /**
552
- * The error data
553
- */
554
- error_data?: {
555
- /**
556
- * The error details
557
- */
558
- details: string;
559
- };
560
- }>;
561
- }
562
- /**
563
- * Represents a message received through the webhook
564
- * Based on Meta's documentation: https://developers.facebook.com/docs/whatsapp/cloud-api/webhooks/components#messages-object
565
- */
566
- interface WebhookMessage {
567
- /**
568
- * The WhatsApp Business Account ID
569
- */
570
- wabaId: string;
571
- /**
572
- * The message ID
573
- */
574
- id: string;
575
- /**
576
- * The sender's phone number
577
- */
578
- from: string;
579
- /**
580
- * The timestamp of the message
581
- */
582
- timestamp: string;
583
- /**
584
- * The type of message (text, image, etc.)
585
- */
586
- type: MessageTypesEnum;
587
- /**
588
- * The phone number ID that received the message
589
- */
590
- phoneNumberId: string;
591
- /**
592
- * The display phone number that received the message
593
- */
594
- displayPhoneNumber: string;
595
- /**
596
- * The profile name of the sender
597
- */
598
- profileName: string;
599
- text?: TextMessage['text'];
600
- image?: ImageMessage['image'];
601
- video?: VideoMessage['video'];
602
- audio?: AudioMessage['audio'];
603
- document?: DocumentMessage['document'];
604
- sticker?: StickerMessage['sticker'];
605
- location?: LocationMessage['location'];
606
- contacts?: ContactsMessage['contacts'];
607
- interactive?: InteractiveMessage['interactive'];
608
- button?: ButtonMessage['button'];
609
- order?: OrderMessage['order'];
610
- system?: SystemMessage['system'];
611
- reaction?: ReactionMessage['reaction'];
612
- statuses?: {
613
- /**
614
- * Arbitrary string included in sent message
615
- */
616
- biz_opaque_callback_data?: string;
617
- /**
618
- * Information about the conversation
619
- */
620
- conversation?: {
621
- /**
622
- * Represents the ID of the conversation the given status notification belongs to
623
- */
624
- id: string;
625
- /**
626
- * Describes conversation category
627
- */
628
- origin: {
629
- /**
630
- * Indicates conversation category. This can also be referred to as a conversation entry point
631
- * - authentication: Conversation opened by business sending template categorized as AUTHENTICATION
632
- * - marketing: Conversation opened by business sending template categorized as MARKETING
633
- * - utility: Conversation opened by business sending template categorized as UTILITY
634
- * - service: Conversation opened by business replying to customer within service window
635
- * - referral_conversion: Free entry point conversation
636
- */
637
- type: 'authentication' | 'marketing' | 'utility' | 'service' | 'referral_conversion';
638
- };
639
- /**
640
- * Date when the conversation expires. Only present for messages with status 'sent'
641
- */
642
- expiration_timestamp?: string;
643
- };
644
- /**
645
- * Array of error objects describing the error
646
- */
647
- errors?: Array<{
648
- /**
649
- * Error code
650
- */
651
- code: number;
652
- /**
653
- * Error code title
654
- */
655
- title: string;
656
- /**
657
- * Error code message
658
- */
659
- message: string;
660
- /**
661
- * Error details object
662
- */
663
- error_data?: {
664
- /**
665
- * Describes the error details
666
- */
667
- details: string;
668
- };
669
- }>;
670
- /**
671
- * The ID for the message that the business sent to a customer
672
- */
673
- id: string;
674
- /**
675
- * Pricing information for the message/conversation
676
- */
677
- pricing?: {
678
- /**
679
- * Indicates if the given message or conversation is billable
680
- * @deprecated This field is deprecated. Visit the WhatsApp Changelog for more information.
681
- */
682
- billable?: boolean;
683
- /**
684
- * Indicates the conversation category:
685
- * - authentication: Authentication conversation
686
- * - authentication_international: Authentication-international conversation
687
- * - marketing: Marketing conversation
688
- * - utility: Utility conversation
689
- * - service: Service conversation
690
- * - referral_conversion: Free entry point conversation
691
- */
692
- category: 'authentication' | 'authentication_international' | 'marketing' | 'utility' | 'service' | 'referral_conversion';
693
- /**
694
- * Type of pricing model used by the business. Current supported value is CBP
695
- */
696
- pricing_model: 'CBP';
697
- };
698
- /**
699
- * The customer's WhatsApp ID. Business can respond to customer using this ID.
700
- * This ID may not match the customer's phone number.
701
- */
702
- recipient_id: string;
703
- /**
704
- * Status of the message:
705
- * - delivered: Message has been delivered
706
- * - read: Message has been read by the customer
707
- * - sent: Message has been sent to the customer
708
- */
709
- status: 'delivered' | 'read' | 'sent';
710
- /**
711
- * Unix timestamp for the status message
712
- */
713
- timestamp: string;
714
- };
715
- /**
716
- * The original message data as received from the webhook
717
- */
718
- originalData: any;
719
- }
720
- /**
721
- * Webhook event received from WhatsApp
722
- */
723
- interface WebhookEvent {
724
- /**
725
- * The field type of the event
726
- */
727
- field: string;
728
- /**
729
- * The event data
730
- */
731
- value: any;
732
- /**
733
- * The timestamp when the event was received
734
- */
735
- timestamp: number;
736
- }
737
- /**
738
- * Message status enum
739
- */
740
- declare enum MessageStatus {
741
- DELIVERED = "delivered",
742
- READ = "read",
743
- SENT = "sent"
744
- }
745
-
746
- interface WebhookRequest {
747
- method: string;
748
- query: Record<string, any>;
749
- body: any;
750
- headers: Record<string, string | string[] | undefined>;
751
- rawBody?: string;
752
- }
753
- interface WebhookResponse {
754
- statusCode: number;
755
- body?: any;
756
- headers?: Record<string, string>;
757
- }
758
- type MessageHandler = (whatsapp: WhatsApp, message: WebhookMessage) => void | Promise<void>;
759
- type FlowHandler = (whatsapp: WhatsApp, request: FlowEndpointRequest) => any | Promise<any>;
760
- /**
761
- * Pure function to handle webhook verification
762
- */
763
- declare function verifyWebhook(request: Pick<WebhookRequest, 'query'>, verificationToken: string): WebhookResponse;
764
- /**
765
- * Pure function to process webhook messages
766
- */
767
- declare function processWebhookMessages(request: WebhookRequest, whatsapp: WhatsApp, handlers: {
768
- messageHandlers: Map<MessageTypesEnum, MessageHandler>;
769
- preProcessHandler?: MessageHandler;
770
- postProcessHandler?: MessageHandler;
771
- }): Promise<WebhookResponse>;
772
- /**
773
- * Pure function to handle flow requests
774
- */
775
- declare function processFlowRequest(request: WebhookRequest, config: WabaConfigType, whatsapp: WhatsApp, flowHandlers: Map<FlowTypeEnum, FlowHandler>): Promise<WebhookResponse>;
776
-
777
- /**
778
- * Framework-agnostic WebhookHandler using pure functions
779
- */
780
- declare class WebhookHandler {
781
- private config;
782
- private client;
783
- private messageHandlers;
784
- private preProcessHandler;
785
- private postProcessHandler;
786
- private flowHandlers;
787
- constructor(config: WhatsAppConfig);
788
- /**
789
- * Handle webhook verification (framework-agnostic)
790
- */
791
- handleVerification: (request: Pick<WebhookRequest, "query">) => WebhookResponse;
792
- /**
793
- * Handle webhook messages (framework-agnostic)
794
- */
795
- handleWebhook: (request: WebhookRequest) => Promise<WebhookResponse>;
796
- /**
797
- * Handle flow requests (framework-agnostic)
798
- */
799
- handleFlow: (request: WebhookRequest) => Promise<WebhookResponse>;
800
- /**
801
- * Register a message handler for a specific message type
802
- */
803
- onMessage(type: MessageTypesEnum, handler: MessageHandler): void;
804
- /**
805
- * Register a pre-process handler that runs before all message handlers
806
- */
807
- onMessagePreProcess(handler: MessageHandler): void;
808
- /**
809
- * Register a post-process handler that runs after all message handlers
810
- */
811
- onMessagePostProcess(handler: MessageHandler): void;
812
- /**
813
- * Register a flow handler for a specific flow type
814
- */
815
- onFlow(type: FlowTypeEnum, handler: FlowHandler): void;
816
- }
817
-
818
- declare const generateXHub256Sig: (body: string, appSecret: string) => string;
819
-
820
- 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 };