meta-cloud-api 1.1.8 → 1.1.10

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.
package/dist/index.d.ts CHANGED
@@ -1,404 +1,3984 @@
1
- import { AccountMode, AudioMediaObject, AudioMediaTypesEnum, AuthenticationTemplateOptions, BaseAPI, BaseClass, BodyOptions, BusinessProfileClass, BusinessProfileData, BusinessProfileField, BusinessProfileFieldsParam, BusinessProfileResponse, BusinessVerticalEnum, ButtonOptions, ButtonPositionEnum, CarouselCard, CarouselOptions, CatalogButton, CatalogTemplateOptions, CategoryEnum, CodeVerificationStatus, ComponentTypes, ComponentTypesEnum, ContactObject, ConversationTypesEnum, CopyCodeButton, CouponTemplateOptions, CreateFlowResponse, CreateQrCodeRequest, CurrencyCodesEnum, CurrencyParameter, Cursors, DataLocalizationRegionEnum, DateTimeParameter, DocumentMediaObject, DocumentMediaTypesEnum, EncryptionClass, EncryptionPublicKeyResponse, Flow, FlowActionEnum, FlowAsset, FlowAssetsResponse, FlowButton, FlowCategoryEnum, FlowClass, FlowDataExchangeRequest, FlowDataExchangeResponse, FlowDecryptedRequestResponse, FlowEncryptedRequestPayload, FlowEndpointRequest, FlowEndpointResponse, FlowErrorNotificationRequest, FlowErrorNotificationResponse, FlowHealthCheckRequest, FlowHealthCheckResponse, FlowHttpRequest, FlowMigrationFailure, FlowMigrationResponse, FlowMigrationResult, FlowPreview, FlowPreviewResponse, FlowStatusEnum, FlowSuccessScreenResponse, FlowType, FlowTypeEnum, FlowValidationError, FlowValidationErrorPointer, FlowsListResponse, FooterOptions, GeneralHeaderInterface, GeneralMessageBody, GeneralRequestBody, HeaderOptions, HealthStatus, HealthStatusEntity, HttpMethodsEnum, HttpsClientClass, HttpsClientResponseClass, ImageMediaObject, ImageMediaTypesEnum, InteractiveObject, InteractiveTypesEnum, LanguagesEnum, LimitedTimeOfferOptions, LimitedTimeOfferTemplateOptions, LocationObject, LocationParameter, LoggerInterface, MPMButton, MPMTemplateOptions, MediaCardCarouselTemplateOptions, MediaCarouselCard, MediaClass, MediaParameter, MediaResponse, MediasResponse, MessageRequestBody, MessageRequestParams, MessageTemplateObject, MessageTypesEnum, MessagesClass, MessagesResponse, MessagingLimitTier, MetaError, OTPButton, OTPTemplateOptions, Pagination, PaginationCursors, Paging, ParametersTypesEnum, PhoneNumberButton, PhoneNumberClass, PhoneNumberResponse, PhoneNumbersResponse, PlatformType, ProductCardCarouselTemplateOptions, ProductCarouselCard, ProductParameter, ProductSection, QrCodeClass, QrCodeResponse, QrCodesResponse, QualityRating, QualityScore, QuickReplyButton, ReactionParams, ReferralSourceTypesEnum, RegistrationClass, RegistrationRequest, RequestCodeMethodsEnum, RequestVerificationCodeRequest, RequesterClass, RequesterResponseInterface, ResponseData, ResponseHeaderValue, ResponseHeaders, ResponseJSONBody, ResponsePagination, ResponseSuccess, SPMButton, SPMTemplateOptions, StatusEnum, StatusParams, StickerMediaObject, StickerMediaTypesEnum, SubTypeEnum, SystemChangeTypesEnum, TemplateBody, TemplateButton, TemplateButtons, TemplateCarousel, TemplateClass, TemplateDeleteParams, TemplateFooter, TemplateFormat, TemplateGetParams, TemplateHeader, TemplateHeaderExample, TemplateLimitedTimeOffer, TemplateOptions, TemplateParameter, TemplateRequestBody, TemplateResponse, TemplateStatusEnum, TextMessageParams, TextObject, TextParameter, Throughput, ThroughputLevel, TwoStepVerificationClass, TwoStepVerificationParams, TwoStepVerificationRequest, URLButton, UpdateBusinessProfileRequest, UpdateFlowResponse, UpdateQrCodeRequest, UpdateWabaSubscription, UploadBusinessProfileResponse, UploadHandle, UploadMediaResponse, UploadSessionResponse, ValidateFlowJsonResponse, VerifyCodeRequest, VideoMediaObject, VideoMediaTypesEnum, WABAClass, WabaAccount, WabaAccountFields, WabaAccountFieldsParam, WabaAccountReviewStatus, WabaAccountStatus, WabaBusinessVerificationStatus, WabaConfigEnum, WabaConfigType, WabaHealthStatus, WabaHealthStatusCanSendMessage, WabaHealthStatusEntity, WabaHealthStatusError, WabaSubscription, WabaSubscriptions, WebhookContact, WebhookEvent, WebhookMessage, WebhookTypesEnum, WhatsAppConfig, enums_d_exports, isMetaError } from "./index-C37I1sT7.js";
2
1
  import { Agent } from "https";
3
2
 
4
- //#region src/utils/http/httpsClient.d.ts
5
- declare class HttpsClient implements HttpsClientClass {
6
- agent: Agent;
3
+ //#region src/types/enums.d.ts
4
+ declare namespace enums_d_exports {
5
+ export { AudioMediaTypesEnum, BusinessVerticalEnum, ButtonPositionEnum, CategoryEnum, ComponentTypesEnum, ConversationTypesEnum, CurrencyCodesEnum, DataLocalizationRegionEnum, DocumentMediaTypesEnum, HttpMethodsEnum, ImageMediaTypesEnum, InteractiveTypesEnum, LanguagesEnum, MessageTypesEnum, ParametersTypesEnum, ReferralSourceTypesEnum, RequestCodeMethodsEnum, StatusEnum, StickerMediaTypesEnum, SubTypeEnum, SystemChangeTypesEnum, TemplateStatusEnum, VideoMediaTypesEnum, WabaConfigEnum, WebhookTypesEnum };
6
+ }
7
+ declare enum CategoryEnum {
8
+ Authentication = "AUTHENTICATION",
9
+ Marketing = "MARKETING",
10
+ Utility = "UTILITY",
11
+ }
12
+ declare enum TemplateStatusEnum {
13
+ Approved = "APPROVED",
14
+ Pending = "PENDING",
15
+ Rejected = "REJECTED",
16
+ }
17
+ declare enum HttpMethodsEnum {
18
+ Get = "GET",
19
+ Post = "POST",
20
+ Put = "PUT",
21
+ Delete = "DELETE",
22
+ }
23
+ declare enum MessageTypesEnum {
24
+ Audio = "audio",
25
+ Contacts = "contacts",
26
+ Document = "document",
27
+ Image = "image",
28
+ Interactive = "interactive",
29
+ Location = "location",
30
+ Reaction = "reaction",
31
+ Sticker = "sticker",
32
+ Template = "template",
33
+ Text = "text",
34
+ Video = "video",
35
+ Button = "button",
36
+ Order = "order",
37
+ System = "system",
38
+ Unknown = "unknown",
39
+ Statuses = "statuses",
40
+ '*' = "*",
41
+ }
42
+ declare enum ParametersTypesEnum {
43
+ Action = "ACTION",
44
+ CouponCode = "COUPON_CODE",
45
+ Currency = "CURRENCY",
46
+ DateTime = "DATE_TIME",
47
+ Document = "DOCUMENT",
48
+ ExpirationTimeMs = "EXPIRATION_TIME_MS",
49
+ Image = "IMAGE",
50
+ LimitedTimeOffer = "LIMITED_TIME_OFFER",
51
+ Location = "LOCATION",
52
+ OrderStatus = "ORDER_STATUS",
53
+ Payload = "PAYLOAD",
54
+ Product = "PRODUCT",
55
+ Text = "TEXT",
56
+ TtlMinutes = "TTL_MINUTES",
57
+ Video = "VIDEO",
58
+ WebviewInteraction = "WEBVIEW_INTERACTION",
59
+ WebviewPresentation = "WEBVIEW_PRESENTATION",
60
+ }
61
+ declare enum InteractiveTypesEnum {
62
+ Button = "button",
63
+ List = "list",
64
+ Product = "product",
65
+ ProductList = "product_list",
66
+ CtaUrl = "cta_url",
67
+ LocationRequest = "location_request_message",
68
+ AddressMessage = "address_message",
69
+ Flow = "flow",
70
+ }
71
+ declare enum ButtonPositionEnum {
72
+ First = 1,
73
+ Second = 2,
74
+ Third = 3,
75
+ Fourth = 4,
76
+ Fifth = 5,
77
+ }
78
+ declare enum SubTypeEnum {
79
+ Catalog = "CATALOG",
80
+ CopyCode = "COPY_CODE",
81
+ Flow = "FLOW",
82
+ Mpm = "MPM",
83
+ OrderDetails = "ORDER_DETAILS",
84
+ QuickReply = "QUICK_REPLY",
85
+ Reminder = "REMINDER",
86
+ Url = "URL",
87
+ VoiceCall = "VOICE_CALL",
88
+ }
89
+ declare enum ComponentTypesEnum {
90
+ Header = "HEADER",
91
+ Body = "BODY",
92
+ Button = "BUTTON",
93
+ Footer = "FOOTER",
94
+ }
95
+ declare enum WabaConfigEnum {
96
+ AppId = "M4D_APP_ID",
97
+ Port = "WA_PORT",
98
+ AppSecret = "M4D_APP_SECRET",
99
+ PhoneNumberId = "WA_PHONE_NUMBER_ID",
100
+ BusinessAcctId = "WA_BUSINESS_ACCOUNT_ID",
101
+ APIVersion = "CLOUD_API_VERSION",
102
+ AccessToken = "CLOUD_API_ACCESS_TOKEN",
103
+ WebhookEndpoint = "WEBHOOK_ENDPOINT",
104
+ WebhookVerificationToken = "WEBHOOK_VERIFICATION_TOKEN",
105
+ ListenerPort = "LISTENER_PORT",
106
+ MaxRetriesAfterWait = "MAX_RETRIES_AFTER_WAIT",
107
+ RequestTimeout = "REQUEST_TIMEOUT",
108
+ Debug = "DEBUG",
109
+ PrivatePem = "FLOW_API_PRIVATE_PEM",
110
+ Passphrase = "FLOW_API_PASSPHRASE",
111
+ }
112
+ declare enum ConversationTypesEnum {
113
+ BusinessInitiated = "business_initiated",
114
+ CustomerInitiated = "customer_initiated",
115
+ ReferralConversion = "referral_conversion",
116
+ }
117
+ declare enum StatusEnum {
118
+ Delivered = "delivered",
119
+ Read = "read",
120
+ Sent = "sent",
121
+ }
122
+ declare enum VideoMediaTypesEnum {
123
+ Mp4 = "video/mp4",
124
+ Threegp = "video/3gp",
125
+ }
126
+ declare enum StickerMediaTypesEnum {
127
+ Webp = "image/webp",
128
+ }
129
+ declare enum ImageMediaTypesEnum {
130
+ Jpeg = "image/jpeg",
131
+ Png = "image/png",
132
+ }
133
+ declare enum DocumentMediaTypesEnum {
134
+ Text = "text/plain",
135
+ Pdf = "application/pdf",
136
+ Ppt = "application/vnd.ms-powerpoint",
137
+ Word = "application/msword",
138
+ Excel = "application/vnd.ms-excel",
139
+ OpenDoc = "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
140
+ OpenPres = "application/vnd.openxmlformats-officedocument.presentationml.presentation",
141
+ OpenSheet = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
142
+ }
143
+ declare enum AudioMediaTypesEnum {
144
+ Aac = "audio/aac",
145
+ Mp4 = "audio/mp4",
146
+ Mpeg = "audio/mpeg",
147
+ Amr = "audio/amr",
148
+ Ogg = "audio/ogg",
149
+ }
150
+ declare enum WebhookTypesEnum {
151
+ Audio = "audio",
152
+ Button = "button",
153
+ Document = "document",
154
+ Text = "text",
155
+ Image = "image",
156
+ Interactive = "interactive",
157
+ Order = "order",
158
+ Sticker = "sticker",
159
+ System = "system",
160
+ Unknown = "unknown",
161
+ Video = "video",
162
+ }
163
+ declare enum SystemChangeTypesEnum {
164
+ CustomerChangedNumber = "customer_changed_number",
165
+ CustomerIdentityChanged = "customer_identity_changed",
166
+ }
167
+ declare enum ReferralSourceTypesEnum {
168
+ Ad = "ad",
169
+ Post = "post",
170
+ }
171
+ declare enum RequestCodeMethodsEnum {
172
+ Sms = "SMS",
173
+ Voice = "VOICE",
174
+ }
175
+ declare enum LanguagesEnum {
176
+ Afrikaans = "af",
177
+ Albanian = "sq",
178
+ Arabic = "ar",
179
+ Azerbaijani = "az",
180
+ Bengali = "bn",
181
+ Bulgarian = "bg",
182
+ Catalan = "ca",
183
+ Chinese_CHN = "zh_CN",
184
+ Chinese_HKG = "zh_HK",
185
+ Chinese_TAI = "zh_TW",
186
+ Croatian = "hr",
187
+ Czech = "cs",
188
+ Danish = "da",
189
+ Dutch = "nl",
190
+ English = "en",
191
+ English_UK = "en_GB",
192
+ English_US = "en_US",
193
+ Estonian = "et",
194
+ Filipino = "fil",
195
+ Finnish = "fi",
196
+ French = "fr",
197
+ Georgian = "ka",
198
+ German = "de",
199
+ Greek = "el",
200
+ Gujarati = "gu",
201
+ Hausa = "ha",
202
+ Hebrew = "he",
203
+ Hindi = "hi",
204
+ Hungarian = "hu",
205
+ Indonesian = "id",
206
+ Irish = "ga",
207
+ Italian = "it",
208
+ Japanese = "ja",
209
+ Kannada = "kn",
210
+ Kazakh = "kk",
211
+ Kinyarwanda = "rw_RW",
212
+ Korean = "ko",
213
+ Kyrgyz_Kyrgyzstan = "ky_KG",
214
+ Lao = "lo",
215
+ Latvian = "lv",
216
+ Lithuanian = "lt",
217
+ Macedonian = "mk",
218
+ Malay = "ms",
219
+ Malayalam = "ml",
220
+ Marathi = "mr",
221
+ Norwegian = "nb",
222
+ Persian = "fa",
223
+ Polish = "pl",
224
+ Portuguese_BR = "pt_BR",
225
+ Portuguese_POR = "pt_PT",
226
+ Punjabi = "pa",
227
+ Romanian = "ro",
228
+ Russian = "ru",
229
+ Serbian = "sr",
230
+ Slovak = "sk",
231
+ Slovenian = "sl",
232
+ Spanish = "es",
233
+ Spanish_ARG = "es_AR",
234
+ Spanish_SPA = "es_ES",
235
+ Spanish_MEX = "es_MX",
236
+ Swahili = "sw",
237
+ Swedish = "sv",
238
+ Tamil = "ta",
239
+ Telugu = "te",
240
+ Thai = "th",
241
+ Turkish = "tr",
242
+ Ukrainian = "uk",
243
+ Urdu = "ur",
244
+ Uzbek = "uz",
245
+ Vietnamese = "vi",
246
+ Zulu = "zu",
247
+ }
248
+ declare enum CurrencyCodesEnum {
249
+ AFN = "AFN",
250
+ EUR = "EUR",
251
+ ALL = "ALL",
252
+ DZD = "DZD",
253
+ USD = "USD",
254
+ AOA = "AOA",
255
+ XCD = "XCD",
256
+ ARS = "ARS",
257
+ AMD = "AMD",
258
+ AWG = "AWG",
259
+ AUD = "AUD",
260
+ AZN = "AZN",
261
+ BSD = "BSD",
262
+ BHD = "BHD",
263
+ BDT = "BDT",
264
+ BBD = "BBD",
265
+ BYN = "BYN",
266
+ BZD = "BZD",
267
+ XOF = "XOF",
268
+ BMD = "BMD",
269
+ INR = "INR",
270
+ BTN = "BTN",
271
+ BOB = "BOB",
272
+ BOV = "BOV",
273
+ BAM = "BAM",
274
+ BWP = "BWP",
275
+ NOK = "NOK",
276
+ BRL = "BRL",
277
+ BND = "BND",
278
+ BGN = "BGN",
279
+ BIF = "BIF",
280
+ CVE = "CVE",
281
+ KHR = "KHR",
282
+ XAF = "XAF",
283
+ CAD = "CAD",
284
+ KYD = "KYD",
285
+ CLP = "CLP",
286
+ CLF = "CLF",
287
+ CNY = "CNY",
288
+ COP = "COP",
289
+ COU = "COU",
290
+ KMF = "KMF",
291
+ CDF = "CDF",
292
+ NZD = "NZD",
293
+ CRC = "CRC",
294
+ HRK = "HRK",
295
+ CUP = "CUP",
296
+ CUC = "CUC",
297
+ ANG = "ANG",
298
+ CZK = "CZK",
299
+ DKK = "DKK",
300
+ DJF = "DJF",
301
+ DOP = "DOP",
302
+ EGP = "EGP",
303
+ SVC = "SVC",
304
+ ERN = "ERN",
305
+ SZL = "SZL",
306
+ ETB = "ETB",
307
+ FKP = "FKP",
308
+ FJD = "FJD",
309
+ XPF = "XPF",
310
+ GMD = "GMD",
311
+ GEL = "GEL",
312
+ GHS = "GHS",
313
+ GIP = "GIP",
314
+ GTQ = "GTQ",
315
+ GBP = "GBP",
316
+ GNF = "GNF",
317
+ GYD = "GYD",
318
+ HTG = "HTG",
319
+ HNL = "HNL",
320
+ HKD = "HKD",
321
+ HUF = "HUF",
322
+ ISK = "ISK",
323
+ IDR = "IDR",
324
+ XDR = "XDR",
325
+ IRR = "IRR",
326
+ IQD = "IQD",
327
+ ILS = "ILS",
328
+ JMD = "JMD",
329
+ JPY = "JPY",
330
+ JOD = "JOD",
331
+ KZT = "KZT",
332
+ KES = "KES",
333
+ KPW = "KPW",
334
+ KRW = "KRW",
335
+ KWD = "KWD",
336
+ KGS = "KGS",
337
+ LAK = "LAK",
338
+ LBP = "LBP",
339
+ LSL = "LSL",
340
+ ZAR = "ZAR",
341
+ LRD = "LRD",
342
+ LYD = "LYD",
343
+ CHF = "CHF",
344
+ MOP = "MOP",
345
+ MKD = "MKD",
346
+ MGA = "MGA",
347
+ MWK = "MWK",
348
+ MYR = "MYR",
349
+ MVR = "MVR",
350
+ MRU = "MRU",
351
+ MUR = "MUR",
352
+ XUA = "XUA",
353
+ MXN = "MXN",
354
+ MXV = "MXV",
355
+ MDL = "MDL",
356
+ MNT = "MNT",
357
+ MAD = "MAD",
358
+ MZN = "MZN",
359
+ MMK = "MMK",
360
+ NAD = "NAD",
361
+ NPR = "NPR",
362
+ NIO = "NIO",
363
+ NGN = "NGN",
364
+ OMR = "OMR",
365
+ PKR = "PKR",
366
+ PAB = "PAB",
367
+ PGK = "PGK",
368
+ PYG = "PYG",
369
+ PEN = "PEN",
370
+ PHP = "PHP",
371
+ PLN = "PLN",
372
+ QAR = "QAR",
373
+ RON = "RON",
374
+ RUB = "RUB",
375
+ RWF = "RWF",
376
+ SHP = "SHP",
377
+ WST = "WST",
378
+ STN = "STN",
379
+ SAR = "SAR",
380
+ RSD = "RSD",
381
+ SCR = "SCR",
382
+ SLL = "SLL",
383
+ SGD = "SGD",
384
+ XSU = "XSU",
385
+ SBD = "SBD",
386
+ SOS = "SOS",
387
+ SSP = "SSP",
388
+ LKR = "LKR",
389
+ SDG = "SDG",
390
+ SRD = "SRD",
391
+ SEK = "SEK",
392
+ CHE = "CHE",
393
+ CHW = "CHW",
394
+ SYP = "SYP",
395
+ TWD = "TWD",
396
+ TJS = "TJS",
397
+ TZS = "TZS",
398
+ THB = "THB",
399
+ TOP = "TOP",
400
+ TTD = "TTD",
401
+ TND = "TND",
402
+ TRY = "TRY",
403
+ TMT = "TMT",
404
+ UGX = "UGX",
405
+ UAH = "UAH",
406
+ AED = "AED",
407
+ USN = "USN",
408
+ UYU = "UYU",
409
+ UYI = "UYI",
410
+ UYW = "UYW",
411
+ UZS = "UZS",
412
+ VUV = "VUV",
413
+ VES = "VES",
414
+ VND = "VND",
415
+ YER = "YER",
416
+ ZMW = "ZMW",
417
+ ZWL = "ZWL",
418
+ XBA = "XBA",
419
+ XBB = "XBB",
420
+ XBC = "XBC",
421
+ XBD = "XBD",
422
+ XTS = "XTS",
423
+ XXX = "XXX",
424
+ XAU = "XAU",
425
+ XPD = "XPD",
426
+ XPT = "XPT",
427
+ XAG = "XAG",
428
+ AFA = "AFA",
429
+ FIM = "FIM",
430
+ ALK = "ALK",
431
+ ADP = "ADP",
432
+ ESP = "ESP",
433
+ FRF = "FRF",
434
+ AOK = "AOK",
435
+ AON = "AON",
436
+ AOR = "AOR",
437
+ ARA = "ARA",
438
+ ARP = "ARP",
439
+ ARY = "ARY",
440
+ RUR = "RUR",
441
+ ATS = "ATS",
442
+ AYM = "AYM",
443
+ AZM = "AZM",
444
+ BYB = "BYB",
445
+ BYR = "BYR",
446
+ BEC = "BEC",
447
+ BEF = "BEF",
448
+ BEL = "BEL",
449
+ BOP = "BOP",
450
+ BAD = "BAD",
451
+ BRB = "BRB",
452
+ BRC = "BRC",
453
+ BRE = "BRE",
454
+ BRN = "BRN",
455
+ BRR = "BRR",
456
+ BGJ = "BGJ",
457
+ BGK = "BGK",
458
+ BGL = "BGL",
459
+ BUK = "BUK",
460
+ HRD = "HRD",
461
+ CYP = "CYP",
462
+ CSJ = "CSJ",
463
+ CSK = "CSK",
464
+ ECS = "ECS",
465
+ ECV = "ECV",
466
+ GQE = "GQE",
467
+ EEK = "EEK",
468
+ XEU = "XEU",
469
+ GEK = "GEK",
470
+ DDM = "DDM",
471
+ DEM = "DEM",
472
+ GHC = "GHC",
473
+ GHP = "GHP",
474
+ GRD = "GRD",
475
+ GNE = "GNE",
476
+ GNS = "GNS",
477
+ GWE = "GWE",
478
+ GWP = "GWP",
479
+ ITL = "ITL",
480
+ ISJ = "ISJ",
481
+ IEP = "IEP",
482
+ ILP = "ILP",
483
+ ILR = "ILR",
484
+ LAJ = "LAJ",
485
+ LVL = "LVL",
486
+ LVR = "LVR",
487
+ LSM = "LSM",
488
+ ZAL = "ZAL",
489
+ LTL = "LTL",
490
+ LTT = "LTT",
491
+ LUC = "LUC",
492
+ LUF = "LUF",
493
+ LUL = "LUL",
494
+ MGF = "MGF",
495
+ MVQ = "MVQ",
496
+ MLF = "MLF",
497
+ MTL = "MTL",
498
+ MTP = "MTP",
499
+ MRO = "MRO",
500
+ MXP = "MXP",
501
+ MZE = "MZE",
502
+ MZM = "MZM",
503
+ NLG = "NLG",
504
+ NIC = "NIC",
505
+ PEH = "PEH",
506
+ PEI = "PEI",
507
+ PES = "PES",
508
+ PLZ = "PLZ",
509
+ PTE = "PTE",
510
+ ROK = "ROK",
511
+ ROL = "ROL",
512
+ STD = "STD",
513
+ CSD = "CSD",
514
+ SKK = "SKK",
515
+ SIT = "SIT",
516
+ RHD = "RHD",
517
+ ESA = "ESA",
518
+ ESB = "ESB",
519
+ SDD = "SDD",
520
+ SDP = "SDP",
521
+ SRG = "SRG",
522
+ CHC = "CHC",
523
+ TJR = "TJR",
524
+ TPE = "TPE",
525
+ TRL = "TRL",
526
+ TMM = "TMM",
527
+ UGS = "UGS",
528
+ UGW = "UGW",
529
+ UAK = "UAK",
530
+ SUR = "SUR",
531
+ USS = "USS",
532
+ UYN = "UYN",
533
+ UYP = "UYP",
534
+ VEB = "VEB",
535
+ VEF = "VEF",
536
+ VNC = "VNC",
537
+ YDD = "YDD",
538
+ YUD = "YUD",
539
+ YUM = "YUM",
540
+ YUN = "YUN",
541
+ ZRN = "ZRN",
542
+ ZRZ = "ZRZ",
543
+ ZMK = "ZMK",
544
+ ZWC = "ZWC",
545
+ ZWD = "ZWD",
546
+ ZWN = "ZWN",
547
+ ZWR = "ZWR",
548
+ XFO = "XFO",
549
+ XRE = "XRE",
550
+ XFU = "XFU",
551
+ }
552
+ declare enum DataLocalizationRegionEnum {
553
+ AU = "AU",
554
+ // Australia
555
+ ID = "ID",
556
+ // Indonesia
557
+ IN = "IN",
558
+ // India
559
+ JP = "JP",
560
+ // Japan
561
+ SG = "SG",
562
+ // Singapore
563
+ KR = "KR",
564
+ // South Korea
565
+ DE = "DE",
566
+ // EU (Germany)
567
+ CH = "CH",
568
+ // Switzerland
569
+ GB = "GB",
570
+ // United Kingdom
571
+ BR = "BR",
572
+ // Brazil
573
+ BH = "BH",
574
+ // Bahrain
575
+ ZA = "ZA",
576
+ // South Africa
577
+ AE = "AE",
578
+ // United Arab Emirates
579
+ CA = "CA",
580
+ }
581
+ /**
582
+ * Business category values for WhatsApp Business Profile.
583
+ * These values map to specific strings displayed in the WhatsApp client.
584
+ */
585
+ declare enum BusinessVerticalEnum {
586
+ /**
587
+ * Alcoholic Beverages
588
+ */
589
+ ALCOHOL = "ALCOHOL",
590
+ /**
591
+ * Clothing and Apparel
592
+ */
593
+ APPAREL = "APPAREL",
594
+ /**
595
+ * Automotive
596
+ */
597
+ AUTO = "AUTO",
598
+ /**
599
+ * Beauty, Spa and Salon
600
+ */
601
+ BEAUTY = "BEAUTY",
602
+ /**
603
+ * Education
604
+ */
605
+ EDU = "EDU",
606
+ /**
607
+ * Entertainment
608
+ */
609
+ ENTERTAIN = "ENTERTAIN",
610
+ /**
611
+ * Event Planning and Service
612
+ */
613
+ EVENT_PLAN = "EVENT_PLAN",
614
+ /**
615
+ * Finance and Banking
616
+ */
617
+ FINANCE = "FINANCE",
618
+ /**
619
+ * Public Service
620
+ */
621
+ GOVT = "GOVT",
622
+ /**
623
+ * Food and Grocery
624
+ */
625
+ GROCERY = "GROCERY",
626
+ /**
627
+ * Medical and Health
628
+ */
629
+ HEALTH = "HEALTH",
630
+ /**
631
+ * Hotel and Lodging
632
+ */
633
+ HOTEL = "HOTEL",
634
+ /**
635
+ * Non-profit
636
+ */
637
+ NONPROFIT = "NONPROFIT",
638
+ /**
639
+ * Online Gambling & Gaming
640
+ */
641
+ ONLINE_GAMBLING = "ONLINE_GAMBLING",
642
+ /**
643
+ * Over-the-Counter Drugs
644
+ */
645
+ OTC_DRUGS = "OTC_DRUGS",
646
+ /**
647
+ * Other
648
+ */
649
+ OTHER = "OTHER",
650
+ /**
651
+ * Non-Online Gambling & Gaming (E.g. Brick and mortar)
652
+ */
653
+ PHYSICAL_GAMBLING = "PHYSICAL_GAMBLING",
654
+ /**
655
+ * Professional Services
656
+ */
657
+ PROF_SERVICES = "PROF_SERVICES",
658
+ /**
659
+ * Restaurant
660
+ */
661
+ RESTAURANT = "RESTAURANT",
662
+ /**
663
+ * Shopping and Retail
664
+ */
665
+ RETAIL = "RETAIL",
666
+ /**
667
+ * Travel and Transportation
668
+ */
669
+ TRAVEL = "TRAVEL",
670
+ }
671
+ //#endregion
672
+ //#region src/types/config.d.ts
673
+ type WhatsAppConfig = {
674
+ accessToken: string;
675
+ appId?: string;
676
+ appSecret?: string;
677
+ phoneNumberId?: number;
678
+ businessAcctId?: string;
679
+ apiVersion?: string;
680
+ webhookEndpoint?: string;
681
+ webhookVerificationToken?: string;
682
+ listenerPort?: number;
683
+ debug?: boolean;
684
+ maxRetriesAfterWait?: number;
685
+ requestTimeout?: number;
686
+ privatePem?: string;
687
+ passphrase?: string;
688
+ };
689
+ type WabaConfigType = {
690
+ /**
691
+ * The Meta for Developers business application Id for this registered application.
692
+ */
693
+ [WabaConfigEnum.AppId]: string;
694
+ /**
695
+ * The Meta for Developers business application secret for this registered application.
696
+ */
697
+ [WabaConfigEnum.AppSecret]: string;
698
+ /**
699
+ * The Meta for Developers phone number id used by the registered business.
700
+ */
701
+ [WabaConfigEnum.PhoneNumberId]: number;
702
+ /**
703
+ * The Meta for Developers business id for the registered business.
704
+ */
705
+ [WabaConfigEnum.BusinessAcctId]: string;
706
+ /**
707
+ * The version of the Cloud API being used. Starts with a "v" and follows the major number.
708
+ */
709
+ [WabaConfigEnum.APIVersion]: string;
710
+ /**
711
+ * The access token to make calls on behalf of the signed in Meta for Developers account or business.
712
+ */
713
+ [WabaConfigEnum.AccessToken]: string;
714
+ /**
715
+ * The endpoint path (e.g. if the value here is webhook, the webhook URL would look like http/https://{host}/webhook).
716
+ */
717
+ [WabaConfigEnum.WebhookEndpoint]: string;
718
+ /**
719
+ * The verification token that needs to match what is sent by the Cloud API webhook in order to subscribe.
720
+ */
721
+ [WabaConfigEnum.WebhookVerificationToken]: string;
722
+ /**
723
+ * The listener port for the webhook web server.
724
+ */
725
+ [WabaConfigEnum.ListenerPort]: number;
726
+ /**
727
+ * To turn on global debugging of the logger to print verbose output across the APIs.
728
+ */
729
+ [WabaConfigEnum.Debug]: boolean;
730
+ /**
731
+ * The total number of times a request should be retried after the wait period if it fails.
732
+ */
733
+ [WabaConfigEnum.MaxRetriesAfterWait]: number;
734
+ /**
735
+ * The timeout period for a request to quit and destroy the attempt in ms.
736
+ */
737
+ [WabaConfigEnum.RequestTimeout]: number;
738
+ /**
739
+ * The private key for the Meta for Developers business.
740
+ */
741
+ [WabaConfigEnum.PrivatePem]: string;
742
+ /**
743
+ * The passphrase for the Meta for Developers business.
744
+ */
745
+ [WabaConfigEnum.Passphrase]: string;
746
+ };
747
+ //#endregion
748
+ //#region src/core/webhook/types.d.ts
749
+ interface WebhookContact {
750
+ /**
751
+ * WhatsApp ID of the contact. Business can respond to this contact using this ID.
752
+ */
753
+ wa_id: string;
754
+ /**
755
+ * Additional unique, alphanumeric identifier for a WhatsApp user
756
+ */
757
+ user_id?: string;
758
+ /**
759
+ * Profile of Whatsapp user
760
+ */
761
+ profile: {
762
+ /**
763
+ * The display name of the contact
764
+ */
765
+ name: string;
766
+ };
767
+ }
768
+ /**
769
+ * Base message interface with common properties
770
+ */
771
+ interface BaseMessage {
772
+ id: string;
773
+ from: string;
774
+ timestamp: string;
775
+ type: MessageTypesEnum;
776
+ /**
777
+ * Context object, included when a user replies or interacts
778
+ */
779
+ context?: {
780
+ /**
781
+ * ID of the message
782
+ */
783
+ id?: string;
784
+ /**
785
+ * ID of the sender
786
+ */
787
+ from?: string;
788
+ /**
789
+ * ID of the message being replied to or interacted with
790
+ */
791
+ message_id: string;
792
+ /**
793
+ * ID of the forwarded message, if applicable
794
+ */
795
+ forwarded?: boolean;
796
+ /**
797
+ * Frequently forwarded status
798
+ */
799
+ frequently_forwarded?: boolean;
800
+ /**
801
+ * Original message information if the message was referred
802
+ */
803
+ referred_product?: {
804
+ /**
805
+ * Catalog ID
806
+ */
807
+ catalog_id: string;
808
+ /**
809
+ * Product ID
810
+ */
811
+ product_retailer_id: string;
812
+ };
813
+ };
814
+ /**
815
+ * Errors array, if the message had errors
816
+ */
817
+ errors?: Array<{
818
+ /**
819
+ * Error code
820
+ */
821
+ code: number;
822
+ /**
823
+ * Error title
824
+ */
825
+ title: string;
826
+ /**
827
+ * Error message
828
+ */
829
+ message: string;
830
+ /**
831
+ * Error details object
832
+ */
833
+ error_data?: {
834
+ /**
835
+ * Describes the error details
836
+ */
837
+ details: string;
838
+ };
839
+ }>;
840
+ }
841
+ /**
842
+ * Text message interface
843
+ */
844
+ interface TextMessage extends BaseMessage {
845
+ type: MessageTypesEnum.Text;
846
+ text: {
847
+ /**
848
+ * The text content of the message
849
+ */
850
+ body: string;
851
+ preview_url?: boolean;
852
+ };
853
+ }
854
+ /**
855
+ * Image message interface
856
+ */
857
+ interface ImageMessage extends BaseMessage {
858
+ type: MessageTypesEnum.Image;
859
+ image: {
860
+ /**
861
+ * The image caption (if provided)
862
+ */
863
+ caption?: string;
864
+ /**
865
+ * The SHA256 hash of the image
866
+ */
867
+ sha256?: string;
868
+ /**
869
+ * The ID for the image
870
+ */
871
+ id: string;
872
+ /**
873
+ * The MIME type of the image
874
+ */
875
+ mime_type: string;
876
+ };
877
+ }
878
+ /**
879
+ * Video message interface
880
+ */
881
+ interface VideoMessage extends BaseMessage {
882
+ type: MessageTypesEnum.Video;
883
+ video: {
884
+ /**
885
+ * The video caption (if provided)
886
+ */
887
+ caption?: string;
888
+ /**
889
+ * The SHA256 hash of the video
890
+ */
891
+ sha256?: string;
892
+ /**
893
+ * The ID for the video
894
+ */
895
+ id: string;
896
+ /**
897
+ * The MIME type of the video
898
+ */
899
+ mime_type: string;
900
+ };
901
+ }
902
+ /**
903
+ * Audio message interface
904
+ */
905
+ interface AudioMessage extends BaseMessage {
906
+ type: MessageTypesEnum.Audio;
907
+ audio: {
908
+ /**
909
+ * The ID for the audio file
910
+ */
911
+ id: string;
912
+ /**
913
+ * The MIME type of the audio file
914
+ */
915
+ mime_type: string;
916
+ /**
917
+ * Whether the audio is a voice message
918
+ */
919
+ voice?: boolean;
920
+ };
921
+ }
922
+ /**
923
+ * Document message interface
924
+ */
925
+ interface DocumentMessage extends BaseMessage {
926
+ type: MessageTypesEnum.Document;
927
+ document: {
928
+ /**
929
+ * The document caption (if provided)
930
+ */
931
+ caption?: string;
932
+ /**
933
+ * The document filename
934
+ */
935
+ filename: string;
936
+ /**
937
+ * The SHA256 hash of the document
938
+ */
939
+ sha256?: string;
940
+ /**
941
+ * The ID for the document
942
+ */
943
+ id: string;
944
+ /**
945
+ * The MIME type of the document
946
+ */
947
+ mime_type: string;
948
+ };
949
+ }
950
+ /**
951
+ * Sticker message interface
952
+ */
953
+ interface StickerMessage extends BaseMessage {
954
+ type: MessageTypesEnum.Sticker;
955
+ sticker: {
956
+ /**
957
+ * The ID for the sticker
958
+ */
959
+ id: string;
960
+ /**
961
+ * Whether this is an animated sticker
962
+ */
963
+ animated: boolean;
964
+ /**
965
+ * The MIME type of the sticker
966
+ */
967
+ mime_type: string;
968
+ };
969
+ }
970
+ /**
971
+ * Reaction message interface
972
+ */
973
+ interface ReactionMessage extends BaseMessage {
974
+ type: MessageTypesEnum.Reaction;
975
+ reaction: {
976
+ /**
977
+ * The ID of the message being reacted to
978
+ */
979
+ message_id: string;
980
+ /**
981
+ * Emoji used for the reaction
982
+ */
983
+ emoji: string;
984
+ };
985
+ }
986
+ /**
987
+ * Contacts message interface
988
+ */
989
+ interface ContactsMessage extends BaseMessage {
990
+ type: MessageTypesEnum.Contacts;
991
+ contacts: Array<{
992
+ /**
993
+ * The contact's name
994
+ */
995
+ name: {
996
+ /**
997
+ * The formatted name
998
+ */
999
+ formatted_name: string;
1000
+ /**
1001
+ * The first name
1002
+ */
1003
+ first_name?: string;
1004
+ /**
1005
+ * The last name
1006
+ */
1007
+ last_name?: string;
1008
+ /**
1009
+ * The middle name
1010
+ */
1011
+ middle_name?: string;
1012
+ /**
1013
+ * The suffix
1014
+ */
1015
+ suffix?: string;
1016
+ /**
1017
+ * The prefix
1018
+ */
1019
+ prefix?: string;
1020
+ };
1021
+ /**
1022
+ * The contact's phone numbers
1023
+ */
1024
+ phones?: Array<{
1025
+ phone: string;
1026
+ type?: string;
1027
+ wa_id?: string;
1028
+ }>;
1029
+ /**
1030
+ * The contact's emails
1031
+ */
1032
+ emails?: Array<{
1033
+ email: string;
1034
+ type?: string;
1035
+ }>;
1036
+ /**
1037
+ * The contact's addresses
1038
+ */
1039
+ addresses?: Array<{
1040
+ street?: string;
1041
+ city?: string;
1042
+ state?: string;
1043
+ zip?: string;
1044
+ country?: string;
1045
+ country_code?: string;
1046
+ type?: string;
1047
+ }>;
1048
+ /**
1049
+ * The contact's organizations
1050
+ */
1051
+ org?: {
1052
+ company?: string;
1053
+ department?: string;
1054
+ title?: string;
1055
+ };
1056
+ /**
1057
+ * The contact's URLs
1058
+ */
1059
+ urls?: Array<{
1060
+ url: string;
1061
+ type?: string;
1062
+ }>;
1063
+ /**
1064
+ * The contact's birthday (YYYY-MM-DD format)
1065
+ */
1066
+ birthday?: string;
1067
+ }>;
1068
+ }
1069
+ /**
1070
+ * Location message interface
1071
+ */
1072
+ interface LocationMessage extends BaseMessage {
1073
+ type: MessageTypesEnum.Location;
1074
+ location: {
1075
+ /**
1076
+ * Latitude of the location
1077
+ */
1078
+ latitude: number;
1079
+ /**
1080
+ * Longitude of the location
1081
+ */
1082
+ longitude: number;
1083
+ /**
1084
+ * Name of the location
1085
+ */
1086
+ name?: string;
1087
+ /**
1088
+ * Address of the location
1089
+ */
1090
+ address?: string;
1091
+ };
1092
+ }
1093
+ /**
1094
+ * Interactive message interface
1095
+ */
1096
+ interface InteractiveMessage extends BaseMessage {
1097
+ type: MessageTypesEnum.Interactive;
1098
+ interactive: {
1099
+ /**
1100
+ * Type of the interactive message
1101
+ * Can be: button_reply, list_reply, flow, nfm_reply, etc.
1102
+ */
1103
+ type: string;
1104
+ /**
1105
+ * ID for the button that was clicked
1106
+ */
1107
+ button_reply?: {
1108
+ id: string;
1109
+ title: string;
1110
+ };
1111
+ /**
1112
+ * ID for the list item that was selected
1113
+ */
1114
+ list_reply?: {
1115
+ id: string;
1116
+ title: string;
1117
+ description?: string;
1118
+ };
1119
+ /**
1120
+ * NFM (No-Code Flow Message) reply data
1121
+ */
1122
+ nfm_reply?: {
1123
+ /**
1124
+ * Response data in JSON format
1125
+ */
1126
+ response_json: string;
1127
+ /**
1128
+ * Body text of the reply
1129
+ */
1130
+ body: string;
1131
+ /**
1132
+ * Name of the flow
1133
+ */
1134
+ name: string;
1135
+ };
1136
+ };
1137
+ }
1138
+ /**
1139
+ * System message interface
1140
+ */
1141
+ interface SystemMessage extends BaseMessage {
1142
+ type: MessageTypesEnum.System;
1143
+ system: {
1144
+ /**
1145
+ * The type of system update
1146
+ */
1147
+ type: string;
1148
+ /**
1149
+ * User's identity if the update is a customer identity change
1150
+ */
1151
+ identity?: string;
1152
+ /**
1153
+ * Old and new phone numbers if the update is a phone number change
1154
+ */
1155
+ customer?: {
1156
+ /**
1157
+ * The previous phone number
1158
+ */
1159
+ previous_wa_id: string;
1160
+ /**
1161
+ * The new phone number
1162
+ */
1163
+ wa_id: string;
1164
+ };
1165
+ };
1166
+ }
1167
+ /**
1168
+ * Order message interface
1169
+ */
1170
+ interface OrderMessage extends BaseMessage {
1171
+ type: MessageTypesEnum.Order;
1172
+ order: {
1173
+ /**
1174
+ * Catalog ID
1175
+ */
1176
+ catalog_id: string;
1177
+ /**
1178
+ * Product items in the order
1179
+ */
1180
+ product_items: Array<{
1181
+ /**
1182
+ * Product ID
1183
+ */
1184
+ product_retailer_id: string;
1185
+ /**
1186
+ * Quantity of the product
1187
+ */
1188
+ quantity: number;
1189
+ /**
1190
+ * Item price
1191
+ */
1192
+ item_price: number;
1193
+ /**
1194
+ * Currency code
1195
+ */
1196
+ currency: string;
1197
+ }>;
1198
+ /**
1199
+ * Text message included with the order
1200
+ */
1201
+ text?: string;
1202
+ };
1203
+ }
1204
+ /**
1205
+ * Button message interface
1206
+ */
1207
+ interface ButtonMessage extends BaseMessage {
1208
+ type: MessageTypesEnum.Button;
1209
+ button: {
1210
+ /**
1211
+ * The payload for the button
1212
+ */
1213
+ payload: string;
1214
+ /**
1215
+ * Button text
1216
+ */
1217
+ text: string;
1218
+ };
1219
+ }
1220
+ /**
1221
+ * Represents a message received through the webhook
1222
+ * Based on Meta's documentation: https://developers.facebook.com/docs/whatsapp/cloud-api/webhooks/components#messages-object
1223
+ */
1224
+ interface WebhookMessage {
1225
+ /**
1226
+ * The WhatsApp Business Account ID
1227
+ */
1228
+ wabaId: string;
1229
+ /**
1230
+ * The message ID
1231
+ */
1232
+ id: string;
1233
+ /**
1234
+ * The sender's phone number
1235
+ */
1236
+ from: string;
1237
+ /**
1238
+ * The timestamp of the message
1239
+ */
1240
+ timestamp: string;
1241
+ /**
1242
+ * The type of message (text, image, etc.)
1243
+ */
1244
+ type: MessageTypesEnum;
1245
+ /**
1246
+ * The phone number ID that received the message
1247
+ */
1248
+ phoneNumberId: string;
1249
+ /**
1250
+ * The display phone number that received the message
1251
+ */
1252
+ displayPhoneNumber: string;
1253
+ /**
1254
+ * The profile name of the sender
1255
+ */
1256
+ profileName: string;
1257
+ text?: TextMessage['text'];
1258
+ image?: ImageMessage['image'];
1259
+ video?: VideoMessage['video'];
1260
+ audio?: AudioMessage['audio'];
1261
+ document?: DocumentMessage['document'];
1262
+ sticker?: StickerMessage['sticker'];
1263
+ location?: LocationMessage['location'];
1264
+ contacts?: ContactsMessage['contacts'];
1265
+ interactive?: InteractiveMessage['interactive'];
1266
+ button?: ButtonMessage['button'];
1267
+ order?: OrderMessage['order'];
1268
+ system?: SystemMessage['system'];
1269
+ reaction?: ReactionMessage['reaction'];
1270
+ statuses?: {
1271
+ /**
1272
+ * Arbitrary string included in sent message
1273
+ */
1274
+ biz_opaque_callback_data?: string;
1275
+ /**
1276
+ * Information about the conversation
1277
+ */
1278
+ conversation?: {
1279
+ /**
1280
+ * Represents the ID of the conversation the given status notification belongs to
1281
+ */
1282
+ id: string;
1283
+ /**
1284
+ * Describes conversation category
1285
+ */
1286
+ origin: {
1287
+ /**
1288
+ * Indicates conversation category. This can also be referred to as a conversation entry point
1289
+ * - authentication: Conversation opened by business sending template categorized as AUTHENTICATION
1290
+ * - marketing: Conversation opened by business sending template categorized as MARKETING
1291
+ * - utility: Conversation opened by business sending template categorized as UTILITY
1292
+ * - service: Conversation opened by business replying to customer within service window
1293
+ * - referral_conversion: Free entry point conversation
1294
+ */
1295
+ type: 'authentication' | 'marketing' | 'utility' | 'service' | 'referral_conversion';
1296
+ };
1297
+ /**
1298
+ * Date when the conversation expires. Only present for messages with status 'sent'
1299
+ */
1300
+ expiration_timestamp?: string;
1301
+ };
1302
+ /**
1303
+ * Array of error objects describing the error
1304
+ */
1305
+ errors?: Array<{
1306
+ /**
1307
+ * Error code
1308
+ */
1309
+ code: number;
1310
+ /**
1311
+ * Error code title
1312
+ */
1313
+ title: string;
1314
+ /**
1315
+ * Error code message
1316
+ */
1317
+ message: string;
1318
+ /**
1319
+ * Error details object
1320
+ */
1321
+ error_data?: {
1322
+ /**
1323
+ * Describes the error details
1324
+ */
1325
+ details: string;
1326
+ };
1327
+ }>;
1328
+ /**
1329
+ * The ID for the message that the business sent to a customer
1330
+ */
1331
+ id: string;
1332
+ /**
1333
+ * Pricing information for the message/conversation
1334
+ */
1335
+ pricing?: {
1336
+ /**
1337
+ * Indicates if the given message or conversation is billable
1338
+ * @deprecated This field is deprecated. Visit the WhatsApp Changelog for more information.
1339
+ */
1340
+ billable?: boolean;
1341
+ /**
1342
+ * Indicates the conversation category:
1343
+ * - authentication: Authentication conversation
1344
+ * - authentication_international: Authentication-international conversation
1345
+ * - marketing: Marketing conversation
1346
+ * - utility: Utility conversation
1347
+ * - service: Service conversation
1348
+ * - referral_conversion: Free entry point conversation
1349
+ */
1350
+ category: 'authentication' | 'authentication_international' | 'marketing' | 'utility' | 'service' | 'referral_conversion';
1351
+ /**
1352
+ * Type of pricing model used by the business. Current supported value is CBP
1353
+ */
1354
+ pricing_model: 'CBP';
1355
+ };
1356
+ /**
1357
+ * The customer's WhatsApp ID. Business can respond to customer using this ID.
1358
+ * This ID may not match the customer's phone number.
1359
+ */
1360
+ recipient_id: string;
1361
+ /**
1362
+ * Status of the message:
1363
+ * - delivered: Message has been delivered
1364
+ * - read: Message has been read by the customer
1365
+ * - sent: Message has been sent to the customer
1366
+ */
1367
+ status: 'delivered' | 'read' | 'sent';
1368
+ /**
1369
+ * Unix timestamp for the status message
1370
+ */
1371
+ timestamp: string;
1372
+ };
1373
+ /**
1374
+ * The original message data as received from the webhook
1375
+ */
1376
+ originalData: any;
1377
+ }
1378
+ /**
1379
+ * Webhook event received from WhatsApp
1380
+ */
1381
+ interface WebhookEvent {
1382
+ /**
1383
+ * The field type of the event
1384
+ */
1385
+ field: string;
1386
+ /**
1387
+ * The event data
1388
+ */
1389
+ value: any;
1390
+ /**
1391
+ * The timestamp when the event was received
1392
+ */
1393
+ timestamp: number;
1394
+ }
1395
+ /**
1396
+ * Message status enum
1397
+ */
1398
+ declare enum MessageStatus {
1399
+ DELIVERED = "delivered",
1400
+ READ = "read",
1401
+ SENT = "sent",
1402
+ }
1403
+ //#endregion
1404
+ //#region src/types/request.d.ts
1405
+ type GeneralRequestBody = Record<string, unknown>;
1406
+ interface RequesterResponseInterface<T> {
1407
+ json: () => Promise<T>;
1408
+ }
1409
+ interface ResponseSuccess {
1410
+ success: boolean;
1411
+ }
1412
+ interface ResponseData<T> {
1413
+ data: T;
1414
+ }
1415
+ interface ResponsePagination<T> {
1416
+ data: T[];
1417
+ paging: Paging;
1418
+ }
1419
+ interface Paging {
1420
+ cursors: {
1421
+ before: string;
1422
+ after: string;
1423
+ };
1424
+ next: string;
1425
+ }
1426
+ declare class RequesterClass {
1427
+ constructor(apiVersion: string, phoneNumberId: number, accessToken: string, businessAcctId: string, userAgent: string);
1428
+ sendRequest: (method: HttpMethodsEnum, path: string, timeout: number, body?: GeneralRequestBody, contentType?: string, additionalHeaders?: Record<string, string>) => Promise<RequesterResponseInterface<unknown>>;
1429
+ getJson<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: GeneralRequestBody, additionalHeaders?: Record<string, string>): Promise<T>;
1430
+ sendFormData<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: FormData, additionalHeaders?: Record<string, string>): Promise<T>;
1431
+ sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: Record<string, string>, additionalHeaders?: Record<string, string>): Promise<T>;
1432
+ }
1433
+ //#endregion
1434
+ //#region src/types/httpsClient.d.ts
1435
+ type ResponseHeaderValue = string | string[] | undefined;
1436
+ type ResponseHeaders = Record<string, ResponseHeaderValue>;
1437
+ type ResponseJSONBody = Record<string, unknown>;
1438
+ declare class HttpsClientResponseClass {
1439
+ constructor(resp: Response);
1440
+ statusCode: () => number;
1441
+ headers: () => ResponseHeaders;
1442
+ rawResponse: () => Response;
1443
+ json: () => Promise<ResponseJSONBody>;
1444
+ }
1445
+ declare class HttpsClientClass {
7
1446
  constructor();
8
- clearSockets(): boolean;
9
- sendRequest(hostname: string, path: string, method: HttpMethodsEnum, headers: HeadersInit, timeout: number, body?: BodyInit | null): Promise<HttpsClientResponseClass>;
1447
+ clearSockets: () => boolean;
1448
+ sendRequest: (host: string, path: string, method: HttpMethodsEnum, headers: HeadersInit, timeout: number, body?: BodyInit | null) => Promise<HttpsClientResponseClass>;
1449
+ }
1450
+ //#endregion
1451
+ //#region src/types/base.d.ts
1452
+ declare class BaseClass {
1453
+ constructor(config: WabaConfigType);
1454
+ }
1455
+ declare class BaseAPI implements BaseClass {
1456
+ protected config: WabaConfigType;
1457
+ protected client: RequesterClass;
1458
+ constructor(config: WabaConfigType, client: RequesterClass);
1459
+ protected sendJson<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any): Promise<T>;
1460
+ protected sendFormData<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any): Promise<T>;
1461
+ protected sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any): Promise<T>;
1462
+ }
1463
+ //#endregion
1464
+ //#region src/api/profile/types/upload.d.ts
1465
+ /**
1466
+ * Upload session information for creating upload sessions.
1467
+ */
1468
+ interface UploadSession {
1469
+ id: string;
1470
+ video?: boolean;
1471
+ }
1472
+ /**
1473
+ * Response from creating an upload session.
1474
+ */
1475
+ interface UploadSessionResponse {
1476
+ id: string;
1477
+ }
1478
+ /**
1479
+ * Response from uploading business profile media.
1480
+ */
1481
+ interface UploadBusinessProfileResponse {
1482
+ h: string;
1483
+ }
1484
+ /**
1485
+ * Upload handle information containing file details and handle.
1486
+ */
1487
+ interface UploadHandle {
1488
+ handle: string;
1489
+ file_size: number;
1490
+ upload_result: {
1491
+ handle_type: string;
1492
+ name: string;
1493
+ };
1494
+ }
1495
+ /**
1496
+ * Request parameters for creating upload session.
1497
+ */
1498
+ interface CreateUploadSessionParams {
1499
+ /**
1500
+ * Length of the file to be uploaded in bytes.
1501
+ */
1502
+ fileLength: number;
1503
+ /**
1504
+ * MIME type of the file (e.g., 'image/jpeg').
1505
+ */
1506
+ fileType: string;
1507
+ /**
1508
+ * Name of the file with extension.
1509
+ */
1510
+ fileName: string;
1511
+ }
1512
+ /**
1513
+ * Request parameters for uploading media.
1514
+ */
1515
+ interface UploadMediaParams {
1516
+ /**
1517
+ * The upload session ID from createUploadSession response.
1518
+ */
1519
+ uploadId: string;
1520
+ /**
1521
+ * The binary data of the file (Buffer).
1522
+ */
1523
+ file: Buffer;
1524
+ }
1525
+ /**
1526
+ * Request parameters for getting upload handle.
1527
+ */
1528
+ interface GetUploadHandleParams {
1529
+ /**
1530
+ * The upload session ID from createUploadSession response.
1531
+ */
1532
+ uploadId: string;
1533
+ }
1534
+ //#endregion
1535
+ //#region src/api/profile/types/common.d.ts
1536
+ /**
1537
+ * Available fields that can be requested when retrieving a business profile.
1538
+ */
1539
+ type BusinessProfileField = 'about' | 'address' | 'description' | 'email' | 'profile_picture_url' | 'websites' | 'vertical';
1540
+ type BusinessProfileFieldsParam = BusinessProfileField[] | string;
1541
+ /**
1542
+ * Business profile data structure containing all profile information.
1543
+ */
1544
+ interface BusinessProfileData {
1545
+ /**
1546
+ * The business's About text. This text appears in the business's profile, beneath its profile image,
1547
+ * phone number, and contact buttons.
1548
+ * - String cannot be empty
1549
+ * - Strings must be between 1 and 139 characters
1550
+ * - Rendered emojis are supported however their unicode values are not.
1551
+ * Emoji unicode values must be Java- or JavaScript-escape encoded
1552
+ * - Hyperlinks can be included but will not render as clickable links
1553
+ * - Markdown is not supported
1554
+ */
1555
+ about?: string;
1556
+ /**
1557
+ * Address of the business. Character limit 256.
1558
+ */
1559
+ address?: string;
1560
+ /**
1561
+ * Description of the business. Character limit 512.
1562
+ */
1563
+ description?: string;
1564
+ /**
1565
+ * The contact email address (in valid email format) of the business. Character limit 128.
1566
+ */
1567
+ email?: string;
1568
+ /**
1569
+ * The messaging service used for the request. Always set it to "whatsapp" if you are using
1570
+ * the WhatsApp Business API.
1571
+ */
1572
+ messaging_product: string;
1573
+ /**
1574
+ * Profile picture URL.
1575
+ */
1576
+ profile_picture_url?: string;
1577
+ /**
1578
+ * The URLs associated with the business. For instance, a website, Facebook Page, or Instagram.
1579
+ * - You must include the http:// or https:// portion of the URL
1580
+ * - There is a maximum of 2 websites with a maximum of 256 characters each
1581
+ */
1582
+ websites?: string[];
1583
+ /**
1584
+ * Business category. This can be either an empty string or one of the predefined business categories.
1585
+ * @see BusinessVerticalEnum for all available options
1586
+ */
1587
+ vertical?: BusinessVerticalEnum | string;
1588
+ }
1589
+ /**
1590
+ * Response structure for business profile GET requests.
1591
+ */
1592
+ interface BusinessProfileResponse {
1593
+ data: BusinessProfileData[];
1594
+ }
1595
+ /**
1596
+ * Request structure for updating business profile.
1597
+ */
1598
+ interface UpdateBusinessProfileRequest {
1599
+ /**
1600
+ * The messaging service used for the request. Always set it to "whatsapp" if you are using
1601
+ * the WhatsApp Business API.
1602
+ * @required
1603
+ */
1604
+ messaging_product: string;
1605
+ /**
1606
+ * The business's About text. This text appears in the business's profile, beneath its profile image,
1607
+ * phone number, and contact buttons.
1608
+ * - String cannot be empty
1609
+ * - Strings must be between 1 and 139 characters
1610
+ * - Rendered emojis are supported however their unicode values are not.
1611
+ * Emoji unicode values must be Java- or JavaScript-escape encoded
1612
+ * - Hyperlinks can be included but will not render as clickable links
1613
+ * - Markdown is not supported
1614
+ */
1615
+ about?: string;
1616
+ /**
1617
+ * Address of the business. Character limit 256.
1618
+ */
1619
+ address?: string;
1620
+ /**
1621
+ * Description of the business. Character limit 512.
1622
+ */
1623
+ description?: string;
1624
+ /**
1625
+ * Business category. This can be either an empty string or one of the predefined business categories.
1626
+ * @see BusinessVerticalEnum for all available options
1627
+ */
1628
+ vertical?: BusinessVerticalEnum | string;
1629
+ /**
1630
+ * The contact email address (in valid email format) of the business. Character limit 128.
1631
+ */
1632
+ email?: string;
1633
+ /**
1634
+ * The URLs associated with the business. For instance, a website, Facebook Page, or Instagram.
1635
+ * - You must include the http:// or https:// portion of the URL
1636
+ * - There is a maximum of 2 websites with a maximum of 256 characters each
1637
+ */
1638
+ websites?: string[];
1639
+ /**
1640
+ * Handle of the profile picture. This handle is generated when you upload the binary file
1641
+ * for the profile picture to Meta using the Resumable Upload API.
1642
+ */
1643
+ profile_picture_handle?: string;
1644
+ }
1645
+ declare class BusinessProfileClass extends BaseClass {
1646
+ /**
1647
+ * Get your business profile.
1648
+ * @param fields Specific fields to be returned in the response. If not specified, all fields will be returned.
1649
+ */
1650
+ getBusinessProfile(fields?: BusinessProfileFieldsParam): Promise<BusinessProfileResponse>;
1651
+ /**
1652
+ * Update your business profile.
1653
+ * @param updateRequest The request object containing the fields to update.
1654
+ */
1655
+ updateBusinessProfile(updateRequest: UpdateBusinessProfileRequest): Promise<ResponseSuccess>;
1656
+ /**
1657
+ * Create an upload session for profile picture.
1658
+ * @param fileLength Length of the file to be uploaded in bytes.
1659
+ * @param fileType MIME type of the file (e.g., 'image/jpeg').
1660
+ * @param fileName Name of the file.
1661
+ */
1662
+ createUploadSession(fileLength: number, fileType: string, fileName: string): Promise<UploadSessionResponse>;
1663
+ /**
1664
+ * Upload media file to the upload session.
1665
+ * @param uploadId The ID of the upload session.
1666
+ * @param file The binary data of the file.
1667
+ */
1668
+ uploadMedia(uploadId: string, file: Buffer): Promise<UploadBusinessProfileResponse>;
1669
+ /**
1670
+ * Get the upload handle information.
1671
+ * @param uploadId The ID of the upload session.
1672
+ */
1673
+ getUploadHandle(uploadId: string): Promise<UploadHandle>;
1674
+ }
1675
+ //#endregion
1676
+ //#region src/api/phone/types/common.d.ts
1677
+ type QualityRating = 'GREEN' | 'YELLOW' | 'RED' | 'NA';
1678
+ type AccountMode = 'LIVE' | 'SANDBOX';
1679
+ type CodeVerificationStatus = 'NOT_VERIFIED' | 'VERIFIED' | 'EXPIRED' | 'PENDING' | 'DELETED' | 'MIGRATED' | 'BANNED' | 'RESTRICTED' | 'RATE_LIMITED' | 'FLAGGED' | 'CONNECTED' | 'DISCONNECTED' | 'UNKNOWN' | 'UNVERIFIED';
1680
+ type MessagingLimitTier = 'TIER_50' | 'TIER_250' | 'TIER_1K' | 'TIER_10K' | 'TIER_100K' | 'TIER_UNLIMITED';
1681
+ type PlatformType = 'CLOUD_API' | 'ON_PREMISE' | 'NOT_APPLICABLE';
1682
+ type ThroughputLevel = 'STANDARD' | 'HIGH' | 'NOT_APPLICABLE';
1683
+ type HealthStatusEntity = {
1684
+ entity_type: string;
1685
+ id: string;
1686
+ can_send_message: string;
1687
+ additional_info?: string[];
1688
+ errors?: Array<{
1689
+ error_code: number;
1690
+ error_description: string;
1691
+ possible_solution: string;
1692
+ }>;
1693
+ };
1694
+ type HealthStatus = {
1695
+ can_send_message: string;
1696
+ entities: HealthStatusEntity[];
1697
+ };
1698
+ type QualityScore = {
1699
+ score: QualityRating;
1700
+ };
1701
+ type Throughput = {
1702
+ level: ThroughputLevel;
1703
+ };
1704
+ type PhoneNumberResponse = {
1705
+ display_phone_number: string;
1706
+ id: string;
1707
+ quality_rating: QualityRating;
1708
+ verified_name: string;
1709
+ account_mode?: AccountMode;
1710
+ certificate?: string;
1711
+ code_verification_status?: CodeVerificationStatus;
1712
+ conversational_automation?: Record<string, unknown>;
1713
+ eligibility_for_api_business_global_search?: string;
1714
+ health_status?: HealthStatus;
1715
+ is_official_business_account?: boolean;
1716
+ is_on_biz_app?: boolean;
1717
+ is_pin_enabled?: boolean;
1718
+ is_preverified_number?: boolean;
1719
+ last_onboarded_time?: string;
1720
+ messaging_limit_tier?: MessagingLimitTier;
1721
+ name_status?: string;
1722
+ new_certificate?: string;
1723
+ new_name_status?: string;
1724
+ platform_type?: PlatformType;
1725
+ quality_score?: QualityScore;
1726
+ search_visibility?: string;
1727
+ status?: CodeVerificationStatus;
1728
+ throughput?: Throughput;
1729
+ };
1730
+ type Cursors = {
1731
+ before: string;
1732
+ after: string;
1733
+ };
1734
+ type PhoneNumbersResponse = {
1735
+ data: PhoneNumberResponse[];
1736
+ paging: Paging;
1737
+ };
1738
+ type RequestVerificationCodeRequest = {
1739
+ code_method: 'SMS' | 'VOICE';
1740
+ language: string;
1741
+ };
1742
+ type VerifyCodeRequest = {
1743
+ code: string;
1744
+ };
1745
+ type TwoStepVerificationParams = {
1746
+ pin: string;
1747
+ };
1748
+ interface PhoneNumberClass {
1749
+ getPhoneNumberById(fields?: string): Promise<PhoneNumberResponse>;
1750
+ getPhoneNumbers(): Promise<PhoneNumbersResponse>;
1751
+ requestVerificationCode(params: RequestVerificationCodeRequest): Promise<ResponseSuccess>;
1752
+ verifyCode(params: VerifyCodeRequest): Promise<ResponseSuccess>;
1753
+ }
1754
+ //#endregion
1755
+ //#region src/api/template/types/common.d.ts
1756
+ type TemplateFormat = 'TEXT' | 'IMAGE' | 'VIDEO' | 'DOCUMENT' | 'LOCATION' | 'PRODUCT';
1757
+ type PhoneNumberButton = {
1758
+ type: 'PHONE_NUMBER';
1759
+ text: string;
1760
+ phone_number: string;
1761
+ };
1762
+ type URLButton = {
1763
+ type: 'URL';
1764
+ text: string;
1765
+ url: string;
1766
+ example?: string[];
1767
+ };
1768
+ type QuickReplyButton = {
1769
+ type: 'QUICK_REPLY';
1770
+ text: string;
1771
+ };
1772
+ type CopyCodeButton = {
1773
+ type: 'COPY_CODE';
1774
+ example: string;
1775
+ };
1776
+ type FlowButton = {
1777
+ type: 'FLOW';
1778
+ text: string;
1779
+ flow_id?: string;
1780
+ flow_name?: string;
1781
+ flow_json?: string;
1782
+ flow_action?: 'navigate' | 'data_exchange';
1783
+ navigate_screen?: string;
1784
+ };
1785
+ type MPMButton = {
1786
+ type: 'MPM';
1787
+ action?: {
1788
+ thumbnail_product_retailer_id: string;
1789
+ sections: Array<{
1790
+ title?: string;
1791
+ product_items: Array<{
1792
+ product_retailer_id: string;
1793
+ }>;
1794
+ }>;
1795
+ };
1796
+ };
1797
+ type OTPButton = {
1798
+ type: 'OTP';
1799
+ };
1800
+ type SPMButton = {
1801
+ type: 'SPM';
1802
+ action?: {
1803
+ product_retailer_id: string;
1804
+ };
1805
+ };
1806
+ type CatalogButton = {
1807
+ type: 'CATALOG';
1808
+ action?: {
1809
+ thumbnail_product_retailer_id: string;
1810
+ };
1811
+ };
1812
+ type TemplateButton = PhoneNumberButton | URLButton | QuickReplyButton | CopyCodeButton | FlowButton | MPMButton | OTPButton | SPMButton | CatalogButton;
1813
+ type TemplateHeaderExample = {
1814
+ header_text?: string[];
1815
+ header_text_named_params?: Array<{
1816
+ param_name: string;
1817
+ example: string;
1818
+ }>;
1819
+ header_handle?: string[];
1820
+ };
1821
+ type TemplateHeader = {
1822
+ type: 'HEADER';
1823
+ format: TemplateFormat;
1824
+ text?: string;
1825
+ example?: TemplateHeaderExample;
1826
+ };
1827
+ type TemplateBody = {
1828
+ type: 'BODY';
1829
+ text: string;
1830
+ example?: {
1831
+ body_text?: Array<Array<string>>;
1832
+ body_text_named_params?: Array<{
1833
+ param_name: string;
1834
+ example: string;
1835
+ }>;
1836
+ };
1837
+ };
1838
+ type TemplateFooter = {
1839
+ type: 'FOOTER';
1840
+ text: string;
1841
+ };
1842
+ type TemplateButtons = {
1843
+ type: 'BUTTONS';
1844
+ buttons: TemplateButton[];
1845
+ };
1846
+ type TemplateLimitedTimeOffer = {
1847
+ type: 'LIMITED_TIME_OFFER';
1848
+ limited_time_offer: {
1849
+ expiration_time_ms: number;
1850
+ };
1851
+ };
1852
+ type TemplateCarousel = {
1853
+ type: 'CAROUSEL';
1854
+ cards: Array<{
1855
+ card_index: number;
1856
+ components: ComponentTypes[];
1857
+ }>;
1858
+ };
1859
+ type MediaCarouselCard = {
1860
+ card_index: number;
1861
+ components: (TemplateHeader | TemplateBody | TemplateButtons)[];
1862
+ };
1863
+ type ProductCarouselCard = {
1864
+ card_index: number;
1865
+ components: TemplateHeader[];
1866
+ };
1867
+ type ComponentTypes = TemplateHeader | TemplateBody | TemplateFooter | TemplateButtons | TemplateLimitedTimeOffer | TemplateCarousel;
1868
+ type TemplateRequestBody = GeneralRequestBody & {
1869
+ name: string;
1870
+ language: LanguagesEnum;
1871
+ category?: CategoryEnum;
1872
+ components?: ComponentTypes[];
1873
+ };
1874
+ type TemplateResponse = {
1875
+ id: string;
1876
+ status: string;
1877
+ language: LanguagesEnum;
1878
+ category: CategoryEnum;
1879
+ name: string;
1880
+ components: ComponentTypes[];
1881
+ };
1882
+ type TemplateGetParams = {
1883
+ limit?: number;
1884
+ name?: string;
1885
+ language?: LanguagesEnum;
1886
+ category?: CategoryEnum;
1887
+ status?: TemplateStatusEnum;
1888
+ };
1889
+ type TemplateDeleteParams = {
1890
+ hsm_id: string;
1891
+ name: string;
1892
+ };
1893
+ declare class TemplateClass {
1894
+ getTemplate(templateId: string): Promise<TemplateResponse>;
1895
+ updateTemplate(templateId: string, template: Partial<TemplateRequestBody>): Promise<ResponseSuccess>;
1896
+ getTemplates(params?: TemplateGetParams): Promise<ResponsePagination<TemplateResponse>>;
1897
+ createTemplate(template: TemplateRequestBody): Promise<TemplateResponse>;
1898
+ deleteTemplate(params: TemplateDeleteParams): Promise<ResponseSuccess>;
1899
+ }
1900
+ //#endregion
1901
+ //#region src/api/template/types/factory.d.ts
1902
+ interface TextParameter {
1903
+ type: 'text';
1904
+ value: string;
1905
+ }
1906
+ interface CurrencyParameter {
1907
+ type: 'currency';
1908
+ amount_1000: number;
1909
+ code: CurrencyCodesEnum;
1910
+ fallback_value: string;
1911
+ }
1912
+ interface DateTimeParameter {
1913
+ type: 'date_time';
1914
+ fallback_value: string;
1915
+ }
1916
+ interface MediaParameter {
1917
+ type: 'image' | 'video' | 'document';
1918
+ handle?: string;
1919
+ link?: string;
1920
+ }
1921
+ interface LocationParameter {
1922
+ type: 'location';
1923
+ latitude?: number;
1924
+ longitude?: number;
1925
+ name?: string;
1926
+ address?: string;
1927
+ }
1928
+ interface ProductParameter {
1929
+ type: 'product';
1930
+ product_retailer_id: string;
1931
+ }
1932
+ type TemplateParameter = TextParameter | CurrencyParameter | DateTimeParameter | MediaParameter | LocationParameter | ProductParameter;
1933
+ interface HeaderOptions {
1934
+ format: TemplateFormat;
1935
+ text?: string;
1936
+ parameters?: TemplateParameter[];
1937
+ example?: {
1938
+ header_text?: string[];
1939
+ header_text_named_params?: Array<{
1940
+ param_name: string;
1941
+ example: string;
1942
+ }>;
1943
+ header_handle?: string[];
1944
+ };
1945
+ }
1946
+ interface BodyOptions {
1947
+ text: string;
1948
+ parameters?: TemplateParameter[];
1949
+ example?: {
1950
+ body_text?: string[][];
1951
+ body_text_named_params?: Array<{
1952
+ param_name: string;
1953
+ example: string;
1954
+ }>;
1955
+ };
1956
+ }
1957
+ interface FooterOptions {
1958
+ text: string;
1959
+ }
1960
+ interface ButtonOptions {
1961
+ phone_number?: {
1962
+ text: string;
1963
+ phone_number: string;
1964
+ };
1965
+ url?: {
1966
+ text: string;
1967
+ url: string;
1968
+ example?: string;
1969
+ };
1970
+ quick_reply?: {
1971
+ text: string;
1972
+ }[];
1973
+ copy_code?: {
1974
+ example: string;
1975
+ };
1976
+ flow?: {
1977
+ text: string;
1978
+ flow_id?: string;
1979
+ flow_name?: string;
1980
+ flow_json?: string;
1981
+ flow_action?: 'navigate' | 'data_exchange';
1982
+ navigate_screen?: string;
1983
+ };
1984
+ mpm?: boolean;
1985
+ otp?: boolean;
1986
+ spm?: boolean;
1987
+ }
1988
+ interface CarouselCard {
1989
+ image?: string;
1990
+ video?: string;
1991
+ product?: string;
1992
+ body?: string;
1993
+ bodyParameters?: TemplateParameter[];
1994
+ buttons?: ButtonOptions;
1995
+ }
1996
+ interface CarouselOptions {
1997
+ cards: CarouselCard[];
1998
+ }
1999
+ interface LimitedTimeOfferOptions {
2000
+ expiration_time_ms: number;
2001
+ }
2002
+ interface ProductSection {
2003
+ title?: string;
2004
+ product_items: Array<{
2005
+ product_retailer_id: string;
2006
+ }>;
2007
+ }
2008
+ interface TemplateOptions {
2009
+ name: string;
2010
+ language: LanguagesEnum;
2011
+ category: CategoryEnum;
2012
+ header?: HeaderOptions;
2013
+ body?: BodyOptions;
2014
+ footer?: FooterOptions;
2015
+ buttons?: ButtonOptions;
2016
+ carousel?: CarouselOptions;
2017
+ limitedTimeOffer?: LimitedTimeOfferOptions;
2018
+ }
2019
+ interface OTPTemplateOptions {
2020
+ name: string;
2021
+ language: LanguagesEnum;
2022
+ code_expiration_minutes?: number;
2023
+ add_security_recommendation?: boolean;
2024
+ }
2025
+ interface AuthenticationTemplateOptions {
2026
+ name: string;
2027
+ language: LanguagesEnum;
2028
+ code_expiration_minutes?: number;
2029
+ add_security_recommendation?: boolean;
2030
+ copy_code_button?: boolean;
2031
+ }
2032
+ interface CatalogTemplateOptions {
2033
+ name: string;
2034
+ language: LanguagesEnum;
2035
+ header?: Omit<HeaderOptions, 'format'>;
2036
+ body: BodyOptions;
2037
+ footer?: FooterOptions;
2038
+ thumbnail_product_retailer_id: string;
2039
+ }
2040
+ interface CouponTemplateOptions {
2041
+ name: string;
2042
+ language: LanguagesEnum;
2043
+ header?: Omit<HeaderOptions, 'format'>;
2044
+ body: BodyOptions;
2045
+ footer?: FooterOptions;
2046
+ coupon_code: string;
2047
+ }
2048
+ interface LimitedTimeOfferTemplateOptions {
2049
+ name: string;
2050
+ language: LanguagesEnum;
2051
+ header?: Omit<HeaderOptions, 'format'>;
2052
+ body: BodyOptions;
2053
+ footer?: FooterOptions;
2054
+ expiration_time_ms: number;
2055
+ }
2056
+ interface MediaCardCarouselTemplateOptions {
2057
+ name: string;
2058
+ language: LanguagesEnum;
2059
+ cards: Array<{
2060
+ header: {
2061
+ format: 'IMAGE' | 'VIDEO';
2062
+ example: {
2063
+ header_handle: string[];
2064
+ };
2065
+ };
2066
+ body: BodyOptions;
2067
+ buttons?: ButtonOptions;
2068
+ }>;
2069
+ }
2070
+ interface MPMTemplateOptions {
2071
+ name: string;
2072
+ language: LanguagesEnum;
2073
+ header?: Omit<HeaderOptions, 'format'>;
2074
+ body: BodyOptions;
2075
+ footer?: FooterOptions;
2076
+ thumbnail_product_retailer_id: string;
2077
+ sections: ProductSection[];
2078
+ }
2079
+ interface ProductCardCarouselTemplateOptions {
2080
+ name: string;
2081
+ language: LanguagesEnum;
2082
+ header?: Omit<HeaderOptions, 'format'>;
2083
+ body: BodyOptions;
2084
+ footer?: FooterOptions;
2085
+ cards: Array<{
2086
+ product_retailer_id: string;
2087
+ }>;
2088
+ }
2089
+ interface SPMTemplateOptions {
2090
+ name: string;
2091
+ language: LanguagesEnum;
2092
+ header?: Omit<HeaderOptions, 'format'>;
2093
+ body: BodyOptions;
2094
+ footer?: FooterOptions;
2095
+ product_retailer_id: string;
2096
+ }
2097
+ //#endregion
2098
+ //#region src/api/messages/types/text.d.ts
2099
+ type TextObject = {
2100
+ body: string;
2101
+ preview_url?: boolean;
2102
+ };
2103
+ interface TextMessageParams extends MessageRequestParams<TextObject | string> {
2104
+ previewUrl?: boolean;
2105
+ }
2106
+ //#endregion
2107
+ //#region src/api/messages/types/template.d.ts
2108
+ type LanguageObject = {
2109
+ policy: 'deterministic';
2110
+ code: LanguagesEnum;
2111
+ };
2112
+ type ParametersObject<T extends ParametersTypesEnum> = {
2113
+ type: T;
2114
+ };
2115
+ type SimpleTextObject$1 = {
2116
+ text: string;
2117
+ };
2118
+ type TextParametersObject = ParametersObject<ParametersTypesEnum.Text> & SimpleTextObject$1;
2119
+ type CouponCodeParametersObject = ParametersObject<ParametersTypesEnum.CouponCode> & {
2120
+ coupon_code: string;
2121
+ };
2122
+ type CurrencyObject = {
2123
+ fallback_value: string;
2124
+ code: CurrencyCodesEnum;
2125
+ amount_1000: number;
2126
+ };
2127
+ type CurrencyParametersObject = ParametersObject<ParametersTypesEnum.Currency> & {
2128
+ currency: CurrencyObject;
2129
+ };
2130
+ type DateTimeObject = {
2131
+ fallback_value: string;
2132
+ };
2133
+ type DateTimeParametersObject = ParametersObject<ParametersTypesEnum.Currency> & {
2134
+ date_time: DateTimeObject;
2135
+ };
2136
+ type DocumentMediaObject$2 = {
2137
+ id?: string;
2138
+ link?: string;
2139
+ caption?: string;
2140
+ filename?: string;
2141
+ };
2142
+ type ImageMediaObject$2 = {
2143
+ id?: string;
2144
+ link?: string;
2145
+ caption?: string;
2146
+ };
2147
+ type VideoMediaObject$2 = {
2148
+ id?: string;
2149
+ link?: string;
2150
+ caption?: string;
2151
+ };
2152
+ type DocumentParametersObject = ParametersObject<ParametersTypesEnum.Document> & DocumentMediaObject$2;
2153
+ type ImageParametersObject = ParametersObject<ParametersTypesEnum.Image> & ImageMediaObject$2;
2154
+ type VideoParametersObject = ParametersObject<ParametersTypesEnum.Video> & VideoMediaObject$2;
2155
+ type ComponentObject<T extends ComponentTypesEnum> = {
2156
+ type: T;
2157
+ parameters: (CurrencyParametersObject | DateTimeParametersObject | DocumentParametersObject | ImageParametersObject | TextParametersObject | VideoParametersObject | CouponCodeParametersObject)[];
2158
+ };
2159
+ type ButtonComponentObject = ComponentObject<ComponentTypesEnum.Button> & {
2160
+ parameters?: (TextParametersObject | PayloadParametersObject)[];
2161
+ sub_type: SubTypeEnum;
2162
+ index: ButtonPositionEnum;
2163
+ };
2164
+ type PayloadParametersObject = ParametersObject<ParametersTypesEnum.Payload> & {
2165
+ payload: string;
2166
+ };
2167
+ type MessageTemplateObject<T extends ComponentTypesEnum> = {
2168
+ name: string;
2169
+ language: LanguageObject;
2170
+ components?: (ComponentObject<T> | ButtonComponentObject)[];
2171
+ };
2172
+ //#endregion
2173
+ //#region src/api/messages/types/media.d.ts
2174
+ type MetaMediaObject = {
2175
+ id: string;
2176
+ link?: never;
2177
+ };
2178
+ type HostedMediaObject = {
2179
+ id?: never;
2180
+ link: string;
2181
+ };
2182
+ type AudioMediaObject = MetaMediaObject | HostedMediaObject;
2183
+ type MetaDocumentMediaObject = MetaMediaObject & {
2184
+ caption?: string;
2185
+ filename?: string;
2186
+ };
2187
+ type HostedDocumentMediaObject = HostedMediaObject & {
2188
+ caption?: string;
2189
+ filename?: string;
2190
+ };
2191
+ type DocumentMediaObject = MetaDocumentMediaObject | HostedDocumentMediaObject;
2192
+ type MetaImageMediaObject = MetaMediaObject & {
2193
+ caption?: string;
2194
+ };
2195
+ type HostedImageMediaObject = HostedMediaObject & {
2196
+ caption?: string;
2197
+ };
2198
+ type ImageMediaObject = MetaImageMediaObject | HostedImageMediaObject;
2199
+ type MetaVideoMediaObject = MetaMediaObject & {
2200
+ caption?: string;
2201
+ };
2202
+ type HostedVideoMediaObject = HostedMediaObject & {
2203
+ caption?: string;
2204
+ };
2205
+ type VideoMediaObject = MetaVideoMediaObject | HostedVideoMediaObject;
2206
+ type StickerMediaObject = MetaMediaObject | HostedMediaObject;
2207
+ //#endregion
2208
+ //#region src/api/messages/types/contact.d.ts
2209
+ type AddressesObject = {
2210
+ street?: string;
2211
+ city?: string;
2212
+ state?: string;
2213
+ zip?: string;
2214
+ country?: string;
2215
+ country_code?: string;
2216
+ type?: 'HOME' | 'WORK' | string;
2217
+ };
2218
+ type EmailObject = {
2219
+ email?: string;
2220
+ type?: 'HOME' | 'WORK' | string;
2221
+ };
2222
+ type NameObject = {
2223
+ formatted_name: string;
2224
+ first_name?: string;
2225
+ last_name?: string;
2226
+ middle_name?: string;
2227
+ suffix?: string;
2228
+ prefix?: string;
2229
+ };
2230
+ type OrgObject = {
2231
+ company?: string;
2232
+ department?: string;
2233
+ title?: string;
2234
+ };
2235
+ type PhoneObject = {
2236
+ phone?: 'PHONE_NUMBER';
2237
+ type?: 'CELL' | 'MAIN' | 'IPHONE' | 'HOME' | 'WORK' | string;
2238
+ wa_id?: string;
2239
+ };
2240
+ type URLObject = {
2241
+ url?: string;
2242
+ type?: 'HOME' | 'WORK' | string;
2243
+ };
2244
+ type ContactObject = {
2245
+ addresses?: AddressesObject[];
2246
+ birthday?: `${number}${number}${number}${number}-${number}${number}-${number}${number}`;
2247
+ emails?: EmailObject[];
2248
+ name: NameObject;
2249
+ org?: OrgObject;
2250
+ phones?: PhoneObject[];
2251
+ urls?: URLObject[];
2252
+ };
2253
+ //#endregion
2254
+ //#region src/api/messages/types/location.d.ts
2255
+ type LocationObject = {
2256
+ longitude: number;
2257
+ latitude: number;
2258
+ name?: string;
2259
+ address?: string;
2260
+ };
2261
+ //#endregion
2262
+ //#region src/api/messages/types/interactive.d.ts
2263
+ type DocumentMediaObject$1 = {
2264
+ id?: string;
2265
+ link?: string;
2266
+ caption?: string;
2267
+ filename?: string;
2268
+ };
2269
+ type ImageMediaObject$1 = {
2270
+ id?: string;
2271
+ link?: string;
2272
+ caption?: string;
2273
+ };
2274
+ type VideoMediaObject$1 = {
2275
+ id?: string;
2276
+ link?: string;
2277
+ caption?: string;
2278
+ };
2279
+ type ProductObject = {
2280
+ product_retailer_id: string;
2281
+ };
2282
+ type SimpleTextObject = {
2283
+ text: string;
2284
+ };
2285
+ type RowObject = {
2286
+ id: string;
2287
+ title: string;
2288
+ description?: string;
2289
+ };
2290
+ type MultiProductSectionObject = {
2291
+ product_items: ProductObject[];
2292
+ rows?: never;
2293
+ title?: string;
2294
+ };
2295
+ type ListSectionObject = {
2296
+ product_items?: never;
2297
+ rows: RowObject[];
2298
+ title?: string;
2299
+ };
2300
+ type SectionObject = MultiProductSectionObject | ListSectionObject;
2301
+ type ButtonObject = {
2302
+ title: string;
2303
+ id: string;
2304
+ };
2305
+ type ReplyButtonObject = {
2306
+ type: 'reply';
2307
+ reply: ButtonObject;
2308
+ };
2309
+ type ActionObject = {
2310
+ buttons?: ReplyButtonObject[];
2311
+ catalog_id?: string;
2312
+ product_retailer_id?: string;
2313
+ sections?: SectionObject[];
2314
+ };
2315
+ type HeaderObject = {
2316
+ type: 'document' | 'image' | 'text' | 'video';
2317
+ document?: DocumentMediaObject$1;
2318
+ image?: ImageMediaObject$1;
2319
+ text?: string;
2320
+ video?: VideoMediaObject$1;
2321
+ };
2322
+ type ButtonInteractiveObject = {
2323
+ type: InteractiveTypesEnum.Button;
2324
+ body: SimpleTextObject;
2325
+ footer?: SimpleTextObject;
2326
+ header?: HeaderObject;
2327
+ action: ActionObject;
2328
+ };
2329
+ type ListInteractiveObject = {
2330
+ type: InteractiveTypesEnum.List;
2331
+ body: SimpleTextObject;
2332
+ footer?: SimpleTextObject;
2333
+ header?: HeaderObject;
2334
+ action: ActionObject;
2335
+ };
2336
+ type ProductInteractiveObject = {
2337
+ type: InteractiveTypesEnum.Product;
2338
+ body?: SimpleTextObject;
2339
+ footer?: SimpleTextObject;
2340
+ header?: HeaderObject;
2341
+ action: ActionObject;
2342
+ };
2343
+ type ProductListInteractiveObject = {
2344
+ type: InteractiveTypesEnum.ProductList;
2345
+ body: SimpleTextObject;
2346
+ footer?: SimpleTextObject;
2347
+ header: HeaderObject;
2348
+ action: ActionObject;
2349
+ };
2350
+ type CtaUrlParameters = {
2351
+ display_text: string;
2352
+ url: string;
2353
+ };
2354
+ type CtaUrlActionObject = {
2355
+ name: 'cta_url';
2356
+ parameters: CtaUrlParameters;
2357
+ };
2358
+ type CtaUrlInteractiveObject = {
2359
+ type: InteractiveTypesEnum.CtaUrl;
2360
+ body?: SimpleTextObject;
2361
+ footer?: SimpleTextObject;
2362
+ header?: HeaderObject;
2363
+ action: CtaUrlActionObject;
2364
+ };
2365
+ type LocationRequestActionObject = {
2366
+ name: 'send_location';
2367
+ };
2368
+ type LocationRequestInteractiveObject = {
2369
+ type: InteractiveTypesEnum.LocationRequest;
2370
+ body: SimpleTextObject;
2371
+ footer?: SimpleTextObject;
2372
+ header?: HeaderObject;
2373
+ action: LocationRequestActionObject;
2374
+ };
2375
+ type AddressValues = {
2376
+ name?: string;
2377
+ phone_number?: string;
2378
+ in_pin_code?: string;
2379
+ house_number?: string;
2380
+ floor_number?: string;
2381
+ tower_number?: string;
2382
+ building_name?: string;
2383
+ address?: string;
2384
+ landmark_area?: string;
2385
+ city?: string;
2386
+ state?: string;
2387
+ };
2388
+ type SavedAddress = {
2389
+ id: string;
2390
+ value: AddressValues;
2391
+ };
2392
+ type ValidationErrors = { [key in keyof AddressValues]?: string };
2393
+ type AddressMessageParameters = {
2394
+ country: string;
2395
+ values?: AddressValues;
2396
+ saved_addresses?: SavedAddress[];
2397
+ validation_errors?: ValidationErrors;
2398
+ };
2399
+ type AddressMessageActionObject = {
2400
+ name: 'address_message';
2401
+ parameters: AddressMessageParameters;
2402
+ };
2403
+ type AddressMessageInteractiveObject = {
2404
+ type: InteractiveTypesEnum.AddressMessage;
2405
+ body: SimpleTextObject;
2406
+ footer?: SimpleTextObject;
2407
+ header?: HeaderObject;
2408
+ action: AddressMessageActionObject;
2409
+ };
2410
+ type FlowParameters = {
2411
+ flow_message_version: string;
2412
+ flow_id?: string;
2413
+ flow_name?: string;
2414
+ flow_cta: string;
2415
+ mode?: 'draft' | 'published';
2416
+ flow_token: string;
2417
+ flow_action: 'navigate' | 'data_exchange';
2418
+ flow_action_payload?: {
2419
+ screen?: string;
2420
+ data?: Record<string, string>;
2421
+ };
2422
+ };
2423
+ type FlowActionObject = {
2424
+ name: 'flow';
2425
+ parameters: FlowParameters;
2426
+ };
2427
+ type FlowInteractiveObject = {
2428
+ type: InteractiveTypesEnum.Flow;
2429
+ body: SimpleTextObject;
2430
+ footer?: SimpleTextObject;
2431
+ header?: HeaderObject;
2432
+ action: FlowActionObject;
2433
+ };
2434
+ type InteractiveObject = ButtonInteractiveObject | ListInteractiveObject | ProductInteractiveObject | ProductListInteractiveObject | CtaUrlInteractiveObject | LocationRequestInteractiveObject | AddressMessageInteractiveObject | FlowInteractiveObject;
2435
+ //#endregion
2436
+ //#region src/api/messages/types/reaction.d.ts
2437
+ interface ReactionParams {
2438
+ messageId: string;
2439
+ emoji: string;
2440
+ to: string;
2441
+ }
2442
+ //#endregion
2443
+ //#region src/api/messages/types/common.d.ts
2444
+ type GeneralMessageBody = GeneralRequestBody & {
2445
+ /**
2446
+ * The Meta messaging product name.
2447
+ * @default 'whatsapp'
2448
+ */
2449
+ messaging_product: 'whatsapp';
2450
+ };
2451
+ type ConTextObject = {
2452
+ message_id: string;
2453
+ };
2454
+ type MessageRequestBody<T extends MessageTypesEnum> = GeneralMessageBody & {
2455
+ recipient_type?: string;
2456
+ to: string;
2457
+ context?: ConTextObject;
2458
+ type?: T;
2459
+ };
2460
+ interface MessageRequestParams<T> {
2461
+ body: T;
2462
+ to: string;
2463
+ replyMessageId?: string;
2464
+ }
2465
+ interface StatusParams {
2466
+ status: string;
2467
+ messageId: string;
2468
+ typingIndicator?: {
2469
+ type: string;
2470
+ };
2471
+ }
2472
+ type MessagesResponse = GeneralMessageBody & {
2473
+ contacts: [{
2474
+ input: string;
2475
+ wa_id: string;
2476
+ }];
2477
+ messages: [{
2478
+ id: string;
2479
+ }];
2480
+ };
2481
+ declare class MessagesClass extends BaseClass {
2482
+ text(params: TextMessageParams): Promise<MessagesResponse>;
2483
+ template(params: MessageRequestParams<MessageTemplateObject<ComponentTypesEnum>>): Promise<MessagesResponse>;
2484
+ audio(params: MessageRequestParams<AudioMediaObject>): Promise<MessagesResponse>;
2485
+ document(params: MessageRequestParams<DocumentMediaObject>): Promise<MessagesResponse>;
2486
+ image(params: MessageRequestParams<ImageMediaObject>): Promise<MessagesResponse>;
2487
+ video(params: MessageRequestParams<VideoMediaObject>): Promise<MessagesResponse>;
2488
+ sticker(params: MessageRequestParams<StickerMediaObject>): Promise<MessagesResponse>;
2489
+ contacts(params: MessageRequestParams<[ContactObject]>): Promise<MessagesResponse>;
2490
+ location(params: MessageRequestParams<LocationObject>): Promise<MessagesResponse>;
2491
+ interactive(params: MessageRequestParams<InteractiveObject>): Promise<MessagesResponse>;
2492
+ interactiveList(params: MessageRequestParams<InteractiveObject & {
2493
+ type: InteractiveTypesEnum.List;
2494
+ }>): Promise<MessagesResponse>;
2495
+ interactiveCtaUrl(params: MessageRequestParams<InteractiveObject & {
2496
+ type: InteractiveTypesEnum.CtaUrl;
2497
+ }>): Promise<MessagesResponse>;
2498
+ interactiveLocationRequest(params: MessageRequestParams<InteractiveObject & {
2499
+ type: InteractiveTypesEnum.LocationRequest;
2500
+ }>): Promise<MessagesResponse>;
2501
+ interactiveAddressMessage(params: MessageRequestParams<InteractiveObject & {
2502
+ type: InteractiveTypesEnum.AddressMessage;
2503
+ }>): Promise<MessagesResponse>;
2504
+ interactiveReplyButtons(params: MessageRequestParams<InteractiveObject & {
2505
+ type: InteractiveTypesEnum.Button;
2506
+ }>): Promise<MessagesResponse>;
2507
+ interactiveFlow(params: MessageRequestParams<InteractiveObject & {
2508
+ type: InteractiveTypesEnum.Flow;
2509
+ }>): Promise<MessagesResponse>;
2510
+ reaction(params: ReactionParams): Promise<MessagesResponse>;
2511
+ markAsRead(params: {
2512
+ messageId: string;
2513
+ }): Promise<MessagesResponse>;
2514
+ showTypingIndicator(params: {
2515
+ messageId: string;
2516
+ }): Promise<MessagesResponse>;
2517
+ status(params: StatusParams): Promise<MessagesResponse>;
2518
+ }
2519
+ //#endregion
2520
+ //#region src/api/media/types/common.d.ts
2521
+ type MediaResponse = {
2522
+ id: string;
2523
+ url: string;
2524
+ mime_type: string;
2525
+ sha256: string;
2526
+ file_size: number;
2527
+ messaging_product: 'whatsapp';
2528
+ };
2529
+ type MediasResponse = {
2530
+ data: MediaResponse[];
2531
+ paging: {
2532
+ cursors: {
2533
+ before: string;
2534
+ after: string;
2535
+ };
2536
+ };
2537
+ };
2538
+ type UploadMediaResponse = {
2539
+ id: string;
2540
+ };
2541
+ interface MediaClass {
2542
+ getMediaById(mediaId: string, phone_number_id?: string): Promise<MediaResponse>;
2543
+ uploadMedia(file: File, messagingProduct?: string): Promise<UploadMediaResponse>;
2544
+ deleteMedia(mediaId: string, phone_number_id?: string): Promise<ResponseSuccess>;
2545
+ downloadMedia(mediaUrl: string): Promise<Blob>;
2546
+ }
2547
+ //#endregion
2548
+ //#region src/api/flow/types/common.d.ts
2549
+ /**
2550
+ * Enum for Flow Status
2551
+ */
2552
+ declare enum FlowStatusEnum {
2553
+ Draft = "DRAFT",
2554
+ Published = "PUBLISHED",
2555
+ Throttled = "THROTTLED",
2556
+ Blocked = "BLOCKED",
2557
+ Deprecated = "DEPRECATED",
2558
+ }
2559
+ /**
2560
+ * Enum for Flow Categories
2561
+ */
2562
+ declare enum FlowCategoryEnum {
2563
+ SignUp = "SIGN_UP",
2564
+ SignIn = "SIGN_IN",
2565
+ AppointmentBooking = "APPOINTMENT_BOOKING",
2566
+ LeadGeneration = "LEAD_GENERATION",
2567
+ ContactUs = "CONTACT_US",
2568
+ CustomerSupport = "CUSTOMER_SUPPORT",
2569
+ Survey = "SURVEY",
2570
+ Other = "OTHER",
2571
+ }
2572
+ declare enum FlowActionEnum {
2573
+ INIT = "INIT",
2574
+ BACK = "BACK",
2575
+ DATA_EXCHANGE = "data_exchange",
2576
+ }
2577
+ /**
2578
+ * Enum for Flow Types in webhook handlers
2579
+ * Used to register handlers for specific flow events
2580
+ */
2581
+ declare enum FlowTypeEnum {
2582
+ /** Health check/ping requests */
2583
+ Ping = "ping",
2584
+ /** Data exchange requests */
2585
+ Change = "data_exchange",
2586
+ /** Error notification requests */
2587
+ Error = "error",
2588
+ /** Match all flow action types */
2589
+ All = "*",
2590
+ }
2591
+ type FlowType = (typeof FlowTypeEnum)[keyof typeof FlowTypeEnum];
2592
+ /**
2593
+ * Flow Validation Error Pointer
2594
+ */
2595
+ interface FlowValidationErrorPointer {
2596
+ line_start: number;
2597
+ line_end: number;
2598
+ column_start: number;
2599
+ column_end: number;
2600
+ path: string;
2601
+ }
2602
+ /**
2603
+ * Flow Validation Error
2604
+ */
2605
+ interface FlowValidationError {
2606
+ error: string;
2607
+ error_type: string;
2608
+ message: string;
2609
+ line_start: number;
2610
+ line_end: number;
2611
+ column_start: number;
2612
+ column_end: number;
2613
+ pointers: FlowValidationErrorPointer[];
2614
+ }
2615
+ /**
2616
+ * Flow Item
2617
+ */
2618
+ interface Flow {
2619
+ id: string;
2620
+ name: string;
2621
+ status: FlowStatusEnum;
2622
+ categories: FlowCategoryEnum[];
2623
+ validation_errors: FlowValidationError[];
2624
+ }
2625
+ /**
2626
+ * Pagination Cursors
2627
+ */
2628
+ interface PaginationCursors {
2629
+ before: string;
2630
+ after: string;
2631
+ }
2632
+ /**
2633
+ * Pagination Object
2634
+ */
2635
+ interface Pagination {
2636
+ cursors: PaginationCursors;
2637
+ }
2638
+ /**
2639
+ * Flows List Response
2640
+ */
2641
+ interface FlowsListResponse {
2642
+ data: Flow[];
2643
+ paging: Pagination;
2644
+ }
2645
+ /**
2646
+ * Flow Asset
2647
+ */
2648
+ interface FlowAsset {
2649
+ name: string;
2650
+ asset_type: string;
2651
+ download_url: string;
2652
+ }
2653
+ /**
2654
+ * Flow Assets Response
2655
+ */
2656
+ interface FlowAssetsResponse {
2657
+ data: FlowAsset[];
2658
+ paging: Pagination;
2659
+ }
2660
+ /**
2661
+ * Flow Preview
2662
+ */
2663
+ interface FlowPreview {
2664
+ preview_url: string;
2665
+ expires_at: string;
2666
+ }
2667
+ /**
2668
+ * Flow Preview Response
2669
+ */
2670
+ interface FlowPreviewResponse {
2671
+ preview: FlowPreview;
2672
+ id: string;
2673
+ }
2674
+ /**
2675
+ * Flow Migration Result
2676
+ */
2677
+ interface FlowMigrationResult {
2678
+ source_name: string;
2679
+ source_id: string;
2680
+ migrated_id: string;
2681
+ }
2682
+ /**
2683
+ * Flow Migration Failure
2684
+ */
2685
+ interface FlowMigrationFailure {
2686
+ source_name: string;
2687
+ error_code: string;
2688
+ error_message: string;
2689
+ }
2690
+ /**
2691
+ * Create Flow Response
2692
+ */
2693
+ interface CreateFlowResponse {
2694
+ id: string;
2695
+ success: boolean;
2696
+ validation_errors?: FlowValidationError[];
2697
+ }
2698
+ /**
2699
+ * Update Flow Response
2700
+ */
2701
+ interface UpdateFlowResponse {
2702
+ success: boolean;
2703
+ validation_errors?: FlowValidationError[];
2704
+ }
2705
+ /**
2706
+ * Flow Migration Response
2707
+ */
2708
+ interface FlowMigrationResponse {
2709
+ migrated_flows: FlowMigrationResult[];
2710
+ failed_flows: FlowMigrationFailure[];
2711
+ }
2712
+ /**
2713
+ * Validate Flow JSON Response
2714
+ */
2715
+ interface ValidateFlowJsonResponse {
2716
+ valid: boolean;
2717
+ success: boolean;
2718
+ validation_errors?: FlowValidationError[];
2719
+ }
2720
+ /**
2721
+ * WhatsApp Flow Endpoint - Health Check Response
2722
+ * The expected response structure for health check requests
2723
+ */
2724
+ interface FlowHealthCheckResponse {
2725
+ data: {
2726
+ status: 'active';
2727
+ };
2728
+ }
2729
+ /**
2730
+ * WhatsApp Flow Endpoint - Data Exchange Response
2731
+ * The expected response structure for data exchange requests
2732
+ */
2733
+ interface FlowDataExchangeResponse {
2734
+ screen?: string;
2735
+ data?: Record<string, any | {
2736
+ error_message?: string;
2737
+ }>;
2738
+ }
2739
+ /**
2740
+ * WhatsApp Flow Endpoint - Success Screen Response
2741
+ * The expected response structure for success screen requests
2742
+ */
2743
+ interface FlowSuccessScreenResponse {
2744
+ screen: 'SUCCESS';
2745
+ data: {
2746
+ extension_message_response?: {
2747
+ params?: {
2748
+ flow_token: string;
2749
+ [key: string]: string;
2750
+ };
2751
+ };
2752
+ };
2753
+ }
2754
+ /**
2755
+ * WhatsApp Flow Endpoint - Error Notification Response
2756
+ * The expected response structure for error notification requests
2757
+ */
2758
+ interface FlowErrorNotificationResponse {
2759
+ acknowledged: boolean;
2760
+ }
2761
+ /**
2762
+ * WhatsApp Flow Endpoint - Comprehensive Request Object
2763
+ * A combined type that includes all possible fields from different request types
2764
+ * with all fields being optional for flexibility
2765
+ */
2766
+ interface FlowEndpointRequest {
2767
+ version?: '3.0';
2768
+ action?: 'ping' | FlowActionEnum;
2769
+ screen?: string;
2770
+ flow_token?: string;
2771
+ data?: Record<string, any> & {
2772
+ error_key?: string;
2773
+ error_message?: string;
2774
+ };
2775
+ }
2776
+ /**
2777
+ * WhatsApp Flow Endpoint - Response
2778
+ * Union type for all possible response types from a Flow endpoint
2779
+ */
2780
+ type FlowEndpointResponse = FlowHealthCheckResponse | FlowDataExchangeResponse | FlowErrorNotificationResponse | FlowSuccessScreenResponse;
2781
+ interface FlowClass {
2782
+ /**
2783
+ * List Flows
2784
+ *
2785
+ * @param wabaId - The WABA ID
2786
+ * @returns Promise with the list of flows
2787
+ */
2788
+ listFlows(wabaId: string): Promise<FlowsListResponse>;
2789
+ /**
2790
+ * Create Flow
2791
+ *
2792
+ * @param wabaId - The WABA ID
2793
+ * @param data - The flow data including name, categories, endpoint_uri, and optional clone_flow_id
2794
+ * @returns Promise with the created flow ID
2795
+ */
2796
+ createFlow(wabaId: string, data: {
2797
+ name: string;
2798
+ categories?: FlowCategoryEnum[];
2799
+ endpoint_uri?: string;
2800
+ clone_flow_id?: string;
2801
+ flow_json?: string;
2802
+ publish?: boolean;
2803
+ }): Promise<CreateFlowResponse>;
2804
+ /**
2805
+ * Get Flow
2806
+ *
2807
+ * @param flowId - The flow ID
2808
+ * @param fields - Optional fields to return
2809
+ * @param dateFormat - Optional date format
2810
+ * @returns Promise with the flow details
2811
+ */
2812
+ getFlow(flowId: string, fields?: string, dateFormat?: string): Promise<Flow | FlowPreviewResponse>;
2813
+ /**
2814
+ * Update Flow Metadata
2815
+ *
2816
+ * @param flowId - The flow ID
2817
+ * @param data - The flow metadata to update
2818
+ * @returns Promise with the success status
2819
+ */
2820
+ updateFlowMetadata(flowId: string, data: {
2821
+ name?: string;
2822
+ categories?: FlowCategoryEnum[];
2823
+ endpoint_uri?: string;
2824
+ application_id?: string;
2825
+ }): Promise<ResponseSuccess>;
2826
+ /**
2827
+ * Delete Flow
2828
+ *
2829
+ * @param flowId - The flow ID
2830
+ * @returns Promise with the success status
2831
+ */
2832
+ deleteFlow(flowId: string): Promise<ResponseSuccess>;
2833
+ /**
2834
+ * List Assets (Get Flow JSON URL)
2835
+ *
2836
+ * @param flowId - The flow ID
2837
+ * @returns Promise with the list of assets
2838
+ */
2839
+ listAssets(flowId: string): Promise<FlowAssetsResponse>;
2840
+ /**
2841
+ * Update Flow JSON
2842
+ *
2843
+ * @param flowId - The flow ID
2844
+ * @param data - The asset data including asset_type, file, and name
2845
+ * @returns Promise with the success status and validation errors
2846
+ */
2847
+ updateFlowJson(flowId: string, data: {
2848
+ file: Blob | Buffer | object;
2849
+ name?: string;
2850
+ }): Promise<UpdateFlowResponse>;
2851
+ /**
2852
+ * Validate Flow JSON by attempting an update without publishing.
2853
+ * This is a convenience method; the API doesn't have a dedicated validation endpoint.
2854
+ *
2855
+ * @param flowId - The ID of the Flow (must exist, can be in DRAFT status).
2856
+ * @param flowJsonData - The Flow JSON content as a Buffer, JSON object, or Blob.
2857
+ * @returns Promise indicating if the JSON is valid and includes validation errors if any.
2858
+ */
2859
+ validateFlowJson(flowId: string, flowJsonData: Blob | Buffer | object): Promise<ValidateFlowJsonResponse>;
2860
+ /**
2861
+ * Publish Flow
2862
+ *
2863
+ * @param flowId - The flow ID
2864
+ * @returns Promise with the success status
2865
+ */
2866
+ publishFlow(flowId: string): Promise<ResponseSuccess>;
2867
+ /**
2868
+ * Deprecate Flow
2869
+ *
2870
+ * @param flowId - The flow ID
2871
+ * @returns Promise with the success status
2872
+ */
2873
+ deprecateFlow(flowId: string): Promise<ResponseSuccess>;
2874
+ /**
2875
+ * Migrate Flows
2876
+ *
2877
+ * @param wabaId - The destination WABA ID
2878
+ * @param data - The migration data including source_waba_id and optional source_flow_names
2879
+ * @returns Promise with migration results
2880
+ */
2881
+ migrateFlows(wabaId: string, data: {
2882
+ source_waba_id: string;
2883
+ source_flow_names?: string[];
2884
+ }): Promise<FlowMigrationResponse>;
2885
+ }
2886
+ //#endregion
2887
+ //#region src/api/qrCode/types/common.d.ts
2888
+ type QrCodeResponse = {
2889
+ code: string;
2890
+ prefilled_message: string;
2891
+ deep_link_url: string;
2892
+ qr_image_url?: string;
2893
+ };
2894
+ type QrCodesResponse = ResponseData<QrCodeResponse[]>;
2895
+ type CreateQrCodeRequest = {
2896
+ prefilled_message: string;
2897
+ generate_qr_image?: 'SVG' | 'PNG';
2898
+ };
2899
+ type UpdateQrCodeRequest = {
2900
+ code: string;
2901
+ prefilled_message: string;
2902
+ };
2903
+ interface QrCodeClass {
2904
+ createQrCode(request: CreateQrCodeRequest): Promise<QrCodeResponse>;
2905
+ getQrCodes(): Promise<QrCodesResponse>;
2906
+ getQrCode(qrCodeId: string): Promise<QrCodeResponse>;
2907
+ updateQrCode(request: UpdateQrCodeRequest): Promise<QrCodeResponse>;
2908
+ deleteQrCode(qrCodeId: string): Promise<ResponseSuccess>;
2909
+ }
2910
+ //#endregion
2911
+ //#region src/api/waba/types/common.d.ts
2912
+ /**
2913
+ * WhatsApp Business Account subscription configuration
2914
+ */
2915
+ type WabaSubscription = {
2916
+ whatsapp_business_api_data: {
2917
+ id: string;
2918
+ link: string;
2919
+ name: string;
2920
+ category: string;
2921
+ };
2922
+ override_callback_uri?: string;
2923
+ };
2924
+ /**
2925
+ * Parameters for updating WABA subscription
2926
+ */
2927
+ interface UpdateWabaSubscription {
2928
+ override_callback_uri: string;
2929
+ verify_token: string;
2930
+ }
2931
+ /**
2932
+ * Response containing all WABA subscriptions
2933
+ */
2934
+ interface WabaSubscriptions {
2935
+ data: Array<WabaSubscription>;
2936
+ }
2937
+ /**
2938
+ * WABA account review status enumeration
2939
+ */
2940
+ declare enum WabaAccountReviewStatus {
2941
+ Approved = "APPROVED",
2942
+ Active = "ACTIVE",
2943
+ Inactive = "INACTIVE",
2944
+ Disabled = "DISABLED",
2945
+ }
2946
+ /**
2947
+ * WABA health status for message sending capability
2948
+ */
2949
+ declare enum WabaHealthStatusCanSendMessage {
2950
+ Blocked = "BLOCKED",
2951
+ Limited = "LIMITED",
2952
+ Available = "AVAILABLE",
2953
+ }
2954
+ /**
2955
+ * WABA account status enumeration
2956
+ */
2957
+ declare enum WabaAccountStatus {
2958
+ Approved = "APPROVED",
2959
+ Active = "ACTIVE",
2960
+ Inactive = "INACTIVE",
2961
+ Disabled = "DISABLED",
2962
+ }
2963
+ /**
2964
+ * Business verification status enumeration
2965
+ */
2966
+ declare enum WabaBusinessVerificationStatus {
2967
+ Verified = "verified",
2968
+ PendingSubmission = "pending_submission",
2969
+ Unverified = "unverified",
2970
+ Rejected = "rejected",
2971
+ }
2972
+ /**
2973
+ * WABA health status error details
2974
+ */
2975
+ interface WabaHealthStatusError {
2976
+ error_code?: number;
2977
+ error_description?: string;
2978
+ possible_solution?: string;
2979
+ }
2980
+ /**
2981
+ * WABA health status entity information
2982
+ */
2983
+ interface WabaHealthStatusEntity {
2984
+ entity_type?: string;
2985
+ id?: string;
2986
+ can_send_message?: string;
2987
+ errors?: WabaHealthStatusError[];
2988
+ }
2989
+ /**
2990
+ * Overall WABA health status
2991
+ */
2992
+ interface WabaHealthStatus {
2993
+ can_send_message?: WabaHealthStatusCanSendMessage;
2994
+ entities?: WabaHealthStatusEntity[];
2995
+ }
2996
+ /**
2997
+ * WhatsApp Business Account information
2998
+ */
2999
+ interface WabaAccount {
3000
+ account_review_status?: WabaAccountReviewStatus;
3001
+ id?: string;
3002
+ health_status?: WabaHealthStatus;
3003
+ status?: WabaAccountStatus;
3004
+ business_verification_status?: WabaBusinessVerificationStatus;
3005
+ message_template_namespace?: string;
3006
+ name?: string;
3007
+ ownership_type?: string;
3008
+ currency?: string;
3009
+ }
3010
+ /**
3011
+ * Available fields for WABA account queries
3012
+ */
3013
+ type WabaAccountFields = 'id' | 'name' | 'account_review_status' | 'auth_international_rate_eligibility' | 'business_verification_status' | 'country' | 'currency' | 'health_status' | 'status' | 'ownership_type' | 'message_template_namespace';
3014
+ /**
3015
+ * Parameter type for specifying which WABA account fields to retrieve
3016
+ */
3017
+ type WabaAccountFieldsParam = WabaAccountFields[];
3018
+ /**
3019
+ * Interface defining all WABA API methods
3020
+ */
3021
+ interface WABAClass {
3022
+ getWabaAccount(fields?: WabaAccountFieldsParam): Promise<WabaAccount>;
3023
+ getAllWabaSubscriptions(): Promise<WabaSubscriptions>;
3024
+ updateWabaSubscription(params: UpdateWabaSubscription): Promise<ResponseSuccess>;
3025
+ unsubscribeFromWaba(): Promise<ResponseSuccess>;
3026
+ }
3027
+ //#endregion
3028
+ //#region src/api/registration/types/common.d.ts
3029
+ type RegistrationRequest = {
3030
+ messaging_product: 'whatsapp';
3031
+ pin: string;
3032
+ data_localization_region?: DataLocalizationRegionEnum;
3033
+ };
3034
+ interface RegistrationClass {
3035
+ register(pin: string, dataLocalizationRegion?: DataLocalizationRegionEnum): Promise<ResponseSuccess>;
3036
+ deregister(): Promise<ResponseSuccess>;
3037
+ }
3038
+ //#endregion
3039
+ //#region src/api/twoStepVerification/types/common.d.ts
3040
+ type TwoStepVerificationRequest = {
3041
+ pin: string;
3042
+ };
3043
+ interface TwoStepVerificationClass {
3044
+ setTwoStepVerificationCode(pin: string): Promise<ResponseSuccess>;
3045
+ }
3046
+ //#endregion
3047
+ //#region src/api/encryption/types/publicKey.d.ts
3048
+ type EncryptionPublicKeyResponse = ResponseData<{
3049
+ business_public_key: string;
3050
+ business_public_key_signature_status: 'VALID' | 'MISMATCH';
3051
+ }>;
3052
+ //#endregion
3053
+ //#region src/api/encryption/types/common.d.ts
3054
+ interface EncryptionClass {
3055
+ getEncryptionPublicKey(): Promise<EncryptionPublicKeyResponse>;
3056
+ setEncryptionPublicKey(businessPublicKey: string): Promise<ResponseSuccess>;
3057
+ }
3058
+ //#endregion
3059
+ //#region src/utils/http/httpsClient.d.ts
3060
+ declare class HttpsClient implements HttpsClientClass {
3061
+ agent: Agent;
3062
+ constructor();
3063
+ clearSockets(): boolean;
3064
+ sendRequest(hostname: string, path: string, method: HttpMethodsEnum, headers: HeadersInit, timeout: number, body?: BodyInit | null): Promise<HttpsClientResponseClass>;
3065
+ }
3066
+ //#endregion
3067
+ //#region src/utils/http/request.d.ts
3068
+ declare class Requester implements RequesterClass {
3069
+ client: Readonly<HttpsClient>;
3070
+ accessToken: Readonly<string>;
3071
+ phoneNumberId: Readonly<number>;
3072
+ businessAcctId: Readonly<string>;
3073
+ apiVersion: Readonly<string>;
3074
+ userAgent: Readonly<string>;
3075
+ host: Readonly<string>;
3076
+ protocol: Readonly<string>;
3077
+ constructor(apiVersion: string, phoneNumberId: number, accessToken: string, businessAcctId: string, userAgent: string);
3078
+ buildHeader(contentType: string, additionalHeaders?: Record<string, string>): HeadersInit;
3079
+ buildCAPIPath(endpoint: string): string;
3080
+ sendRequest(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any, contentType?: string, additionalHeaders?: Record<string, string>): Promise<HttpsClientResponseClass>;
3081
+ getJson<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any, additionalHeaders?: Record<string, string>): Promise<T>;
3082
+ sendFormData<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: FormData, additionalHeaders?: Record<string, string>): Promise<T>;
3083
+ sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: Record<string, string>, additionalHeaders?: Record<string, string>): Promise<T>;
3084
+ }
3085
+ //#endregion
3086
+ //#region src/api/encryption/EncryptionApi.d.ts
3087
+ declare class EncryptionApi extends BaseAPI implements EncryptionClass {
3088
+ private readonly endpoint;
3089
+ constructor(config: WabaConfigType, client: RequesterClass);
3090
+ getEncryptionPublicKey(): Promise<EncryptionPublicKeyResponse>;
3091
+ setEncryptionPublicKey(businessPublicKey: string): Promise<ResponseSuccess>;
3092
+ }
3093
+ //#endregion
3094
+ //#region src/api/flow/FlowApi.d.ts
3095
+ /**
3096
+ * API for managing WhatsApp Flows.
3097
+ *
3098
+ * This API allows you to:
3099
+ * - List flows
3100
+ * - Create flows
3101
+ * - Get flow details and previews
3102
+ * - Update flow metadata and JSON
3103
+ * - Delete flows
3104
+ * - Publish and deprecate flows
3105
+ * - Migrate flows between WABAs
3106
+ * - Validate flow JSON
3107
+ */
3108
+ declare class FlowApi extends BaseAPI implements FlowClass {
3109
+ constructor(config: WabaConfigType, client: RequesterClass);
3110
+ /**
3111
+ * List Flows
3112
+ *
3113
+ * @param wabaId - The WABA ID
3114
+ * @returns Promise with the list of flows
3115
+ */
3116
+ listFlows(wabaId: string): Promise<FlowsListResponse>;
3117
+ /**
3118
+ * Create Flow
3119
+ *
3120
+ * @param wabaId - The WABA ID
3121
+ * @param data - The flow data including name, categories, endpoint_uri, and optional clone_flow_id
3122
+ * @returns Promise with the created flow ID and validation errors if any
3123
+ */
3124
+ createFlow(wabaId: string, data: {
3125
+ name: string;
3126
+ categories?: FlowCategoryEnum[];
3127
+ endpoint_uri?: string;
3128
+ clone_flow_id?: string;
3129
+ flow_json?: string;
3130
+ publish?: boolean;
3131
+ }): Promise<CreateFlowResponse>;
3132
+ /**
3133
+ * Get Flow details
3134
+ *
3135
+ * @param flowId - The flow ID
3136
+ * @param fields - Optional fields to return (e.g., 'name,status,preview.invalidate(false)')
3137
+ * @param dateFormat - Optional date format
3138
+ * @returns Promise with the flow details or preview response
3139
+ */
3140
+ getFlow(flowId: string, fields?: string, dateFormat?: string): Promise<Flow | FlowPreviewResponse>;
3141
+ /**
3142
+ * Get Flow Preview URL
3143
+ *
3144
+ * @param flowId - The flow ID
3145
+ * @param invalidate - Optional. If true, invalidates existing preview and generates a new one. Defaults to false.
3146
+ * @returns Promise with the flow preview details
3147
+ */
3148
+ getFlowPreview(flowId: string, invalidate?: boolean): Promise<FlowPreviewResponse>;
3149
+ /**
3150
+ * Update Flow Metadata
3151
+ *
3152
+ * @param flowId - The flow ID
3153
+ * @param data - The flow metadata to update (name, categories, endpoint_uri, application_id)
3154
+ * @returns Promise with the success status
3155
+ */
3156
+ updateFlowMetadata(flowId: string, data: {
3157
+ name?: string;
3158
+ categories?: FlowCategoryEnum[];
3159
+ endpoint_uri?: string;
3160
+ application_id?: string;
3161
+ }): Promise<ResponseSuccess>;
3162
+ /**
3163
+ * Delete Flow (only works if the Flow is in DRAFT status)
3164
+ *
3165
+ * @param flowId - The flow ID
3166
+ * @returns Promise with the success status
3167
+ */
3168
+ deleteFlow(flowId: string): Promise<ResponseSuccess>;
3169
+ /**
3170
+ * List Assets (e.g., get Flow JSON download URL)
3171
+ *
3172
+ * @param flowId - The flow ID
3173
+ * @returns Promise with the list of assets
3174
+ */
3175
+ listAssets(flowId: string): Promise<FlowAssetsResponse>;
3176
+ /**
3177
+ * Update Flow JSON by uploading a file, buffer, JSON object, or Blob.
3178
+ *
3179
+ * @param flowId - The flow ID
3180
+ * @param data - Object containing the file data and optional name.
3181
+ * @param data.file - The Flow JSON content as a Buffer, JSON object, or Blob.
3182
+ * @param data.name - Optional name for the asset, defaults to 'flow.json'.
3183
+ * @returns Promise with the success status and validation errors, if any.
3184
+ */
3185
+ updateFlowJson(flowId: string, data: {
3186
+ file: Blob | Buffer | object;
3187
+ name?: string;
3188
+ }): Promise<UpdateFlowResponse>;
3189
+ /**
3190
+ * Validate Flow JSON by attempting an update without publishing.
3191
+ * This is a convenience method; the API doesn't have a dedicated validation endpoint.
3192
+ *
3193
+ * @param flowId - The ID of the Flow (must exist, can be in DRAFT status).
3194
+ * @param flowJsonData - The Flow JSON content as a file path (string), Buffer, JSON object, or Blob.
3195
+ * @returns Promise indicating if the JSON is valid and includes validation errors if any.
3196
+ */
3197
+ validateFlowJson(flowId: string, flowJsonData: Blob | Buffer | object): Promise<ValidateFlowJsonResponse>;
3198
+ /**
3199
+ * Publish Flow
3200
+ *
3201
+ * @param flowId - The flow ID
3202
+ * @returns Promise with the success status
3203
+ */
3204
+ publishFlow(flowId: string): Promise<ResponseSuccess>;
3205
+ /**
3206
+ * Deprecate Flow
3207
+ *
3208
+ * @param flowId - The flow ID
3209
+ * @returns Promise with the success status
3210
+ */
3211
+ deprecateFlow(flowId: string): Promise<ResponseSuccess>;
3212
+ /**
3213
+ * Migrate Flows between WABAs
3214
+ *
3215
+ * @param destinationWabaId - The destination WABA ID
3216
+ * @param data - The migration data including source_waba_id and optional source_flow_names
3217
+ * @returns Promise with migration results (successes and failures)
3218
+ */
3219
+ migrateFlows(destinationWabaId: string, data: {
3220
+ source_waba_id: string;
3221
+ source_flow_names?: string[];
3222
+ }): Promise<FlowMigrationResponse>;
3223
+ }
3224
+ //#endregion
3225
+ //#region src/api/media/MediaApi.d.ts
3226
+ /**
3227
+ * API for managing WhatsApp Media.
3228
+ *
3229
+ * This API allows you to:
3230
+ * - Get media information by ID
3231
+ * - Upload media files
3232
+ * - Delete media files
3233
+ * - Download media files from URLs
3234
+ */
3235
+ declare class MediaApi extends BaseAPI implements MediaClass {
3236
+ private readonly endpoint;
3237
+ constructor(config: WabaConfigType, client: RequesterClass);
3238
+ /**
3239
+ * Retrieve media information by media ID.
3240
+ *
3241
+ * @param mediaId The media ID to retrieve information for
3242
+ * @param phone_number_id Optional phone number ID (defaults to configured one)
3243
+ * @returns Media information including URL, mime type, file size, etc.
3244
+ *
3245
+ * @example
3246
+ * const mediaInfo = await whatsappClient.media.getMediaById('media_id_123');
3247
+ */
3248
+ getMediaById(mediaId: string, phone_number_id?: string): Promise<MediaResponse>;
3249
+ /**
3250
+ * Upload a media file to WhatsApp.
3251
+ *
3252
+ * @param file The file to upload
3253
+ * @param messagingProduct The messaging product (default: 'whatsapp')
3254
+ * @returns Upload response containing the media ID
3255
+ *
3256
+ * @example
3257
+ * const file = new File([buffer], 'image.jpg', { type: 'image/jpeg' });
3258
+ * const result = await whatsappClient.media.uploadMedia(file);
3259
+ */
3260
+ uploadMedia(file: File, messagingProduct?: string): Promise<UploadMediaResponse>;
3261
+ /**
3262
+ * Delete a media file.
3263
+ *
3264
+ * @param mediaId The media ID to delete
3265
+ * @param phone_number_id Optional phone number ID (defaults to configured one)
3266
+ * @returns Response indicating success or failure
3267
+ *
3268
+ * @example
3269
+ * await whatsappClient.media.deleteMedia('media_id_123');
3270
+ */
3271
+ deleteMedia(mediaId: string, phone_number_id?: string): Promise<ResponseSuccess>;
3272
+ /**
3273
+ * Download media from a URL.
3274
+ *
3275
+ * @param mediaUrl The URL to download media from
3276
+ * @returns Blob containing the media data
3277
+ *
3278
+ * @example
3279
+ * const blob = await whatsappClient.media.downloadMedia('https://...');
3280
+ */
3281
+ downloadMedia(mediaUrl: string): Promise<Blob>;
3282
+ }
3283
+ //#endregion
3284
+ //#region src/api/messages/MessageApi.d.ts
3285
+ /**
3286
+ * Maps each message type to its appropriate payload type
3287
+ */
3288
+ type MessagePayloadType<T extends MessageTypesEnum> = T extends MessageTypesEnum.Audio ? AudioMediaObject : T extends MessageTypesEnum.Contacts ? [ContactObject] : T extends MessageTypesEnum.Document ? DocumentMediaObject : T extends MessageTypesEnum.Image ? ImageMediaObject : T extends MessageTypesEnum.Interactive ? InteractiveObject : T extends MessageTypesEnum.Location ? LocationObject : T extends MessageTypesEnum.Template ? MessageTemplateObject<ComponentTypesEnum> : T extends MessageTypesEnum.Sticker ? StickerMediaObject : T extends MessageTypesEnum.Text ? TextObject : T extends MessageTypesEnum.Video ? VideoMediaObject : T extends MessageTypesEnum.Reaction ? {
3289
+ message_id: string;
3290
+ emoji: string;
3291
+ } : never;
3292
+ declare class MessagesApi extends BaseAPI implements MessagesClass {
3293
+ private readonly commonMethod;
3294
+ private readonly commonEndpoint;
3295
+ constructor(config: WabaConfigType, client: RequesterClass);
3296
+ /**
3297
+ * Builds the request body for WhatsApp API messages
3298
+ * @param type The type of message to send
3299
+ * @param payload The message payload object
3300
+ * @param to The recipient's phone number
3301
+ * @param replyMessageId Optional message ID to reply to
3302
+ * @returns The formatted request body
3303
+ */
3304
+ bodyBuilder<T extends MessageTypesEnum>(type: T, payload: MessagePayloadType<T>, to: string, replyMessageId?: string): MessageRequestBody<T>;
3305
+ /**
3306
+ * Sends a request to the WhatsApp API
3307
+ * @param body The request body to send
3308
+ * @returns Promise with the API response
3309
+ */
3310
+ private send;
3311
+ /**
3312
+ * Sends an audio message via WhatsApp
3313
+ * @param params The audio message parameter object
3314
+ * @returns Promise with the message response
3315
+ */
3316
+ audio(params: MessageRequestParams<AudioMediaObject>): Promise<MessagesResponse>;
3317
+ /**
3318
+ * Sends a contact card via WhatsApp
3319
+ * @param params The contact message parameter object
3320
+ * @returns Promise with the message response
3321
+ */
3322
+ contacts(params: MessageRequestParams<[ContactObject]>): Promise<MessagesResponse>;
3323
+ /**
3324
+ * Sends a document via WhatsApp
3325
+ * @param params The document message parameter object
3326
+ * @returns Promise with the message response
3327
+ */
3328
+ document(params: MessageRequestParams<DocumentMediaObject>): Promise<MessagesResponse>;
3329
+ /**
3330
+ * Sends an image via WhatsApp
3331
+ * @param params The image message parameter object
3332
+ * @returns Promise with the message response
3333
+ */
3334
+ image(params: MessageRequestParams<ImageMediaObject>): Promise<MessagesResponse>;
3335
+ /**
3336
+ * Sends an interactive message via WhatsApp
3337
+ * @param params The interactive message parameter object
3338
+ * @returns Promise with the message response
3339
+ */
3340
+ interactive(params: MessageRequestParams<InteractiveObject>): Promise<MessagesResponse>;
3341
+ /**
3342
+ * Sends a location via WhatsApp
3343
+ * @param params The location message parameter object
3344
+ * @returns Promise with the message response
3345
+ */
3346
+ location(params: MessageRequestParams<LocationObject>): Promise<MessagesResponse>;
3347
+ /**
3348
+ * Sends a sticker via WhatsApp
3349
+ * @param params The sticker message parameter object
3350
+ * @returns Promise with the message response
3351
+ */
3352
+ sticker(params: MessageRequestParams<StickerMediaObject>): Promise<MessagesResponse>;
3353
+ /**
3354
+ * Sends a template message via WhatsApp
3355
+ * @param params The template message parameter object
3356
+ * @returns Promise with the message response
3357
+ */
3358
+ template(params: MessageRequestParams<MessageTemplateObject<ComponentTypesEnum>>): Promise<MessagesResponse>;
3359
+ /**
3360
+ * Sends a text message via WhatsApp
3361
+ * @param params The text message parameter object
3362
+ * @returns Promise with the message response
3363
+ */
3364
+ text(params: TextMessageParams): Promise<MessagesResponse>;
3365
+ /**
3366
+ * Sends a video message via WhatsApp
3367
+ * @param params The video message parameter object
3368
+ * @returns Promise with the message response
3369
+ */
3370
+ video(params: MessageRequestParams<VideoMediaObject>): Promise<MessagesResponse>;
3371
+ /**
3372
+ * Updates message status (mark as read, etc.)
3373
+ * @param params The status update parameters
3374
+ * @returns Promise with the API response
3375
+ */
3376
+ status(params: StatusParams): Promise<MessagesResponse>;
3377
+ /**
3378
+ * Marks a message as read
3379
+ * @param params Object containing messageId
3380
+ * @returns Promise with the API response
3381
+ */
3382
+ markAsRead(params: {
3383
+ messageId: string;
3384
+ }): Promise<MessagesResponse>;
3385
+ /**
3386
+ * Shows typing indicator
3387
+ * @param params Object containing messageId
3388
+ * @returns Promise with the API response
3389
+ */
3390
+ showTypingIndicator(params: {
3391
+ messageId: string;
3392
+ }): Promise<MessagesResponse>;
3393
+ /**
3394
+ * Sends a list interactive message
3395
+ * @param params The list interactive message parameters
3396
+ * @returns Promise with the message response
3397
+ */
3398
+ interactiveList(params: MessageRequestParams<InteractiveObject & {
3399
+ type: InteractiveTypesEnum.List;
3400
+ }>): Promise<MessagesResponse>;
3401
+ /**
3402
+ * Sends a CTA URL interactive message
3403
+ * @param params The CTA URL interactive message parameters
3404
+ * @returns Promise with the message response
3405
+ */
3406
+ interactiveCtaUrl(params: MessageRequestParams<InteractiveObject & {
3407
+ type: InteractiveTypesEnum.CtaUrl;
3408
+ }>): Promise<MessagesResponse>;
3409
+ /**
3410
+ * Sends a location request interactive message
3411
+ * @param params The location request interactive message parameters
3412
+ * @returns Promise with the message response
3413
+ */
3414
+ interactiveLocationRequest(params: MessageRequestParams<InteractiveObject & {
3415
+ type: InteractiveTypesEnum.LocationRequest;
3416
+ }>): Promise<MessagesResponse>;
3417
+ /**
3418
+ * Sends an address message interactive message
3419
+ * @param params The address message interactive message parameters
3420
+ * @returns Promise with the message response
3421
+ */
3422
+ interactiveAddressMessage(params: MessageRequestParams<InteractiveObject & {
3423
+ type: InteractiveTypesEnum.AddressMessage;
3424
+ }>): Promise<MessagesResponse>;
3425
+ /**
3426
+ * Sends a reply buttons interactive message
3427
+ * @param params The reply buttons interactive message parameters
3428
+ * @returns Promise with the message response
3429
+ */
3430
+ interactiveReplyButtons(params: MessageRequestParams<InteractiveObject & {
3431
+ type: InteractiveTypesEnum.Button;
3432
+ }>): Promise<MessagesResponse>;
3433
+ /**
3434
+ * Sends a flow interactive message
3435
+ * @param params The flow interactive message parameters
3436
+ * @returns Promise with the message response
3437
+ */
3438
+ interactiveFlow(params: MessageRequestParams<InteractiveObject & {
3439
+ type: InteractiveTypesEnum.Flow;
3440
+ }>): Promise<MessagesResponse>;
3441
+ /**
3442
+ * Sends a reaction to a message
3443
+ * @param params The reaction parameters
3444
+ * @returns Promise with the message response
3445
+ */
3446
+ reaction(params: ReactionParams): Promise<MessagesResponse>;
10
3447
  }
11
- declare class HttpsClientResponse implements HttpsClientResponseClass {
12
- res: Response;
13
- respStatusCode: number;
14
- respHeaders: ResponseHeaders;
15
- constructor(resp: Response);
16
- statusCode(): number;
17
- headers(): ResponseHeaders;
18
- rawResponse(): Response;
19
- json(): Promise<ResponseJSONBody>;
3448
+ //#endregion
3449
+ //#region src/api/messages/builders/ContactMessageBuilder.d.ts
3450
+ /**
3451
+ * Builder class for creating contact messages with a fluent API
3452
+ */
3453
+ declare class ContactMessageBuilder {
3454
+ private contact;
3455
+ /**
3456
+ * Set the contact name (required)
3457
+ */
3458
+ setName(name: NameObject): this;
3459
+ /**
3460
+ * Set simple name with first name only
3461
+ */
3462
+ setSimpleName(firstName: string, lastName?: string): this;
3463
+ /**
3464
+ * Set full name details
3465
+ */
3466
+ setFullName(firstName: string, lastName?: string, middleName?: string, suffix?: string, prefix?: string): this;
3467
+ /**
3468
+ * Add phone numbers
3469
+ */
3470
+ addPhone(phone: string, type?: string, waId?: string): this;
3471
+ /**
3472
+ * Add email addresses
3473
+ */
3474
+ addEmail(email: string, type?: string): this;
3475
+ /**
3476
+ * Add address
3477
+ */
3478
+ addAddress(address: AddressesObject): this;
3479
+ /**
3480
+ * Add simple address
3481
+ */
3482
+ addSimpleAddress(street: string, city: string, country: string, type?: string): this;
3483
+ /**
3484
+ * Set organization details
3485
+ */
3486
+ setOrganization(company: string, department?: string, title?: string): this;
3487
+ /**
3488
+ * Add URL
3489
+ */
3490
+ addUrl(url: string, type?: string): this;
3491
+ /**
3492
+ * Set birthday (format: YYYY-MM-DD)
3493
+ */
3494
+ setBirthday(year: number, month: number, day: number): this;
3495
+ /**
3496
+ * Build the final contact object
3497
+ */
3498
+ build(): ContactObject;
3499
+ /**
3500
+ * Reset the builder for reuse
3501
+ */
3502
+ reset(): this;
3503
+ }
3504
+ /**
3505
+ * Factory class for common contact patterns
3506
+ */
3507
+ declare class ContactMessageFactory {
3508
+ /**
3509
+ * Create a simple contact with name and phone
3510
+ */
3511
+ static createSimpleContact(firstName: string, phone: string): ContactObject;
3512
+ /**
3513
+ * Create a business contact
3514
+ */
3515
+ static createBusinessContact(firstName: string, lastName: string, company: string, title: string, phone: string, email: string): ContactObject;
3516
+ /**
3517
+ * Create a personal contact with full details
3518
+ */
3519
+ static createPersonalContact(firstName: string, lastName: string, mobilePhone: string, email?: string, birthday?: {
3520
+ year: number;
3521
+ month: number;
3522
+ day: number;
3523
+ }): ContactObject;
20
3524
  }
21
3525
  //#endregion
22
- //#region src/utils/http/request.d.ts
23
- declare class Requester implements RequesterClass {
24
- client: Readonly<HttpsClient>;
25
- accessToken: Readonly<string>;
26
- phoneNumberId: Readonly<number>;
27
- businessAcctId: Readonly<string>;
28
- apiVersion: Readonly<string>;
29
- userAgent: Readonly<string>;
30
- host: Readonly<string>;
31
- protocol: Readonly<string>;
32
- constructor(apiVersion: string, phoneNumberId: number, accessToken: string, businessAcctId: string, userAgent: string);
33
- buildHeader(contentType: string, additionalHeaders?: Record<string, string>): HeadersInit;
34
- buildCAPIPath(endpoint: string): string;
35
- sendRequest(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any, contentType?: string, additionalHeaders?: Record<string, string>): Promise<HttpsClientResponseClass>;
36
- getJson<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any, additionalHeaders?: Record<string, string>): Promise<T>;
37
- sendFormData<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: FormData, additionalHeaders?: Record<string, string>): Promise<T>;
38
- sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: Record<string, string>, additionalHeaders?: Record<string, string>): Promise<T>;
3526
+ //#region src/api/messages/builders/InteractiveMessageBuilder.d.ts
3527
+ /**
3528
+ * Builder class for creating interactive messages with a fluent API
3529
+ */
3530
+ declare class InteractiveMessageBuilder {
3531
+ private message;
3532
+ /**
3533
+ * Set the interactive message type
3534
+ */
3535
+ setType(type: InteractiveTypesEnum): this;
3536
+ /**
3537
+ * Set the body text of the message
3538
+ */
3539
+ setBody(text: string): this;
3540
+ /**
3541
+ * Set the footer text of the message
3542
+ */
3543
+ setFooter(text: string): this;
3544
+ /**
3545
+ * Set a text header
3546
+ */
3547
+ setTextHeader(text: string): this;
3548
+ /**
3549
+ * Set an image header
3550
+ */
3551
+ setImageHeader(imageUrl: string): this;
3552
+ /**
3553
+ * Add reply buttons (for button type messages)
3554
+ */
3555
+ addReplyButtons(buttons: Array<{
3556
+ id: string;
3557
+ title: string;
3558
+ }>): this;
3559
+ /**
3560
+ * Add list sections (for list type messages)
3561
+ * Note: This creates a single section with multiple rows
3562
+ */
3563
+ addListSections(sections: Array<{
3564
+ title?: string;
3565
+ rows: Array<{
3566
+ id: string;
3567
+ title: string;
3568
+ description?: string;
3569
+ }>;
3570
+ }>): this;
3571
+ /**
3572
+ * Set the button text for list messages
3573
+ */
3574
+ setListButtonText(buttonText: string): this;
3575
+ /**
3576
+ * Set CTA URL action
3577
+ */
3578
+ setCTAUrl(displayText: string, url: string): this;
3579
+ /**
3580
+ * Build the final interactive object
3581
+ */
3582
+ build(): InteractiveObject;
3583
+ /**
3584
+ * Reset the builder for reuse
3585
+ */
3586
+ reset(): this;
3587
+ }
3588
+ /**
3589
+ * Convenience factory functions for common interactive message types
3590
+ */
3591
+ declare class InteractiveMessageFactory {
3592
+ /**
3593
+ * Create a button message with reply buttons
3594
+ */
3595
+ static createButtonMessage(bodyText: string, buttons: Array<{
3596
+ id: string;
3597
+ title: string;
3598
+ }>, options?: {
3599
+ headerText?: string;
3600
+ footerText?: string;
3601
+ }): InteractiveObject;
3602
+ /**
3603
+ * Create a list message with sections
3604
+ */
3605
+ static createListMessage(bodyText: string, buttonText: string, sections: Array<{
3606
+ title?: string;
3607
+ rows: Array<{
3608
+ id: string;
3609
+ title: string;
3610
+ description?: string;
3611
+ }>;
3612
+ }>, options?: {
3613
+ headerText?: string;
3614
+ footerText?: string;
3615
+ }): InteractiveObject;
3616
+ /**
3617
+ * Create a CTA URL message
3618
+ */
3619
+ static createCTAUrlMessage(bodyText: string, displayText: string, url: string, options?: {
3620
+ headerText?: string;
3621
+ footerText?: string;
3622
+ }): InteractiveObject;
39
3623
  }
40
3624
  //#endregion
41
- //#region src/api/encryption/EncryptionApi.d.ts
42
- declare class EncryptionApi extends BaseAPI implements EncryptionClass {
43
- private readonly endpoint;
44
- constructor(config: WabaConfigType, client: RequesterClass);
45
- getEncryptionPublicKey(): Promise<EncryptionPublicKeyResponse>;
46
- setEncryptionPublicKey(businessPublicKey: string): Promise<ResponseSuccess>;
3625
+ //#region src/api/messages/builders/LocationMessageBuilder.d.ts
3626
+ /**
3627
+ * Builder class for creating location messages with a fluent API
3628
+ */
3629
+ declare class LocationMessageBuilder {
3630
+ private location;
3631
+ /**
3632
+ * Set the latitude coordinate
3633
+ */
3634
+ setLatitude(latitude: number): this;
3635
+ /**
3636
+ * Set the longitude coordinate
3637
+ */
3638
+ setLongitude(longitude: number): this;
3639
+ /**
3640
+ * Set coordinates using latitude and longitude
3641
+ */
3642
+ setCoordinates(latitude: number, longitude: number): this;
3643
+ /**
3644
+ * Set the location name
3645
+ */
3646
+ setName(name: string): this;
3647
+ /**
3648
+ * Set the location address
3649
+ */
3650
+ setAddress(address: string): this;
3651
+ /**
3652
+ * Build the final location object
3653
+ */
3654
+ build(): LocationObject;
3655
+ /**
3656
+ * Reset the builder for reuse
3657
+ */
3658
+ reset(): this;
3659
+ }
3660
+ /**
3661
+ * Factory class for common location patterns
3662
+ */
3663
+ declare class LocationMessageFactory {
3664
+ /**
3665
+ * Create a simple location with just coordinates
3666
+ */
3667
+ static createSimpleLocation(latitude: number, longitude: number): LocationObject;
3668
+ /**
3669
+ * Create a location with name and address
3670
+ */
3671
+ static createNamedLocation(latitude: number, longitude: number, name: string, address: string): LocationObject;
3672
+ /**
3673
+ * Create a business location
3674
+ */
3675
+ static createBusinessLocation(latitude: number, longitude: number, businessName: string, fullAddress: string): LocationObject;
47
3676
  }
48
3677
  //#endregion
49
- //#region src/api/flow/FlowApi.d.ts
3678
+ //#region src/api/messages/builders/MediaMessageBuilder.d.ts
50
3679
  /**
51
- * API for managing WhatsApp Flows.
52
- *
53
- * This API allows you to:
54
- * - List flows
55
- * - Create flows
56
- * - Get flow details and previews
57
- * - Update flow metadata and JSON
58
- * - Delete flows
59
- * - Publish and deprecate flows
60
- * - Migrate flows between WABAs
61
- * - Validate flow JSON
3680
+ * Base builder for media messages
62
3681
  */
63
- declare class FlowApi extends BaseAPI implements FlowClass {
64
- constructor(config: WabaConfigType, client: RequesterClass);
3682
+ declare abstract class BaseMediaBuilder<T> {
3683
+ protected media: Partial<T>;
65
3684
  /**
66
- * List Flows
67
- *
68
- * @param wabaId - The WABA ID
69
- * @returns Promise with the list of flows
3685
+ * Set media ID (for uploaded media)
70
3686
  */
71
- listFlows(wabaId: string): Promise<FlowsListResponse>;
3687
+ setId(id: string): this;
72
3688
  /**
73
- * Create Flow
74
- *
75
- * @param wabaId - The WABA ID
76
- * @param data - The flow data including name, categories, endpoint_uri, and optional clone_flow_id
77
- * @returns Promise with the created flow ID and validation errors if any
3689
+ * Set media URL
78
3690
  */
79
- createFlow(wabaId: string, data: {
80
- name: string;
81
- categories?: FlowCategoryEnum[];
82
- endpoint_uri?: string;
83
- clone_flow_id?: string;
84
- flow_json?: string;
85
- publish?: boolean;
86
- }): Promise<CreateFlowResponse>;
3691
+ setLink(url: string): this;
87
3692
  /**
88
- * Get Flow details
89
- *
90
- * @param flowId - The flow ID
91
- * @param fields - Optional fields to return (e.g., 'name,status,preview.invalidate(false)')
92
- * @param dateFormat - Optional date format
93
- * @returns Promise with the flow details or preview response
3693
+ * Set media caption
94
3694
  */
95
- getFlow(flowId: string, fields?: string, dateFormat?: string): Promise<Flow | FlowPreviewResponse>;
3695
+ setCaption(caption: string): this;
96
3696
  /**
97
- * Get Flow Preview URL
98
- *
99
- * @param flowId - The flow ID
100
- * @param invalidate - Optional. If true, invalidates existing preview and generates a new one. Defaults to false.
101
- * @returns Promise with the flow preview details
3697
+ * Build the media object
102
3698
  */
103
- getFlowPreview(flowId: string, invalidate?: boolean): Promise<FlowPreviewResponse>;
3699
+ build(): T;
104
3700
  /**
105
- * Update Flow Metadata
106
- *
107
- * @param flowId - The flow ID
108
- * @param data - The flow metadata to update (name, categories, endpoint_uri, application_id)
109
- * @returns Promise with the success status
3701
+ * Reset the builder
110
3702
  */
111
- updateFlowMetadata(flowId: string, data: {
112
- name?: string;
113
- categories?: FlowCategoryEnum[];
114
- endpoint_uri?: string;
115
- application_id?: string;
116
- }): Promise<ResponseSuccess>;
3703
+ reset(): this;
3704
+ }
3705
+ /**
3706
+ * Builder for image messages
3707
+ */
3708
+ declare class ImageMessageBuilder extends BaseMediaBuilder<ImageMediaObject> {}
3709
+ /**
3710
+ * Builder for video messages
3711
+ */
3712
+ declare class VideoMessageBuilder extends BaseMediaBuilder<VideoMediaObject> {}
3713
+ /**
3714
+ * Builder for audio messages
3715
+ */
3716
+ declare class AudioMessageBuilder extends BaseMediaBuilder<AudioMediaObject> {
3717
+ setCaption(caption: string): this;
3718
+ }
3719
+ /**
3720
+ * Builder for document messages
3721
+ */
3722
+ declare class DocumentMessageBuilder extends BaseMediaBuilder<DocumentMediaObject> {
117
3723
  /**
118
- * Delete Flow (only works if the Flow is in DRAFT status)
119
- *
120
- * @param flowId - The flow ID
121
- * @returns Promise with the success status
3724
+ * Set document filename
122
3725
  */
123
- deleteFlow(flowId: string): Promise<ResponseSuccess>;
3726
+ setFilename(filename: string): this;
3727
+ }
3728
+ /**
3729
+ * Builder for sticker messages
3730
+ */
3731
+ declare class StickerMessageBuilder extends BaseMediaBuilder<StickerMediaObject> {
3732
+ setCaption(caption: string): this;
3733
+ }
3734
+ /**
3735
+ * Factory class for common media patterns
3736
+ */
3737
+ declare class MediaMessageFactory {
124
3738
  /**
125
- * List Assets (e.g., get Flow JSON download URL)
126
- *
127
- * @param flowId - The flow ID
128
- * @returns Promise with the list of assets
3739
+ * Create an image with caption
129
3740
  */
130
- listAssets(flowId: string): Promise<FlowAssetsResponse>;
3741
+ static createImageWithCaption(linkOrId: string, caption: string, isId?: boolean): ImageMediaObject;
131
3742
  /**
132
- * Update Flow JSON by uploading a file, buffer, JSON object, or Blob.
133
- *
134
- * @param flowId - The flow ID
135
- * @param data - Object containing the file data and optional name.
136
- * @param data.file - The Flow JSON content as a Buffer, JSON object, or Blob.
137
- * @param data.name - Optional name for the asset, defaults to 'flow.json'.
138
- * @returns Promise with the success status and validation errors, if any.
3743
+ * Create a video with caption
139
3744
  */
140
- updateFlowJson(flowId: string, data: {
141
- file: Blob | Buffer | object;
142
- name?: string;
143
- }): Promise<UpdateFlowResponse>;
3745
+ static createVideoWithCaption(linkOrId: string, caption: string, isId?: boolean): VideoMediaObject;
144
3746
  /**
145
- * Validate Flow JSON by attempting an update without publishing.
146
- * This is a convenience method; the API doesn't have a dedicated validation endpoint.
147
- *
148
- * @param flowId - The ID of the Flow (must exist, can be in DRAFT status).
149
- * @param flowJsonData - The Flow JSON content as a file path (string), Buffer, JSON object, or Blob.
150
- * @returns Promise indicating if the JSON is valid and includes validation errors if any.
3747
+ * Create a document with filename
151
3748
  */
152
- validateFlowJson(flowId: string, flowJsonData: Blob | Buffer | object): Promise<ValidateFlowJsonResponse>;
3749
+ static createDocument(linkOrId: string, filename: string, caption?: string, isId?: boolean): DocumentMediaObject;
153
3750
  /**
154
- * Publish Flow
155
- *
156
- * @param flowId - The flow ID
157
- * @returns Promise with the success status
3751
+ * Create an audio message
158
3752
  */
159
- publishFlow(flowId: string): Promise<ResponseSuccess>;
3753
+ static createAudio(linkOrId: string, isId?: boolean): AudioMediaObject;
160
3754
  /**
161
- * Deprecate Flow
162
- *
163
- * @param flowId - The flow ID
164
- * @returns Promise with the success status
3755
+ * Create a sticker message
165
3756
  */
166
- deprecateFlow(flowId: string): Promise<ResponseSuccess>;
3757
+ static createSticker(linkOrId: string, isId?: boolean): StickerMediaObject;
3758
+ }
3759
+ //#endregion
3760
+ //#region src/api/messages/builders/ReactionMessageBuilder.d.ts
3761
+ /**
3762
+ * Builder class for creating reaction messages with a fluent API
3763
+ */
3764
+ declare class ReactionMessageBuilder {
3765
+ private reaction;
167
3766
  /**
168
- * Migrate Flows between WABAs
169
- *
170
- * @param destinationWabaId - The destination WABA ID
171
- * @param data - The migration data including source_waba_id and optional source_flow_names
172
- * @returns Promise with migration results (successes and failures)
3767
+ * Set the message ID to react to
3768
+ */
3769
+ setMessageId(messageId: string): this;
3770
+ /**
3771
+ * Set the emoji for the reaction
3772
+ */
3773
+ setEmoji(emoji: string): this;
3774
+ /**
3775
+ * Remove a reaction (by sending empty emoji)
3776
+ */
3777
+ removeReaction(): this;
3778
+ /**
3779
+ * Build the final reaction object
3780
+ */
3781
+ build(): {
3782
+ message_id: string;
3783
+ emoji: string;
3784
+ };
3785
+ /**
3786
+ * Reset the builder for reuse
173
3787
  */
174
- migrateFlows(destinationWabaId: string, data: {
175
- source_waba_id: string;
176
- source_flow_names?: string[];
177
- }): Promise<FlowMigrationResponse>;
3788
+ reset(): this;
178
3789
  }
179
- //#endregion
180
- //#region src/api/media/MediaApi.d.ts
181
3790
  /**
182
- * API for managing WhatsApp Media.
183
- *
184
- * This API allows you to:
185
- * - Get media information by ID
186
- * - Upload media files
187
- * - Delete media files
188
- * - Download media files from URLs
3791
+ * Factory class for common reaction patterns
189
3792
  */
190
- declare class MediaApi extends BaseAPI implements MediaClass {
191
- private readonly endpoint;
192
- constructor(config: WabaConfigType, client: RequesterClass);
3793
+ declare class ReactionMessageFactory {
193
3794
  /**
194
- * Retrieve media information by media ID.
195
- *
196
- * @param mediaId The media ID to retrieve information for
197
- * @param phone_number_id Optional phone number ID (defaults to configured one)
198
- * @returns Media information including URL, mime type, file size, etc.
199
- *
200
- * @example
201
- * const mediaInfo = await whatsappClient.media.getMediaById('media_id_123');
3795
+ * Create a like reaction
202
3796
  */
203
- getMediaById(mediaId: string, phone_number_id?: string): Promise<MediaResponse>;
3797
+ static createLike(messageId: string): {
3798
+ message_id: string;
3799
+ emoji: string;
3800
+ };
204
3801
  /**
205
- * Upload a media file to WhatsApp.
206
- *
207
- * @param file The file to upload
208
- * @param messagingProduct The messaging product (default: 'whatsapp')
209
- * @returns Upload response containing the media ID
210
- *
211
- * @example
212
- * const file = new File([buffer], 'image.jpg', { type: 'image/jpeg' });
213
- * const result = await whatsappClient.media.uploadMedia(file);
3802
+ * Create a heart reaction
214
3803
  */
215
- uploadMedia(file: File, messagingProduct?: string): Promise<UploadMediaResponse>;
3804
+ static createHeart(messageId: string): {
3805
+ message_id: string;
3806
+ emoji: string;
3807
+ };
216
3808
  /**
217
- * Delete a media file.
218
- *
219
- * @param mediaId The media ID to delete
220
- * @param phone_number_id Optional phone number ID (defaults to configured one)
221
- * @returns Response indicating success or failure
222
- *
223
- * @example
224
- * await whatsappClient.media.deleteMedia('media_id_123');
3809
+ * Create a laughing reaction
225
3810
  */
226
- deleteMedia(mediaId: string, phone_number_id?: string): Promise<ResponseSuccess>;
3811
+ static createLaugh(messageId: string): {
3812
+ message_id: string;
3813
+ emoji: string;
3814
+ };
227
3815
  /**
228
- * Download media from a URL.
229
- *
230
- * @param mediaUrl The URL to download media from
231
- * @returns Blob containing the media data
232
- *
233
- * @example
234
- * const blob = await whatsappClient.media.downloadMedia('https://...');
3816
+ * Create a wow reaction
235
3817
  */
236
- downloadMedia(mediaUrl: string): Promise<Blob>;
3818
+ static createWow(messageId: string): {
3819
+ message_id: string;
3820
+ emoji: string;
3821
+ };
3822
+ /**
3823
+ * Create a sad reaction
3824
+ */
3825
+ static createSad(messageId: string): {
3826
+ message_id: string;
3827
+ emoji: string;
3828
+ };
3829
+ /**
3830
+ * Create an angry reaction
3831
+ */
3832
+ static createAngry(messageId: string): {
3833
+ message_id: string;
3834
+ emoji: string;
3835
+ };
3836
+ /**
3837
+ * Remove a reaction
3838
+ */
3839
+ static removeReaction(messageId: string): {
3840
+ message_id: string;
3841
+ emoji: string;
3842
+ };
237
3843
  }
238
3844
  //#endregion
239
- //#region src/api/messages/MessageApi.d.ts
3845
+ //#region src/api/messages/builders/TemplateMessageBuilder.d.ts
3846
+ type CurrencyParameterHelper = {
3847
+ type: ParametersTypesEnum.Currency;
3848
+ currency: {
3849
+ fallback_value: string;
3850
+ code: CurrencyCodesEnum;
3851
+ amount_1000: number;
3852
+ };
3853
+ };
3854
+ type DateTimeParameterHelper = {
3855
+ type: ParametersTypesEnum.DateTime;
3856
+ date_time: {
3857
+ fallback_value: string;
3858
+ timestamp: number;
3859
+ };
3860
+ };
3861
+ type ParameterObject = CurrencyParameterHelper | DateTimeParameterHelper;
240
3862
  /**
241
- * Maps each message type to its appropriate payload type
3863
+ * Builder class for creating template messages with a fluent API
242
3864
  */
243
- type MessagePayloadType<T extends MessageTypesEnum> = T extends MessageTypesEnum.Audio ? AudioMediaObject : T extends MessageTypesEnum.Contacts ? [ContactObject] : T extends MessageTypesEnum.Document ? DocumentMediaObject : T extends MessageTypesEnum.Image ? ImageMediaObject : T extends MessageTypesEnum.Interactive ? InteractiveObject : T extends MessageTypesEnum.Location ? LocationObject : T extends MessageTypesEnum.Template ? MessageTemplateObject<ComponentTypesEnum> : T extends MessageTypesEnum.Sticker ? StickerMediaObject : T extends MessageTypesEnum.Text ? TextObject : T extends MessageTypesEnum.Video ? VideoMediaObject : T extends MessageTypesEnum.Reaction ? {
244
- message_id: string;
245
- emoji: string;
246
- } : never;
247
- declare class MessagesApi extends BaseAPI implements MessagesClass {
248
- private readonly commonMethod;
249
- private readonly commonEndpoint;
250
- constructor(config: WabaConfigType, client: RequesterClass);
251
- /**
252
- * Builds the request body for WhatsApp API messages
253
- * @param type The type of message to send
254
- * @param payload The message payload object
255
- * @param to The recipient's phone number
256
- * @param replyMessageId Optional message ID to reply to
257
- * @returns The formatted request body
258
- */
259
- bodyBuilder<T extends MessageTypesEnum>(type: T, payload: MessagePayloadType<T>, to: string, replyMessageId?: string): MessageRequestBody<T>;
3865
+ declare class TemplateMessageBuilder {
3866
+ private template;
260
3867
  /**
261
- * Sends a request to the WhatsApp API
262
- * @param body The request body to send
263
- * @returns Promise with the API response
3868
+ * Set the template name
264
3869
  */
265
- private send;
3870
+ setName(name: string): this;
266
3871
  /**
267
- * Sends an audio message via WhatsApp
268
- * @param params The audio message parameter object
269
- * @returns Promise with the message response
3872
+ * Set the template language
270
3873
  */
271
- audio(params: MessageRequestParams<AudioMediaObject>): Promise<MessagesResponse>;
3874
+ setLanguage(code: string): this;
272
3875
  /**
273
- * Sends a contact card via WhatsApp
274
- * @param params The contact message parameter object
275
- * @returns Promise with the message response
3876
+ * Add a header component with text parameters
276
3877
  */
277
- contacts(params: MessageRequestParams<[ContactObject]>): Promise<MessagesResponse>;
3878
+ addTextHeader(parameters: string[]): this;
278
3879
  /**
279
- * Sends a document via WhatsApp
280
- * @param params The document message parameter object
281
- * @returns Promise with the message response
3880
+ * Add a header component with image
282
3881
  */
283
- document(params: MessageRequestParams<DocumentMediaObject>): Promise<MessagesResponse>;
3882
+ addImageHeader(imageUrl: string): this;
284
3883
  /**
285
- * Sends an image via WhatsApp
286
- * @param params The image message parameter object
287
- * @returns Promise with the message response
3884
+ * Add a body component with text parameters
288
3885
  */
289
- image(params: MessageRequestParams<ImageMediaObject>): Promise<MessagesResponse>;
3886
+ addBody(parameters: string[]): this;
290
3887
  /**
291
- * Sends an interactive message via WhatsApp
292
- * @param params The interactive message parameter object
293
- * @returns Promise with the message response
3888
+ * Add a footer component (usually no parameters needed)
294
3889
  */
295
- interactive(params: MessageRequestParams<InteractiveObject>): Promise<MessagesResponse>;
3890
+ addFooter(): this;
296
3891
  /**
297
- * Sends a location via WhatsApp
298
- * @param params The location message parameter object
299
- * @returns Promise with the message response
3892
+ * Add button components (for quick replies, URLs, etc.)
300
3893
  */
301
- location(params: MessageRequestParams<LocationObject>): Promise<MessagesResponse>;
3894
+ addButtons(buttons: Array<{
3895
+ index: number;
3896
+ type: 'quick_reply' | 'url';
3897
+ parameters?: string[];
3898
+ }>): this;
302
3899
  /**
303
- * Sends a sticker via WhatsApp
304
- * @param params The sticker message parameter object
305
- * @returns Promise with the message response
3900
+ * Add a currency parameter for header/body
306
3901
  */
307
- sticker(params: MessageRequestParams<StickerMediaObject>): Promise<MessagesResponse>;
3902
+ addCurrencyParameter(fallbackValue: string, currencyCode: string, amount: number): CurrencyParameterHelper;
308
3903
  /**
309
- * Sends a template message via WhatsApp
310
- * @param params The template message parameter object
311
- * @returns Promise with the message response
3904
+ * Add a date time parameter
312
3905
  */
313
- template(params: MessageRequestParams<MessageTemplateObject<ComponentTypesEnum>>): Promise<MessagesResponse>;
3906
+ addDateTimeParameter(fallbackValue: string, timestamp: number): DateTimeParameterHelper;
314
3907
  /**
315
- * Sends a text message via WhatsApp
316
- * @param params The text message parameter object
317
- * @returns Promise with the message response
3908
+ * Build the final template object
318
3909
  */
319
- text(params: TextMessageParams): Promise<MessagesResponse>;
3910
+ build(): MessageTemplateObject<ComponentTypesEnum>;
320
3911
  /**
321
- * Sends a video message via WhatsApp
322
- * @param params The video message parameter object
323
- * @returns Promise with the message response
3912
+ * Reset the builder for reuse
324
3913
  */
325
- video(params: MessageRequestParams<VideoMediaObject>): Promise<MessagesResponse>;
3914
+ reset(): this;
3915
+ }
3916
+ /**
3917
+ * Factory class for common template patterns
3918
+ */
3919
+ declare class TemplateMessageFactory {
326
3920
  /**
327
- * Updates message status (mark as read, etc.)
328
- * @param params The status update parameters
329
- * @returns Promise with the API response
3921
+ * Create a simple text-only template
330
3922
  */
331
- status(params: StatusParams): Promise<MessagesResponse>;
3923
+ static createSimpleTextTemplate(name: string, language: string, bodyParameters: string[]): MessageTemplateObject<ComponentTypesEnum>;
332
3924
  /**
333
- * Marks a message as read
334
- * @param params Object containing messageId
335
- * @returns Promise with the API response
3925
+ * Create a template with header, body and buttons
336
3926
  */
337
- markAsRead(params: {
338
- messageId: string;
339
- }): Promise<MessagesResponse>;
3927
+ static createCompleteTemplate(name: string, language: string, options: {
3928
+ headerParameters?: string[];
3929
+ headerImage?: string;
3930
+ bodyParameters: string[];
3931
+ buttons?: Array<{
3932
+ index: number;
3933
+ type: 'quick_reply' | 'url';
3934
+ parameters?: string[];
3935
+ }>;
3936
+ }): MessageTemplateObject<ComponentTypesEnum>;
340
3937
  /**
341
- * Shows typing indicator
342
- * @param params Object containing messageId
343
- * @returns Promise with the API response
3938
+ * Create an order confirmation template
344
3939
  */
345
- showTypingIndicator(params: {
346
- messageId: string;
347
- }): Promise<MessagesResponse>;
3940
+ static createOrderConfirmationTemplate(language: string, customerName: string, orderNumber: string, amount: number, currencyCode: string): MessageTemplateObject<ComponentTypesEnum>;
3941
+ }
3942
+ //#endregion
3943
+ //#region src/api/messages/builders/TextMessageBuilder.d.ts
3944
+ /**
3945
+ * Builder class for creating text messages with a fluent API
3946
+ */
3947
+ declare class TextMessageBuilder {
3948
+ private textMessage;
348
3949
  /**
349
- * Sends a list interactive message
350
- * @param params The list interactive message parameters
351
- * @returns Promise with the message response
3950
+ * Set the message body text
352
3951
  */
353
- interactiveList(params: MessageRequestParams<InteractiveObject & {
354
- type: InteractiveTypesEnum.List;
355
- }>): Promise<MessagesResponse>;
3952
+ setBody(text: string): this;
356
3953
  /**
357
- * Sends a CTA URL interactive message
358
- * @param params The CTA URL interactive message parameters
359
- * @returns Promise with the message response
3954
+ * Enable or disable URL preview
360
3955
  */
361
- interactiveCtaUrl(params: MessageRequestParams<InteractiveObject & {
362
- type: InteractiveTypesEnum.CtaUrl;
363
- }>): Promise<MessagesResponse>;
3956
+ setPreviewUrl(enable?: boolean): this;
364
3957
  /**
365
- * Sends a location request interactive message
366
- * @param params The location request interactive message parameters
367
- * @returns Promise with the message response
3958
+ * Build the final text object
368
3959
  */
369
- interactiveLocationRequest(params: MessageRequestParams<InteractiveObject & {
370
- type: InteractiveTypesEnum.LocationRequest;
371
- }>): Promise<MessagesResponse>;
3960
+ build(): TextObject;
372
3961
  /**
373
- * Sends an address message interactive message
374
- * @param params The address message interactive message parameters
375
- * @returns Promise with the message response
3962
+ * Reset the builder for reuse
376
3963
  */
377
- interactiveAddressMessage(params: MessageRequestParams<InteractiveObject & {
378
- type: InteractiveTypesEnum.AddressMessage;
379
- }>): Promise<MessagesResponse>;
3964
+ reset(): this;
3965
+ }
3966
+ /**
3967
+ * Factory class for common text message patterns
3968
+ */
3969
+ declare class TextMessageFactory {
380
3970
  /**
381
- * Sends a reply buttons interactive message
382
- * @param params The reply buttons interactive message parameters
383
- * @returns Promise with the message response
3971
+ * Create a simple text message
384
3972
  */
385
- interactiveReplyButtons(params: MessageRequestParams<InteractiveObject & {
386
- type: InteractiveTypesEnum.Button;
387
- }>): Promise<MessagesResponse>;
3973
+ static createSimpleText(body: string): TextObject;
388
3974
  /**
389
- * Sends a flow interactive message
390
- * @param params The flow interactive message parameters
391
- * @returns Promise with the message response
3975
+ * Create a text message with URL preview
392
3976
  */
393
- interactiveFlow(params: MessageRequestParams<InteractiveObject & {
394
- type: InteractiveTypesEnum.Flow;
395
- }>): Promise<MessagesResponse>;
3977
+ static createTextWithPreview(body: string): TextObject;
396
3978
  /**
397
- * Sends a reaction to a message
398
- * @param params The reaction parameters
399
- * @returns Promise with the message response
3979
+ * Create a notification message
400
3980
  */
401
- reaction(params: ReactionParams): Promise<MessagesResponse>;
3981
+ static createNotification(title: string, message: string): TextObject;
402
3982
  }
403
3983
  //#endregion
404
3984
  //#region src/api/phone/PhoneNumberApi.d.ts
@@ -845,67 +4425,6 @@ declare class WhatsApp {
845
4425
  getUserAgent(): string;
846
4426
  }
847
4427
  //#endregion
848
- //#region src/utils/flowTypeGuards.d.ts
849
- declare const DATA_EXCHANGE_ACTIONS: readonly [FlowActionEnum.DATA_EXCHANGE, FlowActionEnum.INIT, FlowActionEnum.BACK];
850
- declare const ERROR_ACTIONS: readonly [FlowActionEnum.DATA_EXCHANGE, FlowActionEnum.INIT];
851
- /**
852
- * Type guard to check if a request is a Data Exchange request
853
- * Validates the request structure according to the Flow API specifications
854
- *
855
- * @param request The Flow endpoint request to check
856
- * @returns True if the request is a valid Data Exchange request, false otherwise
857
- */
858
- declare function isFlowDataExchangeRequest(request: FlowEndpointRequest): request is FlowDataExchangeRequest & {
859
- action: (typeof DATA_EXCHANGE_ACTIONS)[number];
860
- screen?: string;
861
- flow_token: string;
862
- data?: Record<string, any>;
863
- };
864
- /**
865
- * Type guard to check if a request is an Error Notification request
866
- * Validates the request structure according to the Flow API error specifications
867
- *
868
- * @param request The Flow endpoint request to check
869
- * @returns True if the request is a valid Error Notification request, false otherwise
870
- */
871
- declare function isFlowErrorRequest(request: FlowEndpointRequest): request is FlowErrorNotificationRequest & {
872
- action: (typeof ERROR_ACTIONS)[number];
873
- screen: string;
874
- flow_token: string;
875
- data: {
876
- error: string;
877
- error_message: string;
878
- };
879
- };
880
- /**
881
- * Type guard to check if a request is a Ping (health check) request
882
- * Simple validation for health check endpoints in the Flow API
883
- *
884
- * @param request The Flow endpoint request to check
885
- * @returns True if the request is a Ping request, false otherwise
886
- */
887
- declare function isFlowPingRequest(request: FlowEndpointRequest): request is FlowHealthCheckRequest;
888
- //#endregion
889
- //#region src/core/whatsapp/types.d.ts
890
- declare class WhatsAppClass {
891
- constructor(config?: WhatsAppConfig);
892
- readonly messages: MessagesApi;
893
- readonly templates: TemplateApi;
894
- readonly phoneNumber: PhoneNumberApi;
895
- readonly qrCode: QrCodeApi;
896
- readonly encryption: EncryptionApi;
897
- readonly twoStepVerification: TwoStepVerificationApi;
898
- readonly registration: RegistrationApi;
899
- readonly media: MediaApi;
900
- readonly waba: WabaApi;
901
- readonly flow: FlowApi;
902
- readonly businessProfile: BusinessProfileApi;
903
- updateTimeout(ms: number): boolean;
904
- updatePhoneNumberId(phoneNumberId: number): boolean;
905
- updateAccessToken(accessToken: string): boolean;
906
- updateWabaId(wabaId: string): boolean;
907
- }
908
- //#endregion
909
4428
  //#region src/core/webhook/utils/webhookUtils.d.ts
910
4429
  type MessageHandler = (whatsapp: WhatsApp, message: WebhookMessage) => void | Promise<void>;
911
4430
  type FlowHandler = (whatsapp: WhatsApp, request: FlowEndpointRequest) => any | Promise<any>;
@@ -970,75 +4489,8 @@ interface BaseResponse<T = any> {
970
4489
  setHeader?(name: string, value: string): void;
971
4490
  }
972
4491
  interface BaseWebhookConfig extends WhatsAppConfig {}
973
- interface WebhookResult {
974
- status: number;
975
- headers: Record<string, string>;
976
- body: any;
977
- }
978
- /**
979
- * Abstract base class for framework-agnostic webhook handlers
980
- * Provides common architecture and functionality across all frameworks
981
- */
982
- declare abstract class BaseWebhookHandler<TRequest extends BaseRequest, TResponse extends BaseResponse> {
983
- protected processor: WebhookProcessor;
984
- constructor(config: BaseWebhookConfig);
985
- /**
986
- * Abstract method for handling GET requests (webhook verification)
987
- * Each framework implements this based on their request/response patterns
988
- */
989
- protected abstract handleGet(req: TRequest, res: TResponse, ...args: any[]): Promise<any>;
990
- /**
991
- * Abstract method for handling POST requests (webhook processing)
992
- * Each framework implements this based on their request/response patterns
993
- */
994
- protected abstract handlePost(req: TRequest, res: TResponse, ...args: any[]): Promise<any>;
995
- /**
996
- * Abstract method for handling flow requests
997
- * Each framework implements this based on their request/response patterns
998
- */
999
- protected abstract handleFlow(req: TRequest, res: TResponse, ...args: any[]): Promise<any>;
1000
- /**
1001
- * Common webhook verification logic
1002
- */
1003
- protected processVerification(mode: string | null, token: string | null, challenge: string | null): Promise<WebhookResult>;
1004
- /**
1005
- * Common webhook processing logic
1006
- */
1007
- protected processWebhook(request: Request): Promise<WebhookResult>;
1008
- /**
1009
- * Common flow processing logic
1010
- */
1011
- protected processFlow(request: Request): Promise<WebhookResult>;
1012
- /**
1013
- * Helper to construct full URL from headers and path
1014
- */
1015
- protected constructFullUrl(headers: Record<string, string | string[] | undefined>, url?: string): string;
1016
- /**
1017
- * Helper to apply result headers to response
1018
- */
1019
- protected applyHeaders(result: WebhookResult, res: TResponse): void;
1020
- /**
1021
- * Auto-routing method handler that dispatches based on request method
1022
- */
1023
- protected autoRoute(req: TRequest, res: TResponse, ...args: any[]): Promise<any>;
1024
- /**
1025
- * Get the processor instance for handler registration
1026
- */
1027
- get webhookProcessor(): WebhookProcessor;
1028
- /**
1029
- * Abstract method to return the clean handler object
1030
- * Each framework implements this to return their specific handler structure
1031
- */
1032
- abstract getHandlers(): {
1033
- GET: (...args: any[]) => Promise<any>;
1034
- POST: (...args: any[]) => Promise<any>;
1035
- webhook: (...args: any[]) => Promise<any>;
1036
- flow: (...args: any[]) => Promise<any>;
1037
- processor: WebhookProcessor;
1038
- };
1039
- }
1040
4492
  //#endregion
1041
- //#region src/core/webhook/frameworks/express.d.ts
4493
+ //#region src/core/webhook/frameworks/express/express.d.ts
1042
4494
  interface ExpressRequest extends BaseRequest {
1043
4495
  method: string;
1044
4496
  url: string;
@@ -1059,7 +4511,7 @@ interface NextFunction {
1059
4511
  interface ExpressWebhookConfig extends BaseWebhookConfig {
1060
4512
  path?: string;
1061
4513
  }
1062
- declare function webhookHandler(config: ExpressWebhookConfig): {
4514
+ declare function expressWebhookHandler(config: ExpressWebhookConfig): {
1063
4515
  GET: (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => Promise<ExpressResponse>;
1064
4516
  POST: (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => Promise<ExpressResponse>;
1065
4517
  webhook: (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => Promise<any>;
@@ -1067,7 +4519,7 @@ declare function webhookHandler(config: ExpressWebhookConfig): {
1067
4519
  processor: WebhookProcessor;
1068
4520
  };
1069
4521
  //#endregion
1070
- //#region src/core/webhook/frameworks/nextjs.d.ts
4522
+ //#region src/core/webhook/frameworks/nextjs/nextjs.d.ts
1071
4523
  interface BaseApiRequest extends BaseRequest {
1072
4524
  method?: string;
1073
4525
  url?: string;
@@ -1083,7 +4535,7 @@ interface BaseApiResponse extends BaseResponse {
1083
4535
  setHeader(name: string, value: string): void;
1084
4536
  }
1085
4537
  interface NextJsWebhookConfig extends BaseWebhookConfig {}
1086
- declare function webhookHandler$1<TRequest extends BaseApiRequest, TResponse extends BaseApiResponse>(config: NextJsWebhookConfig): {
4538
+ declare function nextjsWebhookHandler<TRequest extends BaseApiRequest, TResponse extends BaseApiResponse>(config: NextJsWebhookConfig): {
1087
4539
  GET: (req: TRequest, res: TResponse) => Promise<any>;
1088
4540
  POST: (req: TRequest, res: TResponse) => Promise<any>;
1089
4541
  webhook: (req: TRequest, res: TResponse) => Promise<any>;
@@ -1091,8 +4543,29 @@ declare function webhookHandler$1<TRequest extends BaseApiRequest, TResponse ext
1091
4543
  processor: WebhookProcessor;
1092
4544
  };
1093
4545
  //#endregion
4546
+ //#region src/core/webhook/frameworks/nextjs-app/nextjs-app.d.ts
4547
+ interface NextRequest extends Request {
4548
+ nextUrl: {
4549
+ searchParams: URLSearchParams;
4550
+ };
4551
+ }
4552
+ interface NextJsAppWebhookConfig extends WhatsAppConfig {}
4553
+ declare function nextjsAppWebhookHandler(config: NextJsAppWebhookConfig): {
4554
+ GET: (request: NextRequest) => Promise<Response>;
4555
+ POST: (request: NextRequest) => Promise<Response>;
4556
+ webhook: {
4557
+ GET: (request: NextRequest) => Promise<Response>;
4558
+ POST: (request: NextRequest) => Promise<Response>;
4559
+ };
4560
+ flow: {
4561
+ GET: (request: NextRequest) => Promise<Response>;
4562
+ POST: (request: NextRequest) => Promise<Response>;
4563
+ };
4564
+ processor: WebhookProcessor;
4565
+ };
4566
+ //#endregion
1094
4567
  //#region src/core/webhook/utils/generateXHub256Sig.d.ts
1095
4568
  declare const generateXHub256Sig: (body: string, appSecret: string) => string;
1096
4569
  //#endregion
1097
- export { type AccountMode, type AudioMediaObject, AudioMediaTypesEnum, type AuthenticationTemplateOptions, BaseClass, type BodyOptions, BusinessProfileApi, type BusinessProfileClass, type BusinessProfileData, type BusinessProfileField, type BusinessProfileFieldsParam, type BusinessProfileResponse, BusinessVerticalEnum, type ButtonOptions, ButtonPositionEnum, type CarouselCard, type CarouselOptions, type CatalogButton, type CatalogTemplateOptions, CategoryEnum, type CodeVerificationStatus, type ComponentTypes, ComponentTypesEnum, type ContactObject, ConversationTypesEnum, type CopyCodeButton, type CouponTemplateOptions, type CreateQrCodeRequest, CurrencyCodesEnum, type CurrencyParameter, type Cursors, DataLocalizationRegionEnum, type DateTimeParameter, type DocumentMediaObject, DocumentMediaTypesEnum, EncryptionApi, type EncryptionPublicKeyResponse, webhookHandler as ExpressWebhook, type Flow, type FlowActionEnum, FlowApi, type FlowAsset, type FlowAssetsResponse, type FlowButton, type FlowCategoryEnum, type FlowClass, type FlowDataExchangeRequest, type FlowDataExchangeResponse, type FlowDecryptedRequestResponse, type FlowEncryptedRequestPayload, type FlowEndpointRequest, type FlowEndpointResponse, type FlowErrorNotificationRequest, type FlowErrorNotificationResponse, type FlowHealthCheckRequest, type FlowHealthCheckResponse, type FlowHttpRequest, type FlowMigrationFailure, type FlowMigrationResponse, type FlowMigrationResult, type FlowPreview, type FlowPreviewResponse, type FlowStatusEnum, type FlowSuccessScreenResponse, type FlowType, type FlowTypeEnum, type FlowValidationError, type FlowValidationErrorPointer, type FlowsListResponse, type FooterOptions, GeneralHeaderInterface, type GeneralMessageBody, GeneralRequestBody, type HeaderOptions, type HealthStatus, type HealthStatusEntity, HttpMethodsEnum, HttpsClientClass, HttpsClientResponseClass, type ImageMediaObject, ImageMediaTypesEnum, type InteractiveObject, InteractiveTypesEnum, LanguagesEnum, type LimitedTimeOfferOptions, type LimitedTimeOfferTemplateOptions, type LocationObject, type LocationParameter, LoggerInterface, type MPMButton, type MPMTemplateOptions, MediaApi, type MediaCardCarouselTemplateOptions, type MediaCarouselCard, type MediaClass, type MediaParameter, type MediaResponse, type MediasResponse, type MessageRequestBody, type MessageRequestParams, type MessageTemplateObject, MessageTypesEnum, MessagesApi, type MessagesClass, type MessagesResponse, type MessagingLimitTier, type MetaError, webhookHandler$1 as NextJsWebhook, type OTPButton, type OTPTemplateOptions, type Pagination, type PaginationCursors, Paging, ParametersTypesEnum, PhoneNumberApi, type PhoneNumberButton, type PhoneNumberClass, type PhoneNumberResponse, type PhoneNumbersResponse, type PlatformType, type ProductCardCarouselTemplateOptions, type ProductCarouselCard, type ProductParameter, type ProductSection, QrCodeApi, type QrCodeClass, type QrCodeResponse, type QrCodesResponse, type QualityRating, type QualityScore, type QuickReplyButton, type ReactionParams, ReferralSourceTypesEnum, RegistrationApi, type RegistrationClass, type RegistrationRequest, RequestCodeMethodsEnum, type RequestVerificationCodeRequest, RequesterClass, RequesterResponseInterface, ResponseData, ResponseHeaderValue, ResponseHeaders, ResponseJSONBody, ResponsePagination, ResponseSuccess, type SPMButton, type SPMTemplateOptions, StatusEnum, type StatusParams, type StickerMediaObject, StickerMediaTypesEnum, SubTypeEnum, SystemChangeTypesEnum, TemplateApi, type TemplateBody, type TemplateButton, type TemplateButtons, type TemplateCarousel, type TemplateClass, type TemplateDeleteParams, type TemplateFooter, type TemplateFormat, type TemplateGetParams, type TemplateHeader, type TemplateHeaderExample, type TemplateLimitedTimeOffer, type TemplateOptions, type TemplateParameter, type TemplateRequestBody, type TemplateResponse, TemplateStatusEnum, type TextMessageParams, type TextObject, type TextParameter, type Throughput, type ThroughputLevel, TwoStepVerificationApi, type TwoStepVerificationClass, type TwoStepVerificationParams, type TwoStepVerificationRequest, type URLButton, type UpdateBusinessProfileRequest, type UpdateFlowResponse, type UpdateQrCodeRequest, type UpdateWabaSubscription, type UploadMediaResponse, type ValidateFlowJsonResponse, type VerifyCodeRequest, type VideoMediaObject, VideoMediaTypesEnum, type WABAClass, type WabaAccount, type WabaAccountFields, type WabaAccountFieldsParam, WabaAccountReviewStatus, WabaAccountStatus, WabaApi, WabaBusinessVerificationStatus, WabaConfigEnum, WabaConfigType, type WabaHealthStatus, WabaHealthStatusCanSendMessage, type WabaHealthStatusEntity, type WabaHealthStatusError, type WabaSubscription, type WabaSubscriptions, type WebhookContact, type WebhookEvent, type WebhookMessage, WebhookTypesEnum, WhatsApp, WhatsAppConfig, WhatsApp as WhatsAppLegacy, isFlowDataExchangeRequest, isFlowErrorRequest, isFlowPingRequest, isMetaError };
4570
+ export { AccountMode, AudioMediaObject, AudioMessageBuilder, AuthenticationTemplateOptions, BodyOptions, BusinessProfileApi, BusinessProfileClass, BusinessProfileData, BusinessProfileField, BusinessProfileFieldsParam, BusinessProfileResponse, ButtonOptions, CarouselCard, CarouselOptions, CatalogButton, CatalogTemplateOptions, CodeVerificationStatus, ComponentTypes, ContactMessageBuilder, ContactMessageFactory, ContactObject, CopyCodeButton, CouponTemplateOptions, CreateFlowResponse, CreateQrCodeRequest, CreateUploadSessionParams, CurrencyParameter, CurrencyParameterHelper, Cursors, DateTimeParameter, DateTimeParameterHelper, DocumentMediaObject, DocumentMessageBuilder, EncryptionApi, EncryptionClass, EncryptionPublicKeyResponse, ExpressRequest, ExpressResponse, ExpressWebhookConfig, Flow, FlowActionEnum, FlowApi, FlowAssetsResponse, FlowButton, FlowCategoryEnum, FlowClass, FlowEndpointRequest, FlowEndpointResponse, FlowHandler, FlowMigrationResponse, FlowPreviewResponse, FlowStatusEnum, FlowType, FlowTypeEnum, FlowValidationError, FlowsListResponse, FooterOptions, GetUploadHandleParams, HeaderOptions, HealthStatus, HealthStatusEntity, ImageMediaObject, ImageMessageBuilder, InteractiveMessageBuilder, InteractiveMessageFactory, InteractiveObject, LimitedTimeOfferOptions, LimitedTimeOfferTemplateOptions, LocationMessageBuilder, LocationMessageFactory, LocationObject, LocationParameter, MPMButton, MPMTemplateOptions, MediaApi, MediaCardCarouselTemplateOptions, MediaCarouselCard, MediaClass, MediaMessageFactory, MediaParameter, MediaResponse, MediasResponse, MessagesApi as MessageApi, MessagesApi, MessageHandler, MessageRequestParams, MessageStatus, MessageTemplateObject, MessagesResponse, MessagingLimitTier, NextFunction, NextJsAppWebhookConfig, NextJsWebhookConfig, OTPButton, OTPTemplateOptions, ParameterObject, PhoneNumberApi, PhoneNumberButton, PhoneNumberClass, PhoneNumberResponse, PhoneNumbersResponse, PlatformType, ProductCardCarouselTemplateOptions, ProductCarouselCard, ProductParameter, ProductSection, QrCodeApi, QrCodeClass, QrCodeResponse, QrCodesResponse, QualityRating, QualityScore, QuickReplyButton, ReactionMessageBuilder, ReactionMessageFactory, ReactionParams, RegistrationApi, RegistrationClass, RegistrationRequest, RequestVerificationCodeRequest, SPMButton, SPMTemplateOptions, StatusParams, StickerMediaObject, StickerMessageBuilder, TemplateApi, TemplateBody, TemplateButton, TemplateButtons, TemplateCarousel, TemplateClass, TemplateDeleteParams, TemplateFooter, TemplateFormat, TemplateGetParams, TemplateHeader, TemplateHeaderExample, TemplateLimitedTimeOffer, TemplateMessageBuilder, TemplateMessageFactory, TemplateOptions, TemplateParameter, TemplateRequestBody, TemplateResponse, TextMessageBuilder, TextMessageFactory, TextMessageParams, TextObject, TextParameter, Throughput, ThroughputLevel, TwoStepVerificationApi, TwoStepVerificationClass, TwoStepVerificationParams, TwoStepVerificationRequest, URLButton, UpdateBusinessProfileRequest, UpdateFlowResponse, UpdateQrCodeRequest, UpdateWabaSubscription, UploadBusinessProfileResponse, UploadHandle, UploadMediaParams, UploadMediaResponse, UploadSession, UploadSessionResponse, ValidateFlowJsonResponse, VerifyCodeRequest, VideoMediaObject, VideoMessageBuilder, WABAClass, WabaAccount, WabaApi, WabaSubscriptions, WebhookContact, WebhookEvent, WebhookMessage, WebhookProcessor, WebhookResponse, WhatsApp, constructFullUrl, createAuthenticationTemplate, createCatalogTemplate, createCouponTemplate, createLimitedTimeOfferTemplate, createMPMTemplate, createMediaCardCarouselTemplate, createOTPTemplate, createProductCardCarouselTemplate, createSPMTemplate, createTemplate, expressWebhookHandler, generateXHub256Sig, nextjsAppWebhookHandler, nextjsWebhookHandler, processFlowRequest, processWebhookMessages };
1098
4571
  //# sourceMappingURL=index.d.ts.map