meta-cloud-api 1.0.0 → 1.0.2

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 (138) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +405 -0
  3. package/dist/BusinessProfileApi-WXscSgo-.d.ts +353 -0
  4. package/dist/EncryptionApi-D7pt-OXT.d.ts +22 -0
  5. package/dist/FlowApi-B2ffO-HD.d.ts +136 -0
  6. package/dist/MediaApi-BrEKpqi_.d.ts +90 -0
  7. package/dist/MessageApi-BgsSpDno.d.ts +171 -0
  8. package/dist/PhoneNumberApi-DKlu9PHl.d.ts +142 -0
  9. package/dist/QrCodeApi-7vDwIBHR.d.ts +98 -0
  10. package/dist/RegistrationApi-qO_qoti9.d.ts +47 -0
  11. package/dist/TemplateApi-xGgIZt89.d.ts +161 -0
  12. package/dist/TwoStepVerificationApi-DfNPIz-C.d.ts +33 -0
  13. package/dist/WabaApi-DqQi_68m.d.ts +175 -0
  14. package/dist/WebhookProcessor-BXYunz4N.d.ts +707 -0
  15. package/dist/WhatsApp-pTZPQm81.d.ts +82 -0
  16. package/dist/api/encryption/index.d.ts +10 -0
  17. package/dist/api/encryption/index.js +2 -0
  18. package/dist/api/encryption/index.js.map +1 -0
  19. package/dist/api/flow/index.d.ts +10 -0
  20. package/dist/api/flow/index.js +2 -0
  21. package/dist/api/flow/index.js.map +1 -0
  22. package/dist/api/index.d.ts +17 -0
  23. package/dist/api/index.js +2 -0
  24. package/dist/api/index.js.map +1 -0
  25. package/dist/api/media/index.d.ts +10 -0
  26. package/dist/api/media/index.js +2 -0
  27. package/dist/api/media/index.js.map +1 -0
  28. package/dist/api/messages/builders/index.d.ts +536 -0
  29. package/dist/api/messages/builders/index.js +4 -0
  30. package/dist/api/messages/builders/index.js.map +1 -0
  31. package/dist/api/messages/index.d.ts +10 -0
  32. package/dist/api/messages/index.js +2 -0
  33. package/dist/api/messages/index.js.map +1 -0
  34. package/dist/api/phone/index.d.ts +10 -0
  35. package/dist/api/phone/index.js +2 -0
  36. package/dist/api/phone/index.js.map +1 -0
  37. package/dist/api/profile/index.d.ts +10 -0
  38. package/dist/api/profile/index.js +2 -0
  39. package/dist/api/profile/index.js.map +1 -0
  40. package/dist/api/qrCode/index.d.ts +10 -0
  41. package/dist/api/qrCode/index.js +2 -0
  42. package/dist/api/qrCode/index.js.map +1 -0
  43. package/dist/api/registration/index.d.ts +10 -0
  44. package/dist/api/registration/index.js +2 -0
  45. package/dist/api/registration/index.js.map +1 -0
  46. package/dist/api/template/index.d.ts +215 -0
  47. package/dist/api/template/index.js +2 -0
  48. package/dist/api/template/index.js.map +1 -0
  49. package/dist/api/twoStepVerification/index.d.ts +10 -0
  50. package/dist/api/twoStepVerification/index.js +2 -0
  51. package/dist/api/twoStepVerification/index.js.map +1 -0
  52. package/dist/api/waba/index.d.ts +10 -0
  53. package/dist/api/waba/index.js +2 -0
  54. package/dist/api/waba/index.js.map +1 -0
  55. package/dist/base-CdGDdVEl.d.ts +18 -0
  56. package/dist/chunk-7QBIZCJ4.js +2 -0
  57. package/dist/chunk-7QBIZCJ4.js.map +1 -0
  58. package/dist/chunk-AMHQGG6Z.js +2 -0
  59. package/dist/chunk-AMHQGG6Z.js.map +1 -0
  60. package/dist/chunk-BAOZ4U74.js +10 -0
  61. package/dist/chunk-BAOZ4U74.js.map +1 -0
  62. package/dist/chunk-CRZ7EUYR.js +2 -0
  63. package/dist/chunk-CRZ7EUYR.js.map +1 -0
  64. package/dist/chunk-FKXSL2JK.js +3 -0
  65. package/dist/chunk-FKXSL2JK.js.map +1 -0
  66. package/dist/chunk-FSKBLPGE.js +2 -0
  67. package/dist/chunk-FSKBLPGE.js.map +1 -0
  68. package/dist/chunk-IYSR44P6.js +2 -0
  69. package/dist/chunk-IYSR44P6.js.map +1 -0
  70. package/dist/chunk-JC6YMVID.js +2 -0
  71. package/dist/chunk-JC6YMVID.js.map +1 -0
  72. package/dist/chunk-JPAV644F.js +2 -0
  73. package/dist/chunk-JPAV644F.js.map +1 -0
  74. package/dist/chunk-JPGXONBQ.js +3 -0
  75. package/dist/chunk-JPGXONBQ.js.map +1 -0
  76. package/dist/chunk-JXCLRKQ7.js +2 -0
  77. package/dist/chunk-JXCLRKQ7.js.map +1 -0
  78. package/dist/chunk-KMAH6636.js +2 -0
  79. package/dist/chunk-KMAH6636.js.map +1 -0
  80. package/dist/chunk-L4ESAO2S.js +2 -0
  81. package/dist/chunk-L4ESAO2S.js.map +1 -0
  82. package/dist/chunk-LV3TULSI.js +2 -0
  83. package/dist/chunk-LV3TULSI.js.map +1 -0
  84. package/dist/chunk-MJEG3K4V.js +2 -0
  85. package/dist/chunk-MJEG3K4V.js.map +1 -0
  86. package/dist/chunk-NLF2JGYY.js +2 -0
  87. package/dist/chunk-NLF2JGYY.js.map +1 -0
  88. package/dist/chunk-NOJFGTRT.js +2 -0
  89. package/dist/chunk-NOJFGTRT.js.map +1 -0
  90. package/dist/chunk-PHPQ5HP3.js +2 -0
  91. package/dist/chunk-PHPQ5HP3.js.map +1 -0
  92. package/dist/chunk-RIL6QABY.js +2 -0
  93. package/dist/chunk-RIL6QABY.js.map +1 -0
  94. package/dist/chunk-RWCVPWRC.js +2 -0
  95. package/dist/chunk-RWCVPWRC.js.map +1 -0
  96. package/dist/chunk-SNNRWNGZ.js +2 -0
  97. package/dist/chunk-SNNRWNGZ.js.map +1 -0
  98. package/dist/chunk-VHAODWCN.js +2 -0
  99. package/dist/chunk-VHAODWCN.js.map +1 -0
  100. package/dist/chunk-WGGN32O2.js +2 -0
  101. package/dist/chunk-WGGN32O2.js.map +1 -0
  102. package/dist/chunk-YXZ4L2OK.js +2 -0
  103. package/dist/chunk-YXZ4L2OK.js.map +1 -0
  104. package/dist/common-BiRA_uz3.d.ts +425 -0
  105. package/dist/common-lV0NsO7t.d.ts +376 -0
  106. package/dist/core/webhook/frameworks/express.d.ts +49 -0
  107. package/dist/core/webhook/frameworks/express.js +2 -0
  108. package/dist/core/webhook/frameworks/express.js.map +1 -0
  109. package/dist/core/webhook/frameworks/nextjs.d.ts +45 -0
  110. package/dist/core/webhook/frameworks/nextjs.js +2 -0
  111. package/dist/core/webhook/frameworks/nextjs.js.map +1 -0
  112. package/dist/core/webhook/index.d.ts +27 -0
  113. package/dist/core/webhook/index.js +2 -0
  114. package/dist/core/webhook/index.js.map +1 -0
  115. package/dist/core/whatsapp/index.d.ts +41 -0
  116. package/dist/core/whatsapp/index.js +2 -0
  117. package/dist/core/whatsapp/index.js.map +1 -0
  118. package/dist/enums-BZd9T2ul.d.ts +707 -0
  119. package/dist/flowTypeGuards-B5hBzkZ4.d.ts +43 -0
  120. package/dist/httpsClient-v4gmltzS.d.ts +19 -0
  121. package/dist/index.d.ts +24 -0
  122. package/dist/index.js +2 -0
  123. package/dist/index.js.map +1 -0
  124. package/dist/logger-BdE0Vyim.d.ts +9 -0
  125. package/dist/request-vYMaEfk5.d.ts +50 -0
  126. package/dist/types/config.d.ts +78 -0
  127. package/dist/types/config.js +2 -0
  128. package/dist/types/config.js.map +1 -0
  129. package/dist/types/enums.d.ts +1 -0
  130. package/dist/types/enums.js +2 -0
  131. package/dist/types/enums.js.map +1 -0
  132. package/dist/types/index.d.ts +6 -0
  133. package/dist/types/index.js +2 -0
  134. package/dist/types/index.js.map +1 -0
  135. package/dist/utils/index.d.ts +59 -0
  136. package/dist/utils/index.js +2 -0
  137. package/dist/utils/index.js.map +1 -0
  138. package/package.json +247 -8
@@ -0,0 +1,707 @@
1
+ import { a as FlowEndpointRequest, F as FlowTypeEnum } from './common-lV0NsO7t.js';
2
+ import { WabaConfigType, WhatsAppConfig } from './types/config.js';
3
+ import { M as MessageTypesEnum } from './enums-BZd9T2ul.js';
4
+ import { W as WhatsApp } from './WhatsApp-pTZPQm81.js';
5
+
6
+ interface WebhookContact {
7
+ /**
8
+ * WhatsApp ID of the contact. Business can respond to this contact using this ID.
9
+ */
10
+ wa_id: string;
11
+ /**
12
+ * Additional unique, alphanumeric identifier for a WhatsApp user
13
+ */
14
+ user_id?: string;
15
+ /**
16
+ * Profile of Whatsapp user
17
+ */
18
+ profile: {
19
+ /**
20
+ * The display name of the contact
21
+ */
22
+ name: string;
23
+ };
24
+ }
25
+ /**
26
+ * Base message interface with common properties
27
+ */
28
+ interface BaseMessage {
29
+ id: string;
30
+ from: string;
31
+ timestamp: string;
32
+ type: MessageTypesEnum;
33
+ /**
34
+ * Context object, included when a user replies or interacts
35
+ */
36
+ context?: {
37
+ /**
38
+ * ID of the message
39
+ */
40
+ id?: string;
41
+ /**
42
+ * ID of the sender
43
+ */
44
+ from?: string;
45
+ /**
46
+ * ID of the message being replied to or interacted with
47
+ */
48
+ message_id: string;
49
+ /**
50
+ * ID of the forwarded message, if applicable
51
+ */
52
+ forwarded?: boolean;
53
+ /**
54
+ * Frequently forwarded status
55
+ */
56
+ frequently_forwarded?: boolean;
57
+ /**
58
+ * Original message information if the message was referred
59
+ */
60
+ referred_product?: {
61
+ /**
62
+ * Catalog ID
63
+ */
64
+ catalog_id: string;
65
+ /**
66
+ * Product ID
67
+ */
68
+ product_retailer_id: string;
69
+ };
70
+ };
71
+ /**
72
+ * Errors array, if the message had errors
73
+ */
74
+ errors?: Array<{
75
+ /**
76
+ * Error code
77
+ */
78
+ code: number;
79
+ /**
80
+ * Error title
81
+ */
82
+ title: string;
83
+ /**
84
+ * Error message
85
+ */
86
+ message: string;
87
+ /**
88
+ * Error details object
89
+ */
90
+ error_data?: {
91
+ /**
92
+ * Describes the error details
93
+ */
94
+ details: string;
95
+ };
96
+ }>;
97
+ }
98
+ /**
99
+ * Text message interface
100
+ */
101
+ interface TextMessage extends BaseMessage {
102
+ type: MessageTypesEnum.Text;
103
+ text: {
104
+ /**
105
+ * The text content of the message
106
+ */
107
+ body: string;
108
+ preview_url?: boolean;
109
+ };
110
+ }
111
+ /**
112
+ * Image message interface
113
+ */
114
+ interface ImageMessage extends BaseMessage {
115
+ type: MessageTypesEnum.Image;
116
+ image: {
117
+ /**
118
+ * The image caption (if provided)
119
+ */
120
+ caption?: string;
121
+ /**
122
+ * The SHA256 hash of the image
123
+ */
124
+ sha256?: string;
125
+ /**
126
+ * The ID for the image
127
+ */
128
+ id: string;
129
+ /**
130
+ * The MIME type of the image
131
+ */
132
+ mime_type: string;
133
+ };
134
+ }
135
+ /**
136
+ * Video message interface
137
+ */
138
+ interface VideoMessage extends BaseMessage {
139
+ type: MessageTypesEnum.Video;
140
+ video: {
141
+ /**
142
+ * The video caption (if provided)
143
+ */
144
+ caption?: string;
145
+ /**
146
+ * The SHA256 hash of the video
147
+ */
148
+ sha256?: string;
149
+ /**
150
+ * The ID for the video
151
+ */
152
+ id: string;
153
+ /**
154
+ * The MIME type of the video
155
+ */
156
+ mime_type: string;
157
+ };
158
+ }
159
+ /**
160
+ * Audio message interface
161
+ */
162
+ interface AudioMessage extends BaseMessage {
163
+ type: MessageTypesEnum.Audio;
164
+ audio: {
165
+ /**
166
+ * The ID for the audio file
167
+ */
168
+ id: string;
169
+ /**
170
+ * The MIME type of the audio file
171
+ */
172
+ mime_type: string;
173
+ /**
174
+ * Whether the audio is a voice message
175
+ */
176
+ voice?: boolean;
177
+ };
178
+ }
179
+ /**
180
+ * Document message interface
181
+ */
182
+ interface DocumentMessage extends BaseMessage {
183
+ type: MessageTypesEnum.Document;
184
+ document: {
185
+ /**
186
+ * The document caption (if provided)
187
+ */
188
+ caption?: string;
189
+ /**
190
+ * The document filename
191
+ */
192
+ filename: string;
193
+ /**
194
+ * The SHA256 hash of the document
195
+ */
196
+ sha256?: string;
197
+ /**
198
+ * The ID for the document
199
+ */
200
+ id: string;
201
+ /**
202
+ * The MIME type of the document
203
+ */
204
+ mime_type: string;
205
+ };
206
+ }
207
+ /**
208
+ * Sticker message interface
209
+ */
210
+ interface StickerMessage extends BaseMessage {
211
+ type: MessageTypesEnum.Sticker;
212
+ sticker: {
213
+ /**
214
+ * The ID for the sticker
215
+ */
216
+ id: string;
217
+ /**
218
+ * Whether this is an animated sticker
219
+ */
220
+ animated: boolean;
221
+ /**
222
+ * The MIME type of the sticker
223
+ */
224
+ mime_type: string;
225
+ };
226
+ }
227
+ /**
228
+ * Reaction message interface
229
+ */
230
+ interface ReactionMessage extends BaseMessage {
231
+ type: MessageTypesEnum.Reaction;
232
+ reaction: {
233
+ /**
234
+ * The ID of the message being reacted to
235
+ */
236
+ message_id: string;
237
+ /**
238
+ * Emoji used for the reaction
239
+ */
240
+ emoji: string;
241
+ };
242
+ }
243
+ /**
244
+ * Contacts message interface
245
+ */
246
+ interface ContactsMessage extends BaseMessage {
247
+ type: MessageTypesEnum.Contacts;
248
+ contacts: Array<{
249
+ /**
250
+ * The contact's name
251
+ */
252
+ name: {
253
+ /**
254
+ * The formatted name
255
+ */
256
+ formatted_name: string;
257
+ /**
258
+ * The first name
259
+ */
260
+ first_name?: string;
261
+ /**
262
+ * The last name
263
+ */
264
+ last_name?: string;
265
+ /**
266
+ * The middle name
267
+ */
268
+ middle_name?: string;
269
+ /**
270
+ * The suffix
271
+ */
272
+ suffix?: string;
273
+ /**
274
+ * The prefix
275
+ */
276
+ prefix?: string;
277
+ };
278
+ /**
279
+ * The contact's phone numbers
280
+ */
281
+ phones?: Array<{
282
+ phone: string;
283
+ type?: string;
284
+ wa_id?: string;
285
+ }>;
286
+ /**
287
+ * The contact's emails
288
+ */
289
+ emails?: Array<{
290
+ email: string;
291
+ type?: string;
292
+ }>;
293
+ /**
294
+ * The contact's addresses
295
+ */
296
+ addresses?: Array<{
297
+ street?: string;
298
+ city?: string;
299
+ state?: string;
300
+ zip?: string;
301
+ country?: string;
302
+ country_code?: string;
303
+ type?: string;
304
+ }>;
305
+ /**
306
+ * The contact's organizations
307
+ */
308
+ org?: {
309
+ company?: string;
310
+ department?: string;
311
+ title?: string;
312
+ };
313
+ /**
314
+ * The contact's URLs
315
+ */
316
+ urls?: Array<{
317
+ url: string;
318
+ type?: string;
319
+ }>;
320
+ /**
321
+ * The contact's birthday (YYYY-MM-DD format)
322
+ */
323
+ birthday?: string;
324
+ }>;
325
+ }
326
+ /**
327
+ * Location message interface
328
+ */
329
+ interface LocationMessage extends BaseMessage {
330
+ type: MessageTypesEnum.Location;
331
+ location: {
332
+ /**
333
+ * Latitude of the location
334
+ */
335
+ latitude: number;
336
+ /**
337
+ * Longitude of the location
338
+ */
339
+ longitude: number;
340
+ /**
341
+ * Name of the location
342
+ */
343
+ name?: string;
344
+ /**
345
+ * Address of the location
346
+ */
347
+ address?: string;
348
+ };
349
+ }
350
+ /**
351
+ * Interactive message interface
352
+ */
353
+ interface InteractiveMessage extends BaseMessage {
354
+ type: MessageTypesEnum.Interactive;
355
+ interactive: {
356
+ /**
357
+ * Type of the interactive message
358
+ * Can be: button_reply, list_reply, flow, nfm_reply, etc.
359
+ */
360
+ type: string;
361
+ /**
362
+ * ID for the button that was clicked
363
+ */
364
+ button_reply?: {
365
+ id: string;
366
+ title: string;
367
+ };
368
+ /**
369
+ * ID for the list item that was selected
370
+ */
371
+ list_reply?: {
372
+ id: string;
373
+ title: string;
374
+ description?: string;
375
+ };
376
+ /**
377
+ * NFM (No-Code Flow Message) reply data
378
+ */
379
+ nfm_reply?: {
380
+ /**
381
+ * Response data in JSON format
382
+ */
383
+ response_json: string;
384
+ /**
385
+ * Body text of the reply
386
+ */
387
+ body: string;
388
+ /**
389
+ * Name of the flow
390
+ */
391
+ name: string;
392
+ };
393
+ };
394
+ }
395
+ /**
396
+ * System message interface
397
+ */
398
+ interface SystemMessage extends BaseMessage {
399
+ type: MessageTypesEnum.System;
400
+ system: {
401
+ /**
402
+ * The type of system update
403
+ */
404
+ type: string;
405
+ /**
406
+ * User's identity if the update is a customer identity change
407
+ */
408
+ identity?: string;
409
+ /**
410
+ * Old and new phone numbers if the update is a phone number change
411
+ */
412
+ customer?: {
413
+ /**
414
+ * The previous phone number
415
+ */
416
+ previous_wa_id: string;
417
+ /**
418
+ * The new phone number
419
+ */
420
+ wa_id: string;
421
+ };
422
+ };
423
+ }
424
+ /**
425
+ * Order message interface
426
+ */
427
+ interface OrderMessage extends BaseMessage {
428
+ type: MessageTypesEnum.Order;
429
+ order: {
430
+ /**
431
+ * Catalog ID
432
+ */
433
+ catalog_id: string;
434
+ /**
435
+ * Product items in the order
436
+ */
437
+ product_items: Array<{
438
+ /**
439
+ * Product ID
440
+ */
441
+ product_retailer_id: string;
442
+ /**
443
+ * Quantity of the product
444
+ */
445
+ quantity: number;
446
+ /**
447
+ * Item price
448
+ */
449
+ item_price: number;
450
+ /**
451
+ * Currency code
452
+ */
453
+ currency: string;
454
+ }>;
455
+ /**
456
+ * Text message included with the order
457
+ */
458
+ text?: string;
459
+ };
460
+ }
461
+ /**
462
+ * Button message interface
463
+ */
464
+ interface ButtonMessage extends BaseMessage {
465
+ type: MessageTypesEnum.Button;
466
+ button: {
467
+ /**
468
+ * The payload for the button
469
+ */
470
+ payload: string;
471
+ /**
472
+ * Button text
473
+ */
474
+ text: string;
475
+ };
476
+ }
477
+ /**
478
+ * Represents a message received through the webhook
479
+ * Based on Meta's documentation: https://developers.facebook.com/docs/whatsapp/cloud-api/webhooks/components#messages-object
480
+ */
481
+ interface WebhookMessage {
482
+ /**
483
+ * The WhatsApp Business Account ID
484
+ */
485
+ wabaId: string;
486
+ /**
487
+ * The message ID
488
+ */
489
+ id: string;
490
+ /**
491
+ * The sender's phone number
492
+ */
493
+ from: string;
494
+ /**
495
+ * The timestamp of the message
496
+ */
497
+ timestamp: string;
498
+ /**
499
+ * The type of message (text, image, etc.)
500
+ */
501
+ type: MessageTypesEnum;
502
+ /**
503
+ * The phone number ID that received the message
504
+ */
505
+ phoneNumberId: string;
506
+ /**
507
+ * The display phone number that received the message
508
+ */
509
+ displayPhoneNumber: string;
510
+ /**
511
+ * The profile name of the sender
512
+ */
513
+ profileName: string;
514
+ text?: TextMessage['text'];
515
+ image?: ImageMessage['image'];
516
+ video?: VideoMessage['video'];
517
+ audio?: AudioMessage['audio'];
518
+ document?: DocumentMessage['document'];
519
+ sticker?: StickerMessage['sticker'];
520
+ location?: LocationMessage['location'];
521
+ contacts?: ContactsMessage['contacts'];
522
+ interactive?: InteractiveMessage['interactive'];
523
+ button?: ButtonMessage['button'];
524
+ order?: OrderMessage['order'];
525
+ system?: SystemMessage['system'];
526
+ reaction?: ReactionMessage['reaction'];
527
+ statuses?: {
528
+ /**
529
+ * Arbitrary string included in sent message
530
+ */
531
+ biz_opaque_callback_data?: string;
532
+ /**
533
+ * Information about the conversation
534
+ */
535
+ conversation?: {
536
+ /**
537
+ * Represents the ID of the conversation the given status notification belongs to
538
+ */
539
+ id: string;
540
+ /**
541
+ * Describes conversation category
542
+ */
543
+ origin: {
544
+ /**
545
+ * Indicates conversation category. This can also be referred to as a conversation entry point
546
+ * - authentication: Conversation opened by business sending template categorized as AUTHENTICATION
547
+ * - marketing: Conversation opened by business sending template categorized as MARKETING
548
+ * - utility: Conversation opened by business sending template categorized as UTILITY
549
+ * - service: Conversation opened by business replying to customer within service window
550
+ * - referral_conversion: Free entry point conversation
551
+ */
552
+ type: 'authentication' | 'marketing' | 'utility' | 'service' | 'referral_conversion';
553
+ };
554
+ /**
555
+ * Date when the conversation expires. Only present for messages with status 'sent'
556
+ */
557
+ expiration_timestamp?: string;
558
+ };
559
+ /**
560
+ * Array of error objects describing the error
561
+ */
562
+ errors?: Array<{
563
+ /**
564
+ * Error code
565
+ */
566
+ code: number;
567
+ /**
568
+ * Error code title
569
+ */
570
+ title: string;
571
+ /**
572
+ * Error code message
573
+ */
574
+ message: string;
575
+ /**
576
+ * Error details object
577
+ */
578
+ error_data?: {
579
+ /**
580
+ * Describes the error details
581
+ */
582
+ details: string;
583
+ };
584
+ }>;
585
+ /**
586
+ * The ID for the message that the business sent to a customer
587
+ */
588
+ id: string;
589
+ /**
590
+ * Pricing information for the message/conversation
591
+ */
592
+ pricing?: {
593
+ /**
594
+ * Indicates if the given message or conversation is billable
595
+ * @deprecated This field is deprecated. Visit the WhatsApp Changelog for more information.
596
+ */
597
+ billable?: boolean;
598
+ /**
599
+ * Indicates the conversation category:
600
+ * - authentication: Authentication conversation
601
+ * - authentication_international: Authentication-international conversation
602
+ * - marketing: Marketing conversation
603
+ * - utility: Utility conversation
604
+ * - service: Service conversation
605
+ * - referral_conversion: Free entry point conversation
606
+ */
607
+ category: 'authentication' | 'authentication_international' | 'marketing' | 'utility' | 'service' | 'referral_conversion';
608
+ /**
609
+ * Type of pricing model used by the business. Current supported value is CBP
610
+ */
611
+ pricing_model: 'CBP';
612
+ };
613
+ /**
614
+ * The customer's WhatsApp ID. Business can respond to customer using this ID.
615
+ * This ID may not match the customer's phone number.
616
+ */
617
+ recipient_id: string;
618
+ /**
619
+ * Status of the message:
620
+ * - delivered: Message has been delivered
621
+ * - read: Message has been read by the customer
622
+ * - sent: Message has been sent to the customer
623
+ */
624
+ status: 'delivered' | 'read' | 'sent';
625
+ /**
626
+ * Unix timestamp for the status message
627
+ */
628
+ timestamp: string;
629
+ };
630
+ /**
631
+ * The original message data as received from the webhook
632
+ */
633
+ originalData: any;
634
+ }
635
+ /**
636
+ * Webhook event received from WhatsApp
637
+ */
638
+ interface WebhookEvent {
639
+ /**
640
+ * The field type of the event
641
+ */
642
+ field: string;
643
+ /**
644
+ * The event data
645
+ */
646
+ value: any;
647
+ /**
648
+ * The timestamp when the event was received
649
+ */
650
+ timestamp: number;
651
+ }
652
+ /**
653
+ * Message status enum
654
+ */
655
+ declare enum MessageStatus {
656
+ DELIVERED = "delivered",
657
+ READ = "read",
658
+ SENT = "sent"
659
+ }
660
+
661
+ type MessageHandler = (whatsapp: WhatsApp, message: WebhookMessage) => void | Promise<void>;
662
+ type FlowHandler = (whatsapp: WhatsApp, request: FlowEndpointRequest) => any | Promise<any>;
663
+ /**
664
+ * Process webhook messages
665
+ */
666
+ declare function processWebhookMessages(request: Request, whatsapp: WhatsApp, handlers: {
667
+ messageHandlers: Map<MessageTypesEnum, MessageHandler>;
668
+ preProcessHandler?: MessageHandler;
669
+ postProcessHandler?: MessageHandler;
670
+ }): Promise<Response>;
671
+ /**
672
+ * Handle flow requests
673
+ */
674
+ declare function processFlowRequest(request: Request, config: WabaConfigType, whatsapp: WhatsApp, flowHandlers: Map<FlowTypeEnum, FlowHandler>): Promise<Response>;
675
+ /**
676
+ * Constructs a full URL from framework-specific request headers and URL
677
+ * @param headers - Request headers containing host and protocol information
678
+ * @param url - Relative URL path
679
+ * @returns Full URL string
680
+ */
681
+ declare function constructFullUrl(headers: Record<string, string | string[] | undefined>, url?: string): string;
682
+
683
+ interface WebhookResponse {
684
+ status: number;
685
+ body: string;
686
+ headers: Record<string, string>;
687
+ }
688
+ declare class WebhookProcessor {
689
+ private config;
690
+ private client;
691
+ private messageHandlers;
692
+ private preProcessHandler;
693
+ private postProcessHandler;
694
+ private flowHandlers;
695
+ constructor(config: WhatsAppConfig);
696
+ processVerification(mode: string | null, token: string | null, challenge: string | null): Promise<WebhookResponse>;
697
+ processWebhook(request: Request): Promise<WebhookResponse>;
698
+ processFlow(request: Request): Promise<WebhookResponse>;
699
+ onMessage(type: MessageTypesEnum, handler: MessageHandler): void;
700
+ onMessagePreProcess(handler: MessageHandler): void;
701
+ onMessagePostProcess(handler: MessageHandler): void;
702
+ onFlow(type: FlowTypeEnum, handler: FlowHandler): void;
703
+ getClient(): WhatsApp;
704
+ getConfig(): WabaConfigType;
705
+ }
706
+
707
+ export { type FlowHandler as F, MessageStatus as M, type WebhookContact as W, type WebhookEvent as a, type WebhookMessage as b, WebhookProcessor as c, type WebhookResponse as d, type MessageHandler as e, processFlowRequest as f, constructFullUrl as g, processWebhookMessages as p };