meta-cloud-api 1.1.8 → 1.1.9

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,4003 @@
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;
7
- constructor();
8
- clearSockets(): boolean;
9
- sendRequest(hostname: string, path: string, method: HttpMethodsEnum, headers: HeadersInit, timeout: number, body?: BodyInit | null): Promise<HttpsClientResponseClass>;
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 };
10
6
  }
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>;
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",
20
670
  }
21
671
  //#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>;
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/types/request.d.ts
749
+ type GeneralRequestBody = Record<string, unknown>;
750
+ interface RequesterResponseInterface<T> {
751
+ json: () => Promise<T>;
752
+ }
753
+ interface ResponseSuccess {
754
+ success: boolean;
755
+ }
756
+ interface ResponseData<T> {
757
+ data: T;
758
+ }
759
+ interface ResponsePagination<T> {
760
+ data: T[];
761
+ paging: Paging;
762
+ }
763
+ interface Paging {
764
+ cursors: {
765
+ before: string;
766
+ after: string;
767
+ };
768
+ next: string;
769
+ }
770
+ declare class RequesterClass {
32
771
  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>;
772
+ sendRequest: (method: HttpMethodsEnum, path: string, timeout: number, body?: GeneralRequestBody, contentType?: string, additionalHeaders?: Record<string, string>) => Promise<RequesterResponseInterface<unknown>>;
773
+ getJson<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: GeneralRequestBody, additionalHeaders?: Record<string, string>): Promise<T>;
37
774
  sendFormData<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: FormData, additionalHeaders?: Record<string, string>): Promise<T>;
38
775
  sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: Record<string, string>, additionalHeaders?: Record<string, string>): Promise<T>;
39
776
  }
40
777
  //#endregion
41
- //#region src/api/encryption/EncryptionApi.d.ts
42
- declare class EncryptionApi extends BaseAPI implements EncryptionClass {
43
- private readonly endpoint;
778
+ //#region src/types/httpsClient.d.ts
779
+ type ResponseHeaderValue = string | string[] | undefined;
780
+ type ResponseHeaders = Record<string, ResponseHeaderValue>;
781
+ type ResponseJSONBody = Record<string, unknown>;
782
+ declare class HttpsClientResponseClass {
783
+ constructor(resp: Response);
784
+ statusCode: () => number;
785
+ headers: () => ResponseHeaders;
786
+ rawResponse: () => Response;
787
+ json: () => Promise<ResponseJSONBody>;
788
+ }
789
+ declare class HttpsClientClass {
790
+ constructor();
791
+ clearSockets: () => boolean;
792
+ sendRequest: (host: string, path: string, method: HttpMethodsEnum, headers: HeadersInit, timeout: number, body?: BodyInit | null) => Promise<HttpsClientResponseClass>;
793
+ }
794
+ //#endregion
795
+ //#region src/types/base.d.ts
796
+ declare class BaseClass {
797
+ constructor(config: WabaConfigType);
798
+ }
799
+ declare class BaseAPI implements BaseClass {
800
+ protected config: WabaConfigType;
801
+ protected client: RequesterClass;
44
802
  constructor(config: WabaConfigType, client: RequesterClass);
45
- getEncryptionPublicKey(): Promise<EncryptionPublicKeyResponse>;
46
- setEncryptionPublicKey(businessPublicKey: string): Promise<ResponseSuccess>;
803
+ protected sendJson<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any): Promise<T>;
804
+ protected sendFormData<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any): Promise<T>;
805
+ protected sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any): Promise<T>;
47
806
  }
48
807
  //#endregion
49
- //#region src/api/flow/FlowApi.d.ts
808
+ //#region src/api/profile/types/upload.d.ts
50
809
  /**
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
810
+ * Upload session information for creating upload sessions.
62
811
  */
63
- declare class FlowApi extends BaseAPI implements FlowClass {
64
- constructor(config: WabaConfigType, client: RequesterClass);
812
+ interface UploadSession {
813
+ id: string;
814
+ video?: boolean;
815
+ }
816
+ /**
817
+ * Response from creating an upload session.
818
+ */
819
+ interface UploadSessionResponse {
820
+ id: string;
821
+ }
822
+ /**
823
+ * Response from uploading business profile media.
824
+ */
825
+ interface UploadBusinessProfileResponse {
826
+ h: string;
827
+ }
828
+ /**
829
+ * Upload handle information containing file details and handle.
830
+ */
831
+ interface UploadHandle {
832
+ handle: string;
833
+ file_size: number;
834
+ upload_result: {
835
+ handle_type: string;
836
+ name: string;
837
+ };
838
+ }
839
+ /**
840
+ * Request parameters for creating upload session.
841
+ */
842
+ interface CreateUploadSessionParams {
65
843
  /**
66
- * List Flows
67
- *
68
- * @param wabaId - The WABA ID
69
- * @returns Promise with the list of flows
844
+ * Length of the file to be uploaded in bytes.
70
845
  */
71
- listFlows(wabaId: string): Promise<FlowsListResponse>;
846
+ fileLength: number;
72
847
  /**
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
848
+ * MIME type of the file (e.g., 'image/jpeg').
78
849
  */
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>;
850
+ fileType: string;
87
851
  /**
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
852
+ * Name of the file with extension.
94
853
  */
95
- getFlow(flowId: string, fields?: string, dateFormat?: string): Promise<Flow | FlowPreviewResponse>;
854
+ fileName: string;
855
+ }
856
+ /**
857
+ * Request parameters for uploading media.
858
+ */
859
+ interface UploadMediaParams {
96
860
  /**
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
861
+ * The upload session ID from createUploadSession response.
102
862
  */
103
- getFlowPreview(flowId: string, invalidate?: boolean): Promise<FlowPreviewResponse>;
863
+ uploadId: string;
104
864
  /**
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
865
+ * The binary data of the file (Buffer).
110
866
  */
111
- updateFlowMetadata(flowId: string, data: {
112
- name?: string;
113
- categories?: FlowCategoryEnum[];
114
- endpoint_uri?: string;
115
- application_id?: string;
116
- }): Promise<ResponseSuccess>;
867
+ file: Buffer;
868
+ }
869
+ /**
870
+ * Request parameters for getting upload handle.
871
+ */
872
+ interface GetUploadHandleParams {
117
873
  /**
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
874
+ * The upload session ID from createUploadSession response.
122
875
  */
123
- deleteFlow(flowId: string): Promise<ResponseSuccess>;
876
+ uploadId: string;
877
+ }
878
+ //#endregion
879
+ //#region src/api/profile/types/common.d.ts
880
+ /**
881
+ * Available fields that can be requested when retrieving a business profile.
882
+ */
883
+ type BusinessProfileField = 'about' | 'address' | 'description' | 'email' | 'profile_picture_url' | 'websites' | 'vertical';
884
+ type BusinessProfileFieldsParam = BusinessProfileField[] | string;
885
+ /**
886
+ * Business profile data structure containing all profile information.
887
+ */
888
+ interface BusinessProfileData {
124
889
  /**
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
890
+ * The business's About text. This text appears in the business's profile, beneath its profile image,
891
+ * phone number, and contact buttons.
892
+ * - String cannot be empty
893
+ * - Strings must be between 1 and 139 characters
894
+ * - Rendered emojis are supported however their unicode values are not.
895
+ * Emoji unicode values must be Java- or JavaScript-escape encoded
896
+ * - Hyperlinks can be included but will not render as clickable links
897
+ * - Markdown is not supported
129
898
  */
130
- listAssets(flowId: string): Promise<FlowAssetsResponse>;
899
+ about?: string;
131
900
  /**
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.
901
+ * Address of the business. Character limit 256.
139
902
  */
140
- updateFlowJson(flowId: string, data: {
141
- file: Blob | Buffer | object;
142
- name?: string;
143
- }): Promise<UpdateFlowResponse>;
903
+ address?: string;
144
904
  /**
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.
905
+ * Description of the business. Character limit 512.
151
906
  */
152
- validateFlowJson(flowId: string, flowJsonData: Blob | Buffer | object): Promise<ValidateFlowJsonResponse>;
907
+ description?: string;
153
908
  /**
154
- * Publish Flow
155
- *
156
- * @param flowId - The flow ID
157
- * @returns Promise with the success status
909
+ * The contact email address (in valid email format) of the business. Character limit 128.
158
910
  */
159
- publishFlow(flowId: string): Promise<ResponseSuccess>;
911
+ email?: string;
160
912
  /**
161
- * Deprecate Flow
162
- *
163
- * @param flowId - The flow ID
164
- * @returns Promise with the success status
913
+ * The messaging service used for the request. Always set it to "whatsapp" if you are using
914
+ * the WhatsApp Business API.
915
+ */
916
+ messaging_product: string;
917
+ /**
918
+ * Profile picture URL.
919
+ */
920
+ profile_picture_url?: string;
921
+ /**
922
+ * The URLs associated with the business. For instance, a website, Facebook Page, or Instagram.
923
+ * - You must include the http:// or https:// portion of the URL
924
+ * - There is a maximum of 2 websites with a maximum of 256 characters each
925
+ */
926
+ websites?: string[];
927
+ /**
928
+ * Business category. This can be either an empty string or one of the predefined business categories.
929
+ * @see BusinessVerticalEnum for all available options
930
+ */
931
+ vertical?: BusinessVerticalEnum | string;
932
+ }
933
+ /**
934
+ * Response structure for business profile GET requests.
935
+ */
936
+ interface BusinessProfileResponse {
937
+ data: BusinessProfileData[];
938
+ }
939
+ /**
940
+ * Request structure for updating business profile.
941
+ */
942
+ interface UpdateBusinessProfileRequest {
943
+ /**
944
+ * The messaging service used for the request. Always set it to "whatsapp" if you are using
945
+ * the WhatsApp Business API.
946
+ * @required
947
+ */
948
+ messaging_product: string;
949
+ /**
950
+ * The business's About text. This text appears in the business's profile, beneath its profile image,
951
+ * phone number, and contact buttons.
952
+ * - String cannot be empty
953
+ * - Strings must be between 1 and 139 characters
954
+ * - Rendered emojis are supported however their unicode values are not.
955
+ * Emoji unicode values must be Java- or JavaScript-escape encoded
956
+ * - Hyperlinks can be included but will not render as clickable links
957
+ * - Markdown is not supported
958
+ */
959
+ about?: string;
960
+ /**
961
+ * Address of the business. Character limit 256.
962
+ */
963
+ address?: string;
964
+ /**
965
+ * Description of the business. Character limit 512.
966
+ */
967
+ description?: string;
968
+ /**
969
+ * Business category. This can be either an empty string or one of the predefined business categories.
970
+ * @see BusinessVerticalEnum for all available options
971
+ */
972
+ vertical?: BusinessVerticalEnum | string;
973
+ /**
974
+ * The contact email address (in valid email format) of the business. Character limit 128.
975
+ */
976
+ email?: string;
977
+ /**
978
+ * The URLs associated with the business. For instance, a website, Facebook Page, or Instagram.
979
+ * - You must include the http:// or https:// portion of the URL
980
+ * - There is a maximum of 2 websites with a maximum of 256 characters each
981
+ */
982
+ websites?: string[];
983
+ /**
984
+ * Handle of the profile picture. This handle is generated when you upload the binary file
985
+ * for the profile picture to Meta using the Resumable Upload API.
986
+ */
987
+ profile_picture_handle?: string;
988
+ }
989
+ declare class BusinessProfileClass extends BaseClass {
990
+ /**
991
+ * Get your business profile.
992
+ * @param fields Specific fields to be returned in the response. If not specified, all fields will be returned.
993
+ */
994
+ getBusinessProfile(fields?: BusinessProfileFieldsParam): Promise<BusinessProfileResponse>;
995
+ /**
996
+ * Update your business profile.
997
+ * @param updateRequest The request object containing the fields to update.
998
+ */
999
+ updateBusinessProfile(updateRequest: UpdateBusinessProfileRequest): Promise<ResponseSuccess>;
1000
+ /**
1001
+ * Create an upload session for profile picture.
1002
+ * @param fileLength Length of the file to be uploaded in bytes.
1003
+ * @param fileType MIME type of the file (e.g., 'image/jpeg').
1004
+ * @param fileName Name of the file.
1005
+ */
1006
+ createUploadSession(fileLength: number, fileType: string, fileName: string): Promise<UploadSessionResponse>;
1007
+ /**
1008
+ * Upload media file to the upload session.
1009
+ * @param uploadId The ID of the upload session.
1010
+ * @param file The binary data of the file.
1011
+ */
1012
+ uploadMedia(uploadId: string, file: Buffer): Promise<UploadBusinessProfileResponse>;
1013
+ /**
1014
+ * Get the upload handle information.
1015
+ * @param uploadId The ID of the upload session.
1016
+ */
1017
+ getUploadHandle(uploadId: string): Promise<UploadHandle>;
1018
+ }
1019
+ //#endregion
1020
+ //#region src/api/phone/types/common.d.ts
1021
+ type QualityRating = 'GREEN' | 'YELLOW' | 'RED' | 'NA';
1022
+ type AccountMode = 'LIVE' | 'SANDBOX';
1023
+ type CodeVerificationStatus = 'NOT_VERIFIED' | 'VERIFIED' | 'EXPIRED' | 'PENDING' | 'DELETED' | 'MIGRATED' | 'BANNED' | 'RESTRICTED' | 'RATE_LIMITED' | 'FLAGGED' | 'CONNECTED' | 'DISCONNECTED' | 'UNKNOWN' | 'UNVERIFIED';
1024
+ type MessagingLimitTier = 'TIER_50' | 'TIER_250' | 'TIER_1K' | 'TIER_10K' | 'TIER_100K' | 'TIER_UNLIMITED';
1025
+ type PlatformType = 'CLOUD_API' | 'ON_PREMISE' | 'NOT_APPLICABLE';
1026
+ type ThroughputLevel = 'STANDARD' | 'HIGH' | 'NOT_APPLICABLE';
1027
+ type HealthStatusEntity = {
1028
+ entity_type: string;
1029
+ id: string;
1030
+ can_send_message: string;
1031
+ additional_info?: string[];
1032
+ errors?: Array<{
1033
+ error_code: number;
1034
+ error_description: string;
1035
+ possible_solution: string;
1036
+ }>;
1037
+ };
1038
+ type HealthStatus = {
1039
+ can_send_message: string;
1040
+ entities: HealthStatusEntity[];
1041
+ };
1042
+ type QualityScore = {
1043
+ score: QualityRating;
1044
+ };
1045
+ type Throughput = {
1046
+ level: ThroughputLevel;
1047
+ };
1048
+ type PhoneNumberResponse = {
1049
+ display_phone_number: string;
1050
+ id: string;
1051
+ quality_rating: QualityRating;
1052
+ verified_name: string;
1053
+ account_mode?: AccountMode;
1054
+ certificate?: string;
1055
+ code_verification_status?: CodeVerificationStatus;
1056
+ conversational_automation?: Record<string, unknown>;
1057
+ eligibility_for_api_business_global_search?: string;
1058
+ health_status?: HealthStatus;
1059
+ is_official_business_account?: boolean;
1060
+ is_on_biz_app?: boolean;
1061
+ is_pin_enabled?: boolean;
1062
+ is_preverified_number?: boolean;
1063
+ last_onboarded_time?: string;
1064
+ messaging_limit_tier?: MessagingLimitTier;
1065
+ name_status?: string;
1066
+ new_certificate?: string;
1067
+ new_name_status?: string;
1068
+ platform_type?: PlatformType;
1069
+ quality_score?: QualityScore;
1070
+ search_visibility?: string;
1071
+ status?: CodeVerificationStatus;
1072
+ throughput?: Throughput;
1073
+ };
1074
+ type Cursors = {
1075
+ before: string;
1076
+ after: string;
1077
+ };
1078
+ type PhoneNumbersResponse = {
1079
+ data: PhoneNumberResponse[];
1080
+ paging: Paging;
1081
+ };
1082
+ type RequestVerificationCodeRequest = {
1083
+ code_method: 'SMS' | 'VOICE';
1084
+ language: string;
1085
+ };
1086
+ type VerifyCodeRequest = {
1087
+ code: string;
1088
+ };
1089
+ type TwoStepVerificationParams = {
1090
+ pin: string;
1091
+ };
1092
+ interface PhoneNumberClass {
1093
+ getPhoneNumberById(fields?: string): Promise<PhoneNumberResponse>;
1094
+ getPhoneNumbers(): Promise<PhoneNumbersResponse>;
1095
+ requestVerificationCode(params: RequestVerificationCodeRequest): Promise<ResponseSuccess>;
1096
+ verifyCode(params: VerifyCodeRequest): Promise<ResponseSuccess>;
1097
+ }
1098
+ //#endregion
1099
+ //#region src/api/template/types/common.d.ts
1100
+ type TemplateFormat = 'TEXT' | 'IMAGE' | 'VIDEO' | 'DOCUMENT' | 'LOCATION' | 'PRODUCT';
1101
+ type PhoneNumberButton = {
1102
+ type: 'PHONE_NUMBER';
1103
+ text: string;
1104
+ phone_number: string;
1105
+ };
1106
+ type URLButton = {
1107
+ type: 'URL';
1108
+ text: string;
1109
+ url: string;
1110
+ example?: string[];
1111
+ };
1112
+ type QuickReplyButton = {
1113
+ type: 'QUICK_REPLY';
1114
+ text: string;
1115
+ };
1116
+ type CopyCodeButton = {
1117
+ type: 'COPY_CODE';
1118
+ example: string;
1119
+ };
1120
+ type FlowButton = {
1121
+ type: 'FLOW';
1122
+ text: string;
1123
+ flow_id?: string;
1124
+ flow_name?: string;
1125
+ flow_json?: string;
1126
+ flow_action?: 'navigate' | 'data_exchange';
1127
+ navigate_screen?: string;
1128
+ };
1129
+ type MPMButton = {
1130
+ type: 'MPM';
1131
+ action?: {
1132
+ thumbnail_product_retailer_id: string;
1133
+ sections: Array<{
1134
+ title?: string;
1135
+ product_items: Array<{
1136
+ product_retailer_id: string;
1137
+ }>;
1138
+ }>;
1139
+ };
1140
+ };
1141
+ type OTPButton = {
1142
+ type: 'OTP';
1143
+ };
1144
+ type SPMButton = {
1145
+ type: 'SPM';
1146
+ action?: {
1147
+ product_retailer_id: string;
1148
+ };
1149
+ };
1150
+ type CatalogButton = {
1151
+ type: 'CATALOG';
1152
+ action?: {
1153
+ thumbnail_product_retailer_id: string;
1154
+ };
1155
+ };
1156
+ type TemplateButton = PhoneNumberButton | URLButton | QuickReplyButton | CopyCodeButton | FlowButton | MPMButton | OTPButton | SPMButton | CatalogButton;
1157
+ type TemplateHeaderExample = {
1158
+ header_text?: string[];
1159
+ header_text_named_params?: Array<{
1160
+ param_name: string;
1161
+ example: string;
1162
+ }>;
1163
+ header_handle?: string[];
1164
+ };
1165
+ type TemplateHeader = {
1166
+ type: 'HEADER';
1167
+ format: TemplateFormat;
1168
+ text?: string;
1169
+ example?: TemplateHeaderExample;
1170
+ };
1171
+ type TemplateBody = {
1172
+ type: 'BODY';
1173
+ text: string;
1174
+ example?: {
1175
+ body_text?: Array<Array<string>>;
1176
+ body_text_named_params?: Array<{
1177
+ param_name: string;
1178
+ example: string;
1179
+ }>;
1180
+ };
1181
+ };
1182
+ type TemplateFooter = {
1183
+ type: 'FOOTER';
1184
+ text: string;
1185
+ };
1186
+ type TemplateButtons = {
1187
+ type: 'BUTTONS';
1188
+ buttons: TemplateButton[];
1189
+ };
1190
+ type TemplateLimitedTimeOffer = {
1191
+ type: 'LIMITED_TIME_OFFER';
1192
+ limited_time_offer: {
1193
+ expiration_time_ms: number;
1194
+ };
1195
+ };
1196
+ type TemplateCarousel = {
1197
+ type: 'CAROUSEL';
1198
+ cards: Array<{
1199
+ card_index: number;
1200
+ components: ComponentTypes[];
1201
+ }>;
1202
+ };
1203
+ type MediaCarouselCard = {
1204
+ card_index: number;
1205
+ components: (TemplateHeader | TemplateBody | TemplateButtons)[];
1206
+ };
1207
+ type ProductCarouselCard = {
1208
+ card_index: number;
1209
+ components: TemplateHeader[];
1210
+ };
1211
+ type ComponentTypes = TemplateHeader | TemplateBody | TemplateFooter | TemplateButtons | TemplateLimitedTimeOffer | TemplateCarousel;
1212
+ type TemplateRequestBody = GeneralRequestBody & {
1213
+ name: string;
1214
+ language: LanguagesEnum;
1215
+ category?: CategoryEnum;
1216
+ components?: ComponentTypes[];
1217
+ };
1218
+ type TemplateResponse = {
1219
+ id: string;
1220
+ status: string;
1221
+ language: LanguagesEnum;
1222
+ category: CategoryEnum;
1223
+ name: string;
1224
+ components: ComponentTypes[];
1225
+ };
1226
+ type TemplateGetParams = {
1227
+ limit?: number;
1228
+ name?: string;
1229
+ language?: LanguagesEnum;
1230
+ category?: CategoryEnum;
1231
+ status?: TemplateStatusEnum;
1232
+ };
1233
+ type TemplateDeleteParams = {
1234
+ hsm_id: string;
1235
+ name: string;
1236
+ };
1237
+ declare class TemplateClass {
1238
+ getTemplate(templateId: string): Promise<TemplateResponse>;
1239
+ updateTemplate(templateId: string, template: Partial<TemplateRequestBody>): Promise<ResponseSuccess>;
1240
+ getTemplates(params?: TemplateGetParams): Promise<ResponsePagination<TemplateResponse>>;
1241
+ createTemplate(template: TemplateRequestBody): Promise<TemplateResponse>;
1242
+ deleteTemplate(params: TemplateDeleteParams): Promise<ResponseSuccess>;
1243
+ }
1244
+ //#endregion
1245
+ //#region src/api/template/types/factory.d.ts
1246
+ interface TextParameter {
1247
+ type: 'text';
1248
+ value: string;
1249
+ }
1250
+ interface CurrencyParameter {
1251
+ type: 'currency';
1252
+ amount_1000: number;
1253
+ code: CurrencyCodesEnum;
1254
+ fallback_value: string;
1255
+ }
1256
+ interface DateTimeParameter {
1257
+ type: 'date_time';
1258
+ fallback_value: string;
1259
+ }
1260
+ interface MediaParameter {
1261
+ type: 'image' | 'video' | 'document';
1262
+ handle?: string;
1263
+ link?: string;
1264
+ }
1265
+ interface LocationParameter {
1266
+ type: 'location';
1267
+ latitude?: number;
1268
+ longitude?: number;
1269
+ name?: string;
1270
+ address?: string;
1271
+ }
1272
+ interface ProductParameter {
1273
+ type: 'product';
1274
+ product_retailer_id: string;
1275
+ }
1276
+ type TemplateParameter = TextParameter | CurrencyParameter | DateTimeParameter | MediaParameter | LocationParameter | ProductParameter;
1277
+ interface HeaderOptions {
1278
+ format: TemplateFormat;
1279
+ text?: string;
1280
+ parameters?: TemplateParameter[];
1281
+ example?: {
1282
+ header_text?: string[];
1283
+ header_text_named_params?: Array<{
1284
+ param_name: string;
1285
+ example: string;
1286
+ }>;
1287
+ header_handle?: string[];
1288
+ };
1289
+ }
1290
+ interface BodyOptions {
1291
+ text: string;
1292
+ parameters?: TemplateParameter[];
1293
+ example?: {
1294
+ body_text?: string[][];
1295
+ body_text_named_params?: Array<{
1296
+ param_name: string;
1297
+ example: string;
1298
+ }>;
1299
+ };
1300
+ }
1301
+ interface FooterOptions {
1302
+ text: string;
1303
+ }
1304
+ interface ButtonOptions {
1305
+ phone_number?: {
1306
+ text: string;
1307
+ phone_number: string;
1308
+ };
1309
+ url?: {
1310
+ text: string;
1311
+ url: string;
1312
+ example?: string;
1313
+ };
1314
+ quick_reply?: {
1315
+ text: string;
1316
+ }[];
1317
+ copy_code?: {
1318
+ example: string;
1319
+ };
1320
+ flow?: {
1321
+ text: string;
1322
+ flow_id?: string;
1323
+ flow_name?: string;
1324
+ flow_json?: string;
1325
+ flow_action?: 'navigate' | 'data_exchange';
1326
+ navigate_screen?: string;
1327
+ };
1328
+ mpm?: boolean;
1329
+ otp?: boolean;
1330
+ spm?: boolean;
1331
+ }
1332
+ interface CarouselCard {
1333
+ image?: string;
1334
+ video?: string;
1335
+ product?: string;
1336
+ body?: string;
1337
+ bodyParameters?: TemplateParameter[];
1338
+ buttons?: ButtonOptions;
1339
+ }
1340
+ interface CarouselOptions {
1341
+ cards: CarouselCard[];
1342
+ }
1343
+ interface LimitedTimeOfferOptions {
1344
+ expiration_time_ms: number;
1345
+ }
1346
+ interface ProductSection {
1347
+ title?: string;
1348
+ product_items: Array<{
1349
+ product_retailer_id: string;
1350
+ }>;
1351
+ }
1352
+ interface TemplateOptions {
1353
+ name: string;
1354
+ language: LanguagesEnum;
1355
+ category: CategoryEnum;
1356
+ header?: HeaderOptions;
1357
+ body?: BodyOptions;
1358
+ footer?: FooterOptions;
1359
+ buttons?: ButtonOptions;
1360
+ carousel?: CarouselOptions;
1361
+ limitedTimeOffer?: LimitedTimeOfferOptions;
1362
+ }
1363
+ interface OTPTemplateOptions {
1364
+ name: string;
1365
+ language: LanguagesEnum;
1366
+ code_expiration_minutes?: number;
1367
+ add_security_recommendation?: boolean;
1368
+ }
1369
+ interface AuthenticationTemplateOptions {
1370
+ name: string;
1371
+ language: LanguagesEnum;
1372
+ code_expiration_minutes?: number;
1373
+ add_security_recommendation?: boolean;
1374
+ copy_code_button?: boolean;
1375
+ }
1376
+ interface CatalogTemplateOptions {
1377
+ name: string;
1378
+ language: LanguagesEnum;
1379
+ header?: Omit<HeaderOptions, 'format'>;
1380
+ body: BodyOptions;
1381
+ footer?: FooterOptions;
1382
+ thumbnail_product_retailer_id: string;
1383
+ }
1384
+ interface CouponTemplateOptions {
1385
+ name: string;
1386
+ language: LanguagesEnum;
1387
+ header?: Omit<HeaderOptions, 'format'>;
1388
+ body: BodyOptions;
1389
+ footer?: FooterOptions;
1390
+ coupon_code: string;
1391
+ }
1392
+ interface LimitedTimeOfferTemplateOptions {
1393
+ name: string;
1394
+ language: LanguagesEnum;
1395
+ header?: Omit<HeaderOptions, 'format'>;
1396
+ body: BodyOptions;
1397
+ footer?: FooterOptions;
1398
+ expiration_time_ms: number;
1399
+ }
1400
+ interface MediaCardCarouselTemplateOptions {
1401
+ name: string;
1402
+ language: LanguagesEnum;
1403
+ cards: Array<{
1404
+ header: {
1405
+ format: 'IMAGE' | 'VIDEO';
1406
+ example: {
1407
+ header_handle: string[];
1408
+ };
1409
+ };
1410
+ body: BodyOptions;
1411
+ buttons?: ButtonOptions;
1412
+ }>;
1413
+ }
1414
+ interface MPMTemplateOptions {
1415
+ name: string;
1416
+ language: LanguagesEnum;
1417
+ header?: Omit<HeaderOptions, 'format'>;
1418
+ body: BodyOptions;
1419
+ footer?: FooterOptions;
1420
+ thumbnail_product_retailer_id: string;
1421
+ sections: ProductSection[];
1422
+ }
1423
+ interface ProductCardCarouselTemplateOptions {
1424
+ name: string;
1425
+ language: LanguagesEnum;
1426
+ header?: Omit<HeaderOptions, 'format'>;
1427
+ body: BodyOptions;
1428
+ footer?: FooterOptions;
1429
+ cards: Array<{
1430
+ product_retailer_id: string;
1431
+ }>;
1432
+ }
1433
+ interface SPMTemplateOptions {
1434
+ name: string;
1435
+ language: LanguagesEnum;
1436
+ header?: Omit<HeaderOptions, 'format'>;
1437
+ body: BodyOptions;
1438
+ footer?: FooterOptions;
1439
+ product_retailer_id: string;
1440
+ }
1441
+ //#endregion
1442
+ //#region src/api/messages/types/text.d.ts
1443
+ type TextObject = {
1444
+ body: string;
1445
+ preview_url?: boolean;
1446
+ };
1447
+ interface TextMessageParams extends MessageRequestParams<TextObject | string> {
1448
+ previewUrl?: boolean;
1449
+ }
1450
+ //#endregion
1451
+ //#region src/api/messages/types/template.d.ts
1452
+ type LanguageObject = {
1453
+ policy: 'deterministic';
1454
+ code: LanguagesEnum;
1455
+ };
1456
+ type ParametersObject<T extends ParametersTypesEnum> = {
1457
+ type: T;
1458
+ };
1459
+ type SimpleTextObject$1 = {
1460
+ text: string;
1461
+ };
1462
+ type TextParametersObject = ParametersObject<ParametersTypesEnum.Text> & SimpleTextObject$1;
1463
+ type CouponCodeParametersObject = ParametersObject<ParametersTypesEnum.CouponCode> & {
1464
+ coupon_code: string;
1465
+ };
1466
+ type CurrencyObject = {
1467
+ fallback_value: string;
1468
+ code: CurrencyCodesEnum;
1469
+ amount_1000: number;
1470
+ };
1471
+ type CurrencyParametersObject = ParametersObject<ParametersTypesEnum.Currency> & {
1472
+ currency: CurrencyObject;
1473
+ };
1474
+ type DateTimeObject = {
1475
+ fallback_value: string;
1476
+ };
1477
+ type DateTimeParametersObject = ParametersObject<ParametersTypesEnum.Currency> & {
1478
+ date_time: DateTimeObject;
1479
+ };
1480
+ type DocumentMediaObject$2 = {
1481
+ id?: string;
1482
+ link?: string;
1483
+ caption?: string;
1484
+ filename?: string;
1485
+ };
1486
+ type ImageMediaObject$2 = {
1487
+ id?: string;
1488
+ link?: string;
1489
+ caption?: string;
1490
+ };
1491
+ type VideoMediaObject$2 = {
1492
+ id?: string;
1493
+ link?: string;
1494
+ caption?: string;
1495
+ };
1496
+ type DocumentParametersObject = ParametersObject<ParametersTypesEnum.Document> & DocumentMediaObject$2;
1497
+ type ImageParametersObject = ParametersObject<ParametersTypesEnum.Image> & ImageMediaObject$2;
1498
+ type VideoParametersObject = ParametersObject<ParametersTypesEnum.Video> & VideoMediaObject$2;
1499
+ type ComponentObject<T extends ComponentTypesEnum> = {
1500
+ type: T;
1501
+ parameters: (CurrencyParametersObject | DateTimeParametersObject | DocumentParametersObject | ImageParametersObject | TextParametersObject | VideoParametersObject | CouponCodeParametersObject)[];
1502
+ };
1503
+ type ButtonComponentObject = ComponentObject<ComponentTypesEnum.Button> & {
1504
+ parameters?: (TextParametersObject | PayloadParametersObject)[];
1505
+ sub_type: SubTypeEnum;
1506
+ index: ButtonPositionEnum;
1507
+ };
1508
+ type PayloadParametersObject = ParametersObject<ParametersTypesEnum.Payload> & {
1509
+ payload: string;
1510
+ };
1511
+ type MessageTemplateObject<T extends ComponentTypesEnum> = {
1512
+ name: string;
1513
+ language: LanguageObject;
1514
+ components?: (ComponentObject<T> | ButtonComponentObject)[];
1515
+ };
1516
+ //#endregion
1517
+ //#region src/api/messages/types/media.d.ts
1518
+ type MetaMediaObject = {
1519
+ id: string;
1520
+ link?: never;
1521
+ };
1522
+ type HostedMediaObject = {
1523
+ id?: never;
1524
+ link: string;
1525
+ };
1526
+ type AudioMediaObject = MetaMediaObject | HostedMediaObject;
1527
+ type MetaDocumentMediaObject = MetaMediaObject & {
1528
+ caption?: string;
1529
+ filename?: string;
1530
+ };
1531
+ type HostedDocumentMediaObject = HostedMediaObject & {
1532
+ caption?: string;
1533
+ filename?: string;
1534
+ };
1535
+ type DocumentMediaObject = MetaDocumentMediaObject | HostedDocumentMediaObject;
1536
+ type MetaImageMediaObject = MetaMediaObject & {
1537
+ caption?: string;
1538
+ };
1539
+ type HostedImageMediaObject = HostedMediaObject & {
1540
+ caption?: string;
1541
+ };
1542
+ type ImageMediaObject = MetaImageMediaObject | HostedImageMediaObject;
1543
+ type MetaVideoMediaObject = MetaMediaObject & {
1544
+ caption?: string;
1545
+ };
1546
+ type HostedVideoMediaObject = HostedMediaObject & {
1547
+ caption?: string;
1548
+ };
1549
+ type VideoMediaObject = MetaVideoMediaObject | HostedVideoMediaObject;
1550
+ type StickerMediaObject = MetaMediaObject | HostedMediaObject;
1551
+ //#endregion
1552
+ //#region src/api/messages/types/contact.d.ts
1553
+ type AddressesObject = {
1554
+ street?: string;
1555
+ city?: string;
1556
+ state?: string;
1557
+ zip?: string;
1558
+ country?: string;
1559
+ country_code?: string;
1560
+ type?: 'HOME' | 'WORK' | string;
1561
+ };
1562
+ type EmailObject = {
1563
+ email?: string;
1564
+ type?: 'HOME' | 'WORK' | string;
1565
+ };
1566
+ type NameObject = {
1567
+ formatted_name: string;
1568
+ first_name?: string;
1569
+ last_name?: string;
1570
+ middle_name?: string;
1571
+ suffix?: string;
1572
+ prefix?: string;
1573
+ };
1574
+ type OrgObject = {
1575
+ company?: string;
1576
+ department?: string;
1577
+ title?: string;
1578
+ };
1579
+ type PhoneObject = {
1580
+ phone?: 'PHONE_NUMBER';
1581
+ type?: 'CELL' | 'MAIN' | 'IPHONE' | 'HOME' | 'WORK' | string;
1582
+ wa_id?: string;
1583
+ };
1584
+ type URLObject = {
1585
+ url?: string;
1586
+ type?: 'HOME' | 'WORK' | string;
1587
+ };
1588
+ type ContactObject = {
1589
+ addresses?: AddressesObject[];
1590
+ birthday?: `${number}${number}${number}${number}-${number}${number}-${number}${number}`;
1591
+ emails?: EmailObject[];
1592
+ name: NameObject;
1593
+ org?: OrgObject;
1594
+ phones?: PhoneObject[];
1595
+ urls?: URLObject[];
1596
+ };
1597
+ //#endregion
1598
+ //#region src/api/messages/types/location.d.ts
1599
+ type LocationObject = {
1600
+ longitude: number;
1601
+ latitude: number;
1602
+ name?: string;
1603
+ address?: string;
1604
+ };
1605
+ //#endregion
1606
+ //#region src/api/messages/types/interactive.d.ts
1607
+ type DocumentMediaObject$1 = {
1608
+ id?: string;
1609
+ link?: string;
1610
+ caption?: string;
1611
+ filename?: string;
1612
+ };
1613
+ type ImageMediaObject$1 = {
1614
+ id?: string;
1615
+ link?: string;
1616
+ caption?: string;
1617
+ };
1618
+ type VideoMediaObject$1 = {
1619
+ id?: string;
1620
+ link?: string;
1621
+ caption?: string;
1622
+ };
1623
+ type ProductObject = {
1624
+ product_retailer_id: string;
1625
+ };
1626
+ type SimpleTextObject = {
1627
+ text: string;
1628
+ };
1629
+ type RowObject = {
1630
+ id: string;
1631
+ title: string;
1632
+ description?: string;
1633
+ };
1634
+ type MultiProductSectionObject = {
1635
+ product_items: ProductObject[];
1636
+ rows?: never;
1637
+ title?: string;
1638
+ };
1639
+ type ListSectionObject = {
1640
+ product_items?: never;
1641
+ rows: RowObject[];
1642
+ title?: string;
1643
+ };
1644
+ type SectionObject = MultiProductSectionObject | ListSectionObject;
1645
+ type ButtonObject = {
1646
+ title: string;
1647
+ id: string;
1648
+ };
1649
+ type ReplyButtonObject = {
1650
+ type: 'reply';
1651
+ reply: ButtonObject;
1652
+ };
1653
+ type ActionObject = {
1654
+ buttons?: ReplyButtonObject[];
1655
+ catalog_id?: string;
1656
+ product_retailer_id?: string;
1657
+ sections?: SectionObject[];
1658
+ };
1659
+ type HeaderObject = {
1660
+ type: 'document' | 'image' | 'text' | 'video';
1661
+ document?: DocumentMediaObject$1;
1662
+ image?: ImageMediaObject$1;
1663
+ text?: string;
1664
+ video?: VideoMediaObject$1;
1665
+ };
1666
+ type ButtonInteractiveObject = {
1667
+ type: InteractiveTypesEnum.Button;
1668
+ body: SimpleTextObject;
1669
+ footer?: SimpleTextObject;
1670
+ header?: HeaderObject;
1671
+ action: ActionObject;
1672
+ };
1673
+ type ListInteractiveObject = {
1674
+ type: InteractiveTypesEnum.List;
1675
+ body: SimpleTextObject;
1676
+ footer?: SimpleTextObject;
1677
+ header?: HeaderObject;
1678
+ action: ActionObject;
1679
+ };
1680
+ type ProductInteractiveObject = {
1681
+ type: InteractiveTypesEnum.Product;
1682
+ body?: SimpleTextObject;
1683
+ footer?: SimpleTextObject;
1684
+ header?: HeaderObject;
1685
+ action: ActionObject;
1686
+ };
1687
+ type ProductListInteractiveObject = {
1688
+ type: InteractiveTypesEnum.ProductList;
1689
+ body: SimpleTextObject;
1690
+ footer?: SimpleTextObject;
1691
+ header: HeaderObject;
1692
+ action: ActionObject;
1693
+ };
1694
+ type CtaUrlParameters = {
1695
+ display_text: string;
1696
+ url: string;
1697
+ };
1698
+ type CtaUrlActionObject = {
1699
+ name: 'cta_url';
1700
+ parameters: CtaUrlParameters;
1701
+ };
1702
+ type CtaUrlInteractiveObject = {
1703
+ type: InteractiveTypesEnum.CtaUrl;
1704
+ body?: SimpleTextObject;
1705
+ footer?: SimpleTextObject;
1706
+ header?: HeaderObject;
1707
+ action: CtaUrlActionObject;
1708
+ };
1709
+ type LocationRequestActionObject = {
1710
+ name: 'send_location';
1711
+ };
1712
+ type LocationRequestInteractiveObject = {
1713
+ type: InteractiveTypesEnum.LocationRequest;
1714
+ body: SimpleTextObject;
1715
+ footer?: SimpleTextObject;
1716
+ header?: HeaderObject;
1717
+ action: LocationRequestActionObject;
1718
+ };
1719
+ type AddressValues = {
1720
+ name?: string;
1721
+ phone_number?: string;
1722
+ in_pin_code?: string;
1723
+ house_number?: string;
1724
+ floor_number?: string;
1725
+ tower_number?: string;
1726
+ building_name?: string;
1727
+ address?: string;
1728
+ landmark_area?: string;
1729
+ city?: string;
1730
+ state?: string;
1731
+ };
1732
+ type SavedAddress = {
1733
+ id: string;
1734
+ value: AddressValues;
1735
+ };
1736
+ type ValidationErrors = { [key in keyof AddressValues]?: string };
1737
+ type AddressMessageParameters = {
1738
+ country: string;
1739
+ values?: AddressValues;
1740
+ saved_addresses?: SavedAddress[];
1741
+ validation_errors?: ValidationErrors;
1742
+ };
1743
+ type AddressMessageActionObject = {
1744
+ name: 'address_message';
1745
+ parameters: AddressMessageParameters;
1746
+ };
1747
+ type AddressMessageInteractiveObject = {
1748
+ type: InteractiveTypesEnum.AddressMessage;
1749
+ body: SimpleTextObject;
1750
+ footer?: SimpleTextObject;
1751
+ header?: HeaderObject;
1752
+ action: AddressMessageActionObject;
1753
+ };
1754
+ type FlowParameters = {
1755
+ flow_message_version: string;
1756
+ flow_id?: string;
1757
+ flow_name?: string;
1758
+ flow_cta: string;
1759
+ mode?: 'draft' | 'published';
1760
+ flow_token: string;
1761
+ flow_action: 'navigate' | 'data_exchange';
1762
+ flow_action_payload?: {
1763
+ screen?: string;
1764
+ data?: Record<string, string>;
1765
+ };
1766
+ };
1767
+ type FlowActionObject = {
1768
+ name: 'flow';
1769
+ parameters: FlowParameters;
1770
+ };
1771
+ type FlowInteractiveObject = {
1772
+ type: InteractiveTypesEnum.Flow;
1773
+ body: SimpleTextObject;
1774
+ footer?: SimpleTextObject;
1775
+ header?: HeaderObject;
1776
+ action: FlowActionObject;
1777
+ };
1778
+ type InteractiveObject = ButtonInteractiveObject | ListInteractiveObject | ProductInteractiveObject | ProductListInteractiveObject | CtaUrlInteractiveObject | LocationRequestInteractiveObject | AddressMessageInteractiveObject | FlowInteractiveObject;
1779
+ //#endregion
1780
+ //#region src/api/messages/types/reaction.d.ts
1781
+ interface ReactionParams {
1782
+ messageId: string;
1783
+ emoji: string;
1784
+ to: string;
1785
+ }
1786
+ //#endregion
1787
+ //#region src/api/messages/types/common.d.ts
1788
+ type GeneralMessageBody = GeneralRequestBody & {
1789
+ /**
1790
+ * The Meta messaging product name.
1791
+ * @default 'whatsapp'
1792
+ */
1793
+ messaging_product: 'whatsapp';
1794
+ };
1795
+ type ConTextObject = {
1796
+ message_id: string;
1797
+ };
1798
+ type MessageRequestBody<T extends MessageTypesEnum> = GeneralMessageBody & {
1799
+ recipient_type?: string;
1800
+ to: string;
1801
+ context?: ConTextObject;
1802
+ type?: T;
1803
+ };
1804
+ interface MessageRequestParams<T> {
1805
+ body: T;
1806
+ to: string;
1807
+ replyMessageId?: string;
1808
+ }
1809
+ interface StatusParams {
1810
+ status: string;
1811
+ messageId: string;
1812
+ typingIndicator?: {
1813
+ type: string;
1814
+ };
1815
+ }
1816
+ type MessagesResponse = GeneralMessageBody & {
1817
+ contacts: [{
1818
+ input: string;
1819
+ wa_id: string;
1820
+ }];
1821
+ messages: [{
1822
+ id: string;
1823
+ }];
1824
+ };
1825
+ declare class MessagesClass extends BaseClass {
1826
+ text(params: TextMessageParams): Promise<MessagesResponse>;
1827
+ template(params: MessageRequestParams<MessageTemplateObject<ComponentTypesEnum>>): Promise<MessagesResponse>;
1828
+ audio(params: MessageRequestParams<AudioMediaObject>): Promise<MessagesResponse>;
1829
+ document(params: MessageRequestParams<DocumentMediaObject>): Promise<MessagesResponse>;
1830
+ image(params: MessageRequestParams<ImageMediaObject>): Promise<MessagesResponse>;
1831
+ video(params: MessageRequestParams<VideoMediaObject>): Promise<MessagesResponse>;
1832
+ sticker(params: MessageRequestParams<StickerMediaObject>): Promise<MessagesResponse>;
1833
+ contacts(params: MessageRequestParams<[ContactObject]>): Promise<MessagesResponse>;
1834
+ location(params: MessageRequestParams<LocationObject>): Promise<MessagesResponse>;
1835
+ interactive(params: MessageRequestParams<InteractiveObject>): Promise<MessagesResponse>;
1836
+ interactiveList(params: MessageRequestParams<InteractiveObject & {
1837
+ type: InteractiveTypesEnum.List;
1838
+ }>): Promise<MessagesResponse>;
1839
+ interactiveCtaUrl(params: MessageRequestParams<InteractiveObject & {
1840
+ type: InteractiveTypesEnum.CtaUrl;
1841
+ }>): Promise<MessagesResponse>;
1842
+ interactiveLocationRequest(params: MessageRequestParams<InteractiveObject & {
1843
+ type: InteractiveTypesEnum.LocationRequest;
1844
+ }>): Promise<MessagesResponse>;
1845
+ interactiveAddressMessage(params: MessageRequestParams<InteractiveObject & {
1846
+ type: InteractiveTypesEnum.AddressMessage;
1847
+ }>): Promise<MessagesResponse>;
1848
+ interactiveReplyButtons(params: MessageRequestParams<InteractiveObject & {
1849
+ type: InteractiveTypesEnum.Button;
1850
+ }>): Promise<MessagesResponse>;
1851
+ interactiveFlow(params: MessageRequestParams<InteractiveObject & {
1852
+ type: InteractiveTypesEnum.Flow;
1853
+ }>): Promise<MessagesResponse>;
1854
+ reaction(params: ReactionParams): Promise<MessagesResponse>;
1855
+ markAsRead(params: {
1856
+ messageId: string;
1857
+ }): Promise<MessagesResponse>;
1858
+ showTypingIndicator(params: {
1859
+ messageId: string;
1860
+ }): Promise<MessagesResponse>;
1861
+ status(params: StatusParams): Promise<MessagesResponse>;
1862
+ }
1863
+ //#endregion
1864
+ //#region src/api/media/types/common.d.ts
1865
+ type MediaResponse = {
1866
+ id: string;
1867
+ url: string;
1868
+ mime_type: string;
1869
+ sha256: string;
1870
+ file_size: number;
1871
+ messaging_product: 'whatsapp';
1872
+ };
1873
+ type MediasResponse = {
1874
+ data: MediaResponse[];
1875
+ paging: {
1876
+ cursors: {
1877
+ before: string;
1878
+ after: string;
1879
+ };
1880
+ };
1881
+ };
1882
+ type UploadMediaResponse = {
1883
+ id: string;
1884
+ };
1885
+ interface MediaClass {
1886
+ getMediaById(mediaId: string, phone_number_id?: string): Promise<MediaResponse>;
1887
+ uploadMedia(file: File, messagingProduct?: string): Promise<UploadMediaResponse>;
1888
+ deleteMedia(mediaId: string, phone_number_id?: string): Promise<ResponseSuccess>;
1889
+ downloadMedia(mediaUrl: string): Promise<Blob>;
1890
+ }
1891
+ //#endregion
1892
+ //#region src/api/flow/types/common.d.ts
1893
+ /**
1894
+ * Enum for Flow Status
1895
+ */
1896
+ declare enum FlowStatusEnum {
1897
+ Draft = "DRAFT",
1898
+ Published = "PUBLISHED",
1899
+ Throttled = "THROTTLED",
1900
+ Blocked = "BLOCKED",
1901
+ Deprecated = "DEPRECATED",
1902
+ }
1903
+ /**
1904
+ * Enum for Flow Categories
1905
+ */
1906
+ declare enum FlowCategoryEnum {
1907
+ SignUp = "SIGN_UP",
1908
+ SignIn = "SIGN_IN",
1909
+ AppointmentBooking = "APPOINTMENT_BOOKING",
1910
+ LeadGeneration = "LEAD_GENERATION",
1911
+ ContactUs = "CONTACT_US",
1912
+ CustomerSupport = "CUSTOMER_SUPPORT",
1913
+ Survey = "SURVEY",
1914
+ Other = "OTHER",
1915
+ }
1916
+ declare enum FlowActionEnum {
1917
+ INIT = "INIT",
1918
+ BACK = "BACK",
1919
+ DATA_EXCHANGE = "data_exchange",
1920
+ }
1921
+ /**
1922
+ * Enum for Flow Types in webhook handlers
1923
+ * Used to register handlers for specific flow events
1924
+ */
1925
+ declare enum FlowTypeEnum {
1926
+ /** Health check/ping requests */
1927
+ Ping = "ping",
1928
+ /** Data exchange requests */
1929
+ Change = "data_exchange",
1930
+ /** Error notification requests */
1931
+ Error = "error",
1932
+ /** Match all flow action types */
1933
+ All = "*",
1934
+ }
1935
+ type FlowType = (typeof FlowTypeEnum)[keyof typeof FlowTypeEnum];
1936
+ /**
1937
+ * Flow Validation Error Pointer
1938
+ */
1939
+ interface FlowValidationErrorPointer {
1940
+ line_start: number;
1941
+ line_end: number;
1942
+ column_start: number;
1943
+ column_end: number;
1944
+ path: string;
1945
+ }
1946
+ /**
1947
+ * Flow Validation Error
1948
+ */
1949
+ interface FlowValidationError {
1950
+ error: string;
1951
+ error_type: string;
1952
+ message: string;
1953
+ line_start: number;
1954
+ line_end: number;
1955
+ column_start: number;
1956
+ column_end: number;
1957
+ pointers: FlowValidationErrorPointer[];
1958
+ }
1959
+ /**
1960
+ * Flow Item
1961
+ */
1962
+ interface Flow {
1963
+ id: string;
1964
+ name: string;
1965
+ status: FlowStatusEnum;
1966
+ categories: FlowCategoryEnum[];
1967
+ validation_errors: FlowValidationError[];
1968
+ }
1969
+ /**
1970
+ * Pagination Cursors
1971
+ */
1972
+ interface PaginationCursors {
1973
+ before: string;
1974
+ after: string;
1975
+ }
1976
+ /**
1977
+ * Pagination Object
1978
+ */
1979
+ interface Pagination {
1980
+ cursors: PaginationCursors;
1981
+ }
1982
+ /**
1983
+ * Flows List Response
1984
+ */
1985
+ interface FlowsListResponse {
1986
+ data: Flow[];
1987
+ paging: Pagination;
1988
+ }
1989
+ /**
1990
+ * Flow Asset
1991
+ */
1992
+ interface FlowAsset {
1993
+ name: string;
1994
+ asset_type: string;
1995
+ download_url: string;
1996
+ }
1997
+ /**
1998
+ * Flow Assets Response
1999
+ */
2000
+ interface FlowAssetsResponse {
2001
+ data: FlowAsset[];
2002
+ paging: Pagination;
2003
+ }
2004
+ /**
2005
+ * Flow Preview
2006
+ */
2007
+ interface FlowPreview {
2008
+ preview_url: string;
2009
+ expires_at: string;
2010
+ }
2011
+ /**
2012
+ * Flow Preview Response
2013
+ */
2014
+ interface FlowPreviewResponse {
2015
+ preview: FlowPreview;
2016
+ id: string;
2017
+ }
2018
+ /**
2019
+ * Flow Migration Result
2020
+ */
2021
+ interface FlowMigrationResult {
2022
+ source_name: string;
2023
+ source_id: string;
2024
+ migrated_id: string;
2025
+ }
2026
+ /**
2027
+ * Flow Migration Failure
2028
+ */
2029
+ interface FlowMigrationFailure {
2030
+ source_name: string;
2031
+ error_code: string;
2032
+ error_message: string;
2033
+ }
2034
+ /**
2035
+ * Create Flow Response
2036
+ */
2037
+ interface CreateFlowResponse {
2038
+ id: string;
2039
+ success: boolean;
2040
+ validation_errors?: FlowValidationError[];
2041
+ }
2042
+ /**
2043
+ * Update Flow Response
2044
+ */
2045
+ interface UpdateFlowResponse {
2046
+ success: boolean;
2047
+ validation_errors?: FlowValidationError[];
2048
+ }
2049
+ /**
2050
+ * Flow Migration Response
2051
+ */
2052
+ interface FlowMigrationResponse {
2053
+ migrated_flows: FlowMigrationResult[];
2054
+ failed_flows: FlowMigrationFailure[];
2055
+ }
2056
+ /**
2057
+ * Validate Flow JSON Response
2058
+ */
2059
+ interface ValidateFlowJsonResponse {
2060
+ valid: boolean;
2061
+ success: boolean;
2062
+ validation_errors?: FlowValidationError[];
2063
+ }
2064
+ /**
2065
+ * WhatsApp Flow Endpoint - Encrypted Request Payload
2066
+ * Represents the raw encrypted data received from WhatsApp
2067
+ */
2068
+
2069
+ /**
2070
+ * WhatsApp Flow Endpoint - Health Check Response
2071
+ * The expected response structure for health check requests
2072
+ */
2073
+ interface FlowHealthCheckResponse {
2074
+ data: {
2075
+ status: 'active';
2076
+ };
2077
+ }
2078
+ /**
2079
+ * WhatsApp Flow Endpoint - Data Exchange Request
2080
+ * Represents the structure of a data exchange request
2081
+ */
2082
+
2083
+ /**
2084
+ * WhatsApp Flow Endpoint - Data Exchange Response
2085
+ * The expected response structure for data exchange requests
2086
+ */
2087
+ interface FlowDataExchangeResponse {
2088
+ screen?: string;
2089
+ data?: Record<string, any | {
2090
+ error_message?: string;
2091
+ }>;
2092
+ }
2093
+ /**
2094
+ * WhatsApp Flow Endpoint - Success Screen Response
2095
+ * The expected response structure for success screen requests
2096
+ */
2097
+ interface FlowSuccessScreenResponse {
2098
+ screen: 'SUCCESS';
2099
+ data: {
2100
+ extension_message_response?: {
2101
+ params?: {
2102
+ flow_token: string;
2103
+ [key: string]: string;
2104
+ };
2105
+ };
2106
+ };
2107
+ }
2108
+ /**
2109
+ * WhatsApp Flow Endpoint - Error Notification Request
2110
+ * Represents the structure of an error notification request
2111
+ */
2112
+
2113
+ /**
2114
+ * WhatsApp Flow Endpoint - Error Notification Response
2115
+ * The expected response structure for error notification requests
2116
+ */
2117
+ interface FlowErrorNotificationResponse {
2118
+ acknowledged: boolean;
2119
+ }
2120
+ /**
2121
+ * WhatsApp Flow Endpoint - Comprehensive Request Object
2122
+ * A combined type that includes all possible fields from different request types
2123
+ * with all fields being optional for flexibility
2124
+ */
2125
+ interface FlowEndpointRequest {
2126
+ version?: '3.0';
2127
+ action?: 'ping' | FlowActionEnum;
2128
+ screen?: string;
2129
+ flow_token?: string;
2130
+ data?: Record<string, any> & {
2131
+ error_key?: string;
2132
+ error_message?: string;
2133
+ };
2134
+ }
2135
+ /**
2136
+ * WhatsApp Flow Endpoint - Response
2137
+ * Union type for all possible response types from a Flow endpoint
2138
+ */
2139
+ type FlowEndpointResponse = FlowHealthCheckResponse | FlowDataExchangeResponse | FlowErrorNotificationResponse | FlowSuccessScreenResponse;
2140
+ interface FlowClass {
2141
+ /**
2142
+ * List Flows
2143
+ *
2144
+ * @param wabaId - The WABA ID
2145
+ * @returns Promise with the list of flows
2146
+ */
2147
+ listFlows(wabaId: string): Promise<FlowsListResponse>;
2148
+ /**
2149
+ * Create Flow
2150
+ *
2151
+ * @param wabaId - The WABA ID
2152
+ * @param data - The flow data including name, categories, endpoint_uri, and optional clone_flow_id
2153
+ * @returns Promise with the created flow ID
2154
+ */
2155
+ createFlow(wabaId: string, data: {
2156
+ name: string;
2157
+ categories?: FlowCategoryEnum[];
2158
+ endpoint_uri?: string;
2159
+ clone_flow_id?: string;
2160
+ flow_json?: string;
2161
+ publish?: boolean;
2162
+ }): Promise<CreateFlowResponse>;
2163
+ /**
2164
+ * Get Flow
2165
+ *
2166
+ * @param flowId - The flow ID
2167
+ * @param fields - Optional fields to return
2168
+ * @param dateFormat - Optional date format
2169
+ * @returns Promise with the flow details
2170
+ */
2171
+ getFlow(flowId: string, fields?: string, dateFormat?: string): Promise<Flow | FlowPreviewResponse>;
2172
+ /**
2173
+ * Update Flow Metadata
2174
+ *
2175
+ * @param flowId - The flow ID
2176
+ * @param data - The flow metadata to update
2177
+ * @returns Promise with the success status
2178
+ */
2179
+ updateFlowMetadata(flowId: string, data: {
2180
+ name?: string;
2181
+ categories?: FlowCategoryEnum[];
2182
+ endpoint_uri?: string;
2183
+ application_id?: string;
2184
+ }): Promise<ResponseSuccess>;
2185
+ /**
2186
+ * Delete Flow
2187
+ *
2188
+ * @param flowId - The flow ID
2189
+ * @returns Promise with the success status
2190
+ */
2191
+ deleteFlow(flowId: string): Promise<ResponseSuccess>;
2192
+ /**
2193
+ * List Assets (Get Flow JSON URL)
2194
+ *
2195
+ * @param flowId - The flow ID
2196
+ * @returns Promise with the list of assets
2197
+ */
2198
+ listAssets(flowId: string): Promise<FlowAssetsResponse>;
2199
+ /**
2200
+ * Update Flow JSON
2201
+ *
2202
+ * @param flowId - The flow ID
2203
+ * @param data - The asset data including asset_type, file, and name
2204
+ * @returns Promise with the success status and validation errors
2205
+ */
2206
+ updateFlowJson(flowId: string, data: {
2207
+ file: Blob | Buffer | object;
2208
+ name?: string;
2209
+ }): Promise<UpdateFlowResponse>;
2210
+ /**
2211
+ * Validate Flow JSON by attempting an update without publishing.
2212
+ * This is a convenience method; the API doesn't have a dedicated validation endpoint.
2213
+ *
2214
+ * @param flowId - The ID of the Flow (must exist, can be in DRAFT status).
2215
+ * @param flowJsonData - The Flow JSON content as a Buffer, JSON object, or Blob.
2216
+ * @returns Promise indicating if the JSON is valid and includes validation errors if any.
2217
+ */
2218
+ validateFlowJson(flowId: string, flowJsonData: Blob | Buffer | object): Promise<ValidateFlowJsonResponse>;
2219
+ /**
2220
+ * Publish Flow
2221
+ *
2222
+ * @param flowId - The flow ID
2223
+ * @returns Promise with the success status
2224
+ */
2225
+ publishFlow(flowId: string): Promise<ResponseSuccess>;
2226
+ /**
2227
+ * Deprecate Flow
2228
+ *
2229
+ * @param flowId - The flow ID
2230
+ * @returns Promise with the success status
2231
+ */
2232
+ deprecateFlow(flowId: string): Promise<ResponseSuccess>;
2233
+ /**
2234
+ * Migrate Flows
2235
+ *
2236
+ * @param wabaId - The destination WABA ID
2237
+ * @param data - The migration data including source_waba_id and optional source_flow_names
2238
+ * @returns Promise with migration results
2239
+ */
2240
+ migrateFlows(wabaId: string, data: {
2241
+ source_waba_id: string;
2242
+ source_flow_names?: string[];
2243
+ }): Promise<FlowMigrationResponse>;
2244
+ }
2245
+ //#endregion
2246
+ //#region src/core/webhook/types.d.ts
2247
+ interface WebhookContact {
2248
+ /**
2249
+ * WhatsApp ID of the contact. Business can respond to this contact using this ID.
2250
+ */
2251
+ wa_id: string;
2252
+ /**
2253
+ * Additional unique, alphanumeric identifier for a WhatsApp user
2254
+ */
2255
+ user_id?: string;
2256
+ /**
2257
+ * Profile of Whatsapp user
2258
+ */
2259
+ profile: {
2260
+ /**
2261
+ * The display name of the contact
2262
+ */
2263
+ name: string;
2264
+ };
2265
+ }
2266
+ /**
2267
+ * Base message interface with common properties
2268
+ */
2269
+ interface BaseMessage {
2270
+ id: string;
2271
+ from: string;
2272
+ timestamp: string;
2273
+ type: MessageTypesEnum;
2274
+ /**
2275
+ * Context object, included when a user replies or interacts
2276
+ */
2277
+ context?: {
2278
+ /**
2279
+ * ID of the message
2280
+ */
2281
+ id?: string;
2282
+ /**
2283
+ * ID of the sender
2284
+ */
2285
+ from?: string;
2286
+ /**
2287
+ * ID of the message being replied to or interacted with
2288
+ */
2289
+ message_id: string;
2290
+ /**
2291
+ * ID of the forwarded message, if applicable
2292
+ */
2293
+ forwarded?: boolean;
2294
+ /**
2295
+ * Frequently forwarded status
2296
+ */
2297
+ frequently_forwarded?: boolean;
2298
+ /**
2299
+ * Original message information if the message was referred
2300
+ */
2301
+ referred_product?: {
2302
+ /**
2303
+ * Catalog ID
2304
+ */
2305
+ catalog_id: string;
2306
+ /**
2307
+ * Product ID
2308
+ */
2309
+ product_retailer_id: string;
2310
+ };
2311
+ };
2312
+ /**
2313
+ * Errors array, if the message had errors
2314
+ */
2315
+ errors?: Array<{
2316
+ /**
2317
+ * Error code
2318
+ */
2319
+ code: number;
2320
+ /**
2321
+ * Error title
2322
+ */
2323
+ title: string;
2324
+ /**
2325
+ * Error message
2326
+ */
2327
+ message: string;
2328
+ /**
2329
+ * Error details object
2330
+ */
2331
+ error_data?: {
2332
+ /**
2333
+ * Describes the error details
2334
+ */
2335
+ details: string;
2336
+ };
2337
+ }>;
2338
+ }
2339
+ /**
2340
+ * Text message interface
2341
+ */
2342
+ interface TextMessage extends BaseMessage {
2343
+ type: MessageTypesEnum.Text;
2344
+ text: {
2345
+ /**
2346
+ * The text content of the message
2347
+ */
2348
+ body: string;
2349
+ preview_url?: boolean;
2350
+ };
2351
+ }
2352
+ /**
2353
+ * Image message interface
2354
+ */
2355
+ interface ImageMessage extends BaseMessage {
2356
+ type: MessageTypesEnum.Image;
2357
+ image: {
2358
+ /**
2359
+ * The image caption (if provided)
2360
+ */
2361
+ caption?: string;
2362
+ /**
2363
+ * The SHA256 hash of the image
2364
+ */
2365
+ sha256?: string;
2366
+ /**
2367
+ * The ID for the image
2368
+ */
2369
+ id: string;
2370
+ /**
2371
+ * The MIME type of the image
2372
+ */
2373
+ mime_type: string;
2374
+ };
2375
+ }
2376
+ /**
2377
+ * Video message interface
2378
+ */
2379
+ interface VideoMessage extends BaseMessage {
2380
+ type: MessageTypesEnum.Video;
2381
+ video: {
2382
+ /**
2383
+ * The video caption (if provided)
2384
+ */
2385
+ caption?: string;
2386
+ /**
2387
+ * The SHA256 hash of the video
2388
+ */
2389
+ sha256?: string;
2390
+ /**
2391
+ * The ID for the video
2392
+ */
2393
+ id: string;
2394
+ /**
2395
+ * The MIME type of the video
2396
+ */
2397
+ mime_type: string;
2398
+ };
2399
+ }
2400
+ /**
2401
+ * Audio message interface
2402
+ */
2403
+ interface AudioMessage extends BaseMessage {
2404
+ type: MessageTypesEnum.Audio;
2405
+ audio: {
2406
+ /**
2407
+ * The ID for the audio file
2408
+ */
2409
+ id: string;
2410
+ /**
2411
+ * The MIME type of the audio file
2412
+ */
2413
+ mime_type: string;
2414
+ /**
2415
+ * Whether the audio is a voice message
2416
+ */
2417
+ voice?: boolean;
2418
+ };
2419
+ }
2420
+ /**
2421
+ * Document message interface
2422
+ */
2423
+ interface DocumentMessage extends BaseMessage {
2424
+ type: MessageTypesEnum.Document;
2425
+ document: {
2426
+ /**
2427
+ * The document caption (if provided)
2428
+ */
2429
+ caption?: string;
2430
+ /**
2431
+ * The document filename
2432
+ */
2433
+ filename: string;
2434
+ /**
2435
+ * The SHA256 hash of the document
2436
+ */
2437
+ sha256?: string;
2438
+ /**
2439
+ * The ID for the document
2440
+ */
2441
+ id: string;
2442
+ /**
2443
+ * The MIME type of the document
2444
+ */
2445
+ mime_type: string;
2446
+ };
2447
+ }
2448
+ /**
2449
+ * Sticker message interface
2450
+ */
2451
+ interface StickerMessage extends BaseMessage {
2452
+ type: MessageTypesEnum.Sticker;
2453
+ sticker: {
2454
+ /**
2455
+ * The ID for the sticker
2456
+ */
2457
+ id: string;
2458
+ /**
2459
+ * Whether this is an animated sticker
2460
+ */
2461
+ animated: boolean;
2462
+ /**
2463
+ * The MIME type of the sticker
2464
+ */
2465
+ mime_type: string;
2466
+ };
2467
+ }
2468
+ /**
2469
+ * Reaction message interface
2470
+ */
2471
+ interface ReactionMessage extends BaseMessage {
2472
+ type: MessageTypesEnum.Reaction;
2473
+ reaction: {
2474
+ /**
2475
+ * The ID of the message being reacted to
2476
+ */
2477
+ message_id: string;
2478
+ /**
2479
+ * Emoji used for the reaction
2480
+ */
2481
+ emoji: string;
2482
+ };
2483
+ }
2484
+ /**
2485
+ * Contacts message interface
2486
+ */
2487
+ interface ContactsMessage extends BaseMessage {
2488
+ type: MessageTypesEnum.Contacts;
2489
+ contacts: Array<{
2490
+ /**
2491
+ * The contact's name
2492
+ */
2493
+ name: {
2494
+ /**
2495
+ * The formatted name
2496
+ */
2497
+ formatted_name: string;
2498
+ /**
2499
+ * The first name
2500
+ */
2501
+ first_name?: string;
2502
+ /**
2503
+ * The last name
2504
+ */
2505
+ last_name?: string;
2506
+ /**
2507
+ * The middle name
2508
+ */
2509
+ middle_name?: string;
2510
+ /**
2511
+ * The suffix
2512
+ */
2513
+ suffix?: string;
2514
+ /**
2515
+ * The prefix
2516
+ */
2517
+ prefix?: string;
2518
+ };
2519
+ /**
2520
+ * The contact's phone numbers
2521
+ */
2522
+ phones?: Array<{
2523
+ phone: string;
2524
+ type?: string;
2525
+ wa_id?: string;
2526
+ }>;
2527
+ /**
2528
+ * The contact's emails
2529
+ */
2530
+ emails?: Array<{
2531
+ email: string;
2532
+ type?: string;
2533
+ }>;
2534
+ /**
2535
+ * The contact's addresses
2536
+ */
2537
+ addresses?: Array<{
2538
+ street?: string;
2539
+ city?: string;
2540
+ state?: string;
2541
+ zip?: string;
2542
+ country?: string;
2543
+ country_code?: string;
2544
+ type?: string;
2545
+ }>;
2546
+ /**
2547
+ * The contact's organizations
2548
+ */
2549
+ org?: {
2550
+ company?: string;
2551
+ department?: string;
2552
+ title?: string;
2553
+ };
2554
+ /**
2555
+ * The contact's URLs
2556
+ */
2557
+ urls?: Array<{
2558
+ url: string;
2559
+ type?: string;
2560
+ }>;
2561
+ /**
2562
+ * The contact's birthday (YYYY-MM-DD format)
2563
+ */
2564
+ birthday?: string;
2565
+ }>;
2566
+ }
2567
+ /**
2568
+ * Location message interface
2569
+ */
2570
+ interface LocationMessage extends BaseMessage {
2571
+ type: MessageTypesEnum.Location;
2572
+ location: {
2573
+ /**
2574
+ * Latitude of the location
2575
+ */
2576
+ latitude: number;
2577
+ /**
2578
+ * Longitude of the location
2579
+ */
2580
+ longitude: number;
2581
+ /**
2582
+ * Name of the location
2583
+ */
2584
+ name?: string;
2585
+ /**
2586
+ * Address of the location
2587
+ */
2588
+ address?: string;
2589
+ };
2590
+ }
2591
+ /**
2592
+ * Interactive message interface
2593
+ */
2594
+ interface InteractiveMessage extends BaseMessage {
2595
+ type: MessageTypesEnum.Interactive;
2596
+ interactive: {
2597
+ /**
2598
+ * Type of the interactive message
2599
+ * Can be: button_reply, list_reply, flow, nfm_reply, etc.
2600
+ */
2601
+ type: string;
2602
+ /**
2603
+ * ID for the button that was clicked
2604
+ */
2605
+ button_reply?: {
2606
+ id: string;
2607
+ title: string;
2608
+ };
2609
+ /**
2610
+ * ID for the list item that was selected
2611
+ */
2612
+ list_reply?: {
2613
+ id: string;
2614
+ title: string;
2615
+ description?: string;
2616
+ };
2617
+ /**
2618
+ * NFM (No-Code Flow Message) reply data
2619
+ */
2620
+ nfm_reply?: {
2621
+ /**
2622
+ * Response data in JSON format
2623
+ */
2624
+ response_json: string;
2625
+ /**
2626
+ * Body text of the reply
2627
+ */
2628
+ body: string;
2629
+ /**
2630
+ * Name of the flow
2631
+ */
2632
+ name: string;
2633
+ };
2634
+ };
2635
+ }
2636
+ /**
2637
+ * System message interface
2638
+ */
2639
+ interface SystemMessage extends BaseMessage {
2640
+ type: MessageTypesEnum.System;
2641
+ system: {
2642
+ /**
2643
+ * The type of system update
2644
+ */
2645
+ type: string;
2646
+ /**
2647
+ * User's identity if the update is a customer identity change
2648
+ */
2649
+ identity?: string;
2650
+ /**
2651
+ * Old and new phone numbers if the update is a phone number change
2652
+ */
2653
+ customer?: {
2654
+ /**
2655
+ * The previous phone number
2656
+ */
2657
+ previous_wa_id: string;
2658
+ /**
2659
+ * The new phone number
2660
+ */
2661
+ wa_id: string;
2662
+ };
2663
+ };
2664
+ }
2665
+ /**
2666
+ * Order message interface
2667
+ */
2668
+ interface OrderMessage extends BaseMessage {
2669
+ type: MessageTypesEnum.Order;
2670
+ order: {
2671
+ /**
2672
+ * Catalog ID
2673
+ */
2674
+ catalog_id: string;
2675
+ /**
2676
+ * Product items in the order
2677
+ */
2678
+ product_items: Array<{
2679
+ /**
2680
+ * Product ID
2681
+ */
2682
+ product_retailer_id: string;
2683
+ /**
2684
+ * Quantity of the product
2685
+ */
2686
+ quantity: number;
2687
+ /**
2688
+ * Item price
2689
+ */
2690
+ item_price: number;
2691
+ /**
2692
+ * Currency code
2693
+ */
2694
+ currency: string;
2695
+ }>;
2696
+ /**
2697
+ * Text message included with the order
2698
+ */
2699
+ text?: string;
2700
+ };
2701
+ }
2702
+ /**
2703
+ * Button message interface
2704
+ */
2705
+ interface ButtonMessage extends BaseMessage {
2706
+ type: MessageTypesEnum.Button;
2707
+ button: {
2708
+ /**
2709
+ * The payload for the button
2710
+ */
2711
+ payload: string;
2712
+ /**
2713
+ * Button text
2714
+ */
2715
+ text: string;
2716
+ };
2717
+ }
2718
+ /**
2719
+ * Union type for all message types
2720
+ */
2721
+
2722
+ /**
2723
+ * Represents a message received through the webhook
2724
+ * Based on Meta's documentation: https://developers.facebook.com/docs/whatsapp/cloud-api/webhooks/components#messages-object
2725
+ */
2726
+ interface WebhookMessage {
2727
+ /**
2728
+ * The WhatsApp Business Account ID
2729
+ */
2730
+ wabaId: string;
2731
+ /**
2732
+ * The message ID
2733
+ */
2734
+ id: string;
2735
+ /**
2736
+ * The sender's phone number
2737
+ */
2738
+ from: string;
2739
+ /**
2740
+ * The timestamp of the message
2741
+ */
2742
+ timestamp: string;
2743
+ /**
2744
+ * The type of message (text, image, etc.)
2745
+ */
2746
+ type: MessageTypesEnum;
2747
+ /**
2748
+ * The phone number ID that received the message
2749
+ */
2750
+ phoneNumberId: string;
2751
+ /**
2752
+ * The display phone number that received the message
2753
+ */
2754
+ displayPhoneNumber: string;
2755
+ /**
2756
+ * The profile name of the sender
2757
+ */
2758
+ profileName: string;
2759
+ text?: TextMessage['text'];
2760
+ image?: ImageMessage['image'];
2761
+ video?: VideoMessage['video'];
2762
+ audio?: AudioMessage['audio'];
2763
+ document?: DocumentMessage['document'];
2764
+ sticker?: StickerMessage['sticker'];
2765
+ location?: LocationMessage['location'];
2766
+ contacts?: ContactsMessage['contacts'];
2767
+ interactive?: InteractiveMessage['interactive'];
2768
+ button?: ButtonMessage['button'];
2769
+ order?: OrderMessage['order'];
2770
+ system?: SystemMessage['system'];
2771
+ reaction?: ReactionMessage['reaction'];
2772
+ statuses?: {
2773
+ /**
2774
+ * Arbitrary string included in sent message
2775
+ */
2776
+ biz_opaque_callback_data?: string;
2777
+ /**
2778
+ * Information about the conversation
2779
+ */
2780
+ conversation?: {
2781
+ /**
2782
+ * Represents the ID of the conversation the given status notification belongs to
2783
+ */
2784
+ id: string;
2785
+ /**
2786
+ * Describes conversation category
2787
+ */
2788
+ origin: {
2789
+ /**
2790
+ * Indicates conversation category. This can also be referred to as a conversation entry point
2791
+ * - authentication: Conversation opened by business sending template categorized as AUTHENTICATION
2792
+ * - marketing: Conversation opened by business sending template categorized as MARKETING
2793
+ * - utility: Conversation opened by business sending template categorized as UTILITY
2794
+ * - service: Conversation opened by business replying to customer within service window
2795
+ * - referral_conversion: Free entry point conversation
2796
+ */
2797
+ type: 'authentication' | 'marketing' | 'utility' | 'service' | 'referral_conversion';
2798
+ };
2799
+ /**
2800
+ * Date when the conversation expires. Only present for messages with status 'sent'
2801
+ */
2802
+ expiration_timestamp?: string;
2803
+ };
2804
+ /**
2805
+ * Array of error objects describing the error
2806
+ */
2807
+ errors?: Array<{
2808
+ /**
2809
+ * Error code
2810
+ */
2811
+ code: number;
2812
+ /**
2813
+ * Error code title
2814
+ */
2815
+ title: string;
2816
+ /**
2817
+ * Error code message
2818
+ */
2819
+ message: string;
2820
+ /**
2821
+ * Error details object
2822
+ */
2823
+ error_data?: {
2824
+ /**
2825
+ * Describes the error details
2826
+ */
2827
+ details: string;
2828
+ };
2829
+ }>;
2830
+ /**
2831
+ * The ID for the message that the business sent to a customer
2832
+ */
2833
+ id: string;
2834
+ /**
2835
+ * Pricing information for the message/conversation
2836
+ */
2837
+ pricing?: {
2838
+ /**
2839
+ * Indicates if the given message or conversation is billable
2840
+ * @deprecated This field is deprecated. Visit the WhatsApp Changelog for more information.
2841
+ */
2842
+ billable?: boolean;
2843
+ /**
2844
+ * Indicates the conversation category:
2845
+ * - authentication: Authentication conversation
2846
+ * - authentication_international: Authentication-international conversation
2847
+ * - marketing: Marketing conversation
2848
+ * - utility: Utility conversation
2849
+ * - service: Service conversation
2850
+ * - referral_conversion: Free entry point conversation
2851
+ */
2852
+ category: 'authentication' | 'authentication_international' | 'marketing' | 'utility' | 'service' | 'referral_conversion';
2853
+ /**
2854
+ * Type of pricing model used by the business. Current supported value is CBP
2855
+ */
2856
+ pricing_model: 'CBP';
2857
+ };
2858
+ /**
2859
+ * The customer's WhatsApp ID. Business can respond to customer using this ID.
2860
+ * This ID may not match the customer's phone number.
2861
+ */
2862
+ recipient_id: string;
2863
+ /**
2864
+ * Status of the message:
2865
+ * - delivered: Message has been delivered
2866
+ * - read: Message has been read by the customer
2867
+ * - sent: Message has been sent to the customer
2868
+ */
2869
+ status: 'delivered' | 'read' | 'sent';
2870
+ /**
2871
+ * Unix timestamp for the status message
2872
+ */
2873
+ timestamp: string;
2874
+ };
2875
+ /**
2876
+ * The original message data as received from the webhook
2877
+ */
2878
+ originalData: any;
2879
+ }
2880
+ /**
2881
+ * Webhook event received from WhatsApp
2882
+ */
2883
+ interface WebhookEvent {
2884
+ /**
2885
+ * The field type of the event
2886
+ */
2887
+ field: string;
2888
+ /**
2889
+ * The event data
2890
+ */
2891
+ value: any;
2892
+ /**
2893
+ * The timestamp when the event was received
2894
+ */
2895
+ timestamp: number;
2896
+ }
2897
+ /**
2898
+ * Message status enum
2899
+ */
2900
+ declare enum MessageStatus {
2901
+ DELIVERED = "delivered",
2902
+ READ = "read",
2903
+ SENT = "sent",
2904
+ }
2905
+ //#endregion
2906
+ //#region src/api/qrCode/types/common.d.ts
2907
+ type QrCodeResponse = {
2908
+ code: string;
2909
+ prefilled_message: string;
2910
+ deep_link_url: string;
2911
+ qr_image_url?: string;
2912
+ };
2913
+ type QrCodesResponse = ResponseData<QrCodeResponse[]>;
2914
+ type CreateQrCodeRequest = {
2915
+ prefilled_message: string;
2916
+ generate_qr_image?: 'SVG' | 'PNG';
2917
+ };
2918
+ type UpdateQrCodeRequest = {
2919
+ code: string;
2920
+ prefilled_message: string;
2921
+ };
2922
+ interface QrCodeClass {
2923
+ createQrCode(request: CreateQrCodeRequest): Promise<QrCodeResponse>;
2924
+ getQrCodes(): Promise<QrCodesResponse>;
2925
+ getQrCode(qrCodeId: string): Promise<QrCodeResponse>;
2926
+ updateQrCode(request: UpdateQrCodeRequest): Promise<QrCodeResponse>;
2927
+ deleteQrCode(qrCodeId: string): Promise<ResponseSuccess>;
2928
+ }
2929
+ //#endregion
2930
+ //#region src/api/waba/types/common.d.ts
2931
+ /**
2932
+ * WhatsApp Business Account subscription configuration
2933
+ */
2934
+ type WabaSubscription = {
2935
+ whatsapp_business_api_data: {
2936
+ id: string;
2937
+ link: string;
2938
+ name: string;
2939
+ category: string;
2940
+ };
2941
+ override_callback_uri?: string;
2942
+ };
2943
+ /**
2944
+ * Parameters for updating WABA subscription
2945
+ */
2946
+ interface UpdateWabaSubscription {
2947
+ override_callback_uri: string;
2948
+ verify_token: string;
2949
+ }
2950
+ /**
2951
+ * Response containing all WABA subscriptions
2952
+ */
2953
+ interface WabaSubscriptions {
2954
+ data: Array<WabaSubscription>;
2955
+ }
2956
+ /**
2957
+ * WABA account review status enumeration
2958
+ */
2959
+ declare enum WabaAccountReviewStatus {
2960
+ Approved = "APPROVED",
2961
+ Active = "ACTIVE",
2962
+ Inactive = "INACTIVE",
2963
+ Disabled = "DISABLED",
2964
+ }
2965
+ /**
2966
+ * WABA health status for message sending capability
2967
+ */
2968
+ declare enum WabaHealthStatusCanSendMessage {
2969
+ Blocked = "BLOCKED",
2970
+ Limited = "LIMITED",
2971
+ Available = "AVAILABLE",
2972
+ }
2973
+ /**
2974
+ * WABA account status enumeration
2975
+ */
2976
+ declare enum WabaAccountStatus {
2977
+ Approved = "APPROVED",
2978
+ Active = "ACTIVE",
2979
+ Inactive = "INACTIVE",
2980
+ Disabled = "DISABLED",
2981
+ }
2982
+ /**
2983
+ * Business verification status enumeration
2984
+ */
2985
+ declare enum WabaBusinessVerificationStatus {
2986
+ Verified = "verified",
2987
+ PendingSubmission = "pending_submission",
2988
+ Unverified = "unverified",
2989
+ Rejected = "rejected",
2990
+ }
2991
+ /**
2992
+ * WABA health status error details
2993
+ */
2994
+ interface WabaHealthStatusError {
2995
+ error_code?: number;
2996
+ error_description?: string;
2997
+ possible_solution?: string;
2998
+ }
2999
+ /**
3000
+ * WABA health status entity information
3001
+ */
3002
+ interface WabaHealthStatusEntity {
3003
+ entity_type?: string;
3004
+ id?: string;
3005
+ can_send_message?: string;
3006
+ errors?: WabaHealthStatusError[];
3007
+ }
3008
+ /**
3009
+ * Overall WABA health status
3010
+ */
3011
+ interface WabaHealthStatus {
3012
+ can_send_message?: WabaHealthStatusCanSendMessage;
3013
+ entities?: WabaHealthStatusEntity[];
3014
+ }
3015
+ /**
3016
+ * WhatsApp Business Account information
3017
+ */
3018
+ interface WabaAccount {
3019
+ account_review_status?: WabaAccountReviewStatus;
3020
+ id?: string;
3021
+ health_status?: WabaHealthStatus;
3022
+ status?: WabaAccountStatus;
3023
+ business_verification_status?: WabaBusinessVerificationStatus;
3024
+ message_template_namespace?: string;
3025
+ name?: string;
3026
+ ownership_type?: string;
3027
+ currency?: string;
3028
+ }
3029
+ /**
3030
+ * Available fields for WABA account queries
3031
+ */
3032
+ type WabaAccountFields = 'id' | 'name' | 'account_review_status' | 'auth_international_rate_eligibility' | 'business_verification_status' | 'country' | 'currency' | 'health_status' | 'status' | 'ownership_type' | 'message_template_namespace';
3033
+ /**
3034
+ * Parameter type for specifying which WABA account fields to retrieve
3035
+ */
3036
+ type WabaAccountFieldsParam = WabaAccountFields[];
3037
+ /**
3038
+ * Interface defining all WABA API methods
3039
+ */
3040
+ interface WABAClass {
3041
+ getWabaAccount(fields?: WabaAccountFieldsParam): Promise<WabaAccount>;
3042
+ getAllWabaSubscriptions(): Promise<WabaSubscriptions>;
3043
+ updateWabaSubscription(params: UpdateWabaSubscription): Promise<ResponseSuccess>;
3044
+ unsubscribeFromWaba(): Promise<ResponseSuccess>;
3045
+ }
3046
+ //#endregion
3047
+ //#region src/api/registration/types/common.d.ts
3048
+ type RegistrationRequest = {
3049
+ messaging_product: 'whatsapp';
3050
+ pin: string;
3051
+ data_localization_region?: DataLocalizationRegionEnum;
3052
+ };
3053
+ interface RegistrationClass {
3054
+ register(pin: string, dataLocalizationRegion?: DataLocalizationRegionEnum): Promise<ResponseSuccess>;
3055
+ deregister(): Promise<ResponseSuccess>;
3056
+ }
3057
+ //#endregion
3058
+ //#region src/api/twoStepVerification/types/common.d.ts
3059
+ type TwoStepVerificationRequest = {
3060
+ pin: string;
3061
+ };
3062
+ interface TwoStepVerificationClass {
3063
+ setTwoStepVerificationCode(pin: string): Promise<ResponseSuccess>;
3064
+ }
3065
+ //#endregion
3066
+ //#region src/api/encryption/types/publicKey.d.ts
3067
+ type EncryptionPublicKeyResponse = ResponseData<{
3068
+ business_public_key: string;
3069
+ business_public_key_signature_status: 'VALID' | 'MISMATCH';
3070
+ }>;
3071
+ //#endregion
3072
+ //#region src/api/encryption/types/common.d.ts
3073
+ interface EncryptionClass {
3074
+ getEncryptionPublicKey(): Promise<EncryptionPublicKeyResponse>;
3075
+ setEncryptionPublicKey(businessPublicKey: string): Promise<ResponseSuccess>;
3076
+ }
3077
+ //#endregion
3078
+ //#region src/utils/http/httpsClient.d.ts
3079
+ declare class HttpsClient implements HttpsClientClass {
3080
+ agent: Agent;
3081
+ constructor();
3082
+ clearSockets(): boolean;
3083
+ sendRequest(hostname: string, path: string, method: HttpMethodsEnum, headers: HeadersInit, timeout: number, body?: BodyInit | null): Promise<HttpsClientResponseClass>;
3084
+ }
3085
+ //#endregion
3086
+ //#region src/utils/http/request.d.ts
3087
+ declare class Requester implements RequesterClass {
3088
+ client: Readonly<HttpsClient>;
3089
+ accessToken: Readonly<string>;
3090
+ phoneNumberId: Readonly<number>;
3091
+ businessAcctId: Readonly<string>;
3092
+ apiVersion: Readonly<string>;
3093
+ userAgent: Readonly<string>;
3094
+ host: Readonly<string>;
3095
+ protocol: Readonly<string>;
3096
+ constructor(apiVersion: string, phoneNumberId: number, accessToken: string, businessAcctId: string, userAgent: string);
3097
+ buildHeader(contentType: string, additionalHeaders?: Record<string, string>): HeadersInit;
3098
+ buildCAPIPath(endpoint: string): string;
3099
+ sendRequest(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any, contentType?: string, additionalHeaders?: Record<string, string>): Promise<HttpsClientResponseClass>;
3100
+ getJson<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any, additionalHeaders?: Record<string, string>): Promise<T>;
3101
+ sendFormData<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: FormData, additionalHeaders?: Record<string, string>): Promise<T>;
3102
+ sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: Record<string, string>, additionalHeaders?: Record<string, string>): Promise<T>;
3103
+ }
3104
+ //#endregion
3105
+ //#region src/api/encryption/EncryptionApi.d.ts
3106
+ declare class EncryptionApi extends BaseAPI implements EncryptionClass {
3107
+ private readonly endpoint;
3108
+ constructor(config: WabaConfigType, client: RequesterClass);
3109
+ getEncryptionPublicKey(): Promise<EncryptionPublicKeyResponse>;
3110
+ setEncryptionPublicKey(businessPublicKey: string): Promise<ResponseSuccess>;
3111
+ }
3112
+ //#endregion
3113
+ //#region src/api/flow/FlowApi.d.ts
3114
+ /**
3115
+ * API for managing WhatsApp Flows.
3116
+ *
3117
+ * This API allows you to:
3118
+ * - List flows
3119
+ * - Create flows
3120
+ * - Get flow details and previews
3121
+ * - Update flow metadata and JSON
3122
+ * - Delete flows
3123
+ * - Publish and deprecate flows
3124
+ * - Migrate flows between WABAs
3125
+ * - Validate flow JSON
3126
+ */
3127
+ declare class FlowApi extends BaseAPI implements FlowClass {
3128
+ constructor(config: WabaConfigType, client: RequesterClass);
3129
+ /**
3130
+ * List Flows
3131
+ *
3132
+ * @param wabaId - The WABA ID
3133
+ * @returns Promise with the list of flows
3134
+ */
3135
+ listFlows(wabaId: string): Promise<FlowsListResponse>;
3136
+ /**
3137
+ * Create Flow
3138
+ *
3139
+ * @param wabaId - The WABA ID
3140
+ * @param data - The flow data including name, categories, endpoint_uri, and optional clone_flow_id
3141
+ * @returns Promise with the created flow ID and validation errors if any
3142
+ */
3143
+ createFlow(wabaId: string, data: {
3144
+ name: string;
3145
+ categories?: FlowCategoryEnum[];
3146
+ endpoint_uri?: string;
3147
+ clone_flow_id?: string;
3148
+ flow_json?: string;
3149
+ publish?: boolean;
3150
+ }): Promise<CreateFlowResponse>;
3151
+ /**
3152
+ * Get Flow details
3153
+ *
3154
+ * @param flowId - The flow ID
3155
+ * @param fields - Optional fields to return (e.g., 'name,status,preview.invalidate(false)')
3156
+ * @param dateFormat - Optional date format
3157
+ * @returns Promise with the flow details or preview response
3158
+ */
3159
+ getFlow(flowId: string, fields?: string, dateFormat?: string): Promise<Flow | FlowPreviewResponse>;
3160
+ /**
3161
+ * Get Flow Preview URL
3162
+ *
3163
+ * @param flowId - The flow ID
3164
+ * @param invalidate - Optional. If true, invalidates existing preview and generates a new one. Defaults to false.
3165
+ * @returns Promise with the flow preview details
3166
+ */
3167
+ getFlowPreview(flowId: string, invalidate?: boolean): Promise<FlowPreviewResponse>;
3168
+ /**
3169
+ * Update Flow Metadata
3170
+ *
3171
+ * @param flowId - The flow ID
3172
+ * @param data - The flow metadata to update (name, categories, endpoint_uri, application_id)
3173
+ * @returns Promise with the success status
3174
+ */
3175
+ updateFlowMetadata(flowId: string, data: {
3176
+ name?: string;
3177
+ categories?: FlowCategoryEnum[];
3178
+ endpoint_uri?: string;
3179
+ application_id?: string;
3180
+ }): Promise<ResponseSuccess>;
3181
+ /**
3182
+ * Delete Flow (only works if the Flow is in DRAFT status)
3183
+ *
3184
+ * @param flowId - The flow ID
3185
+ * @returns Promise with the success status
3186
+ */
3187
+ deleteFlow(flowId: string): Promise<ResponseSuccess>;
3188
+ /**
3189
+ * List Assets (e.g., get Flow JSON download URL)
3190
+ *
3191
+ * @param flowId - The flow ID
3192
+ * @returns Promise with the list of assets
3193
+ */
3194
+ listAssets(flowId: string): Promise<FlowAssetsResponse>;
3195
+ /**
3196
+ * Update Flow JSON by uploading a file, buffer, JSON object, or Blob.
3197
+ *
3198
+ * @param flowId - The flow ID
3199
+ * @param data - Object containing the file data and optional name.
3200
+ * @param data.file - The Flow JSON content as a Buffer, JSON object, or Blob.
3201
+ * @param data.name - Optional name for the asset, defaults to 'flow.json'.
3202
+ * @returns Promise with the success status and validation errors, if any.
3203
+ */
3204
+ updateFlowJson(flowId: string, data: {
3205
+ file: Blob | Buffer | object;
3206
+ name?: string;
3207
+ }): Promise<UpdateFlowResponse>;
3208
+ /**
3209
+ * Validate Flow JSON by attempting an update without publishing.
3210
+ * This is a convenience method; the API doesn't have a dedicated validation endpoint.
3211
+ *
3212
+ * @param flowId - The ID of the Flow (must exist, can be in DRAFT status).
3213
+ * @param flowJsonData - The Flow JSON content as a file path (string), Buffer, JSON object, or Blob.
3214
+ * @returns Promise indicating if the JSON is valid and includes validation errors if any.
3215
+ */
3216
+ validateFlowJson(flowId: string, flowJsonData: Blob | Buffer | object): Promise<ValidateFlowJsonResponse>;
3217
+ /**
3218
+ * Publish Flow
3219
+ *
3220
+ * @param flowId - The flow ID
3221
+ * @returns Promise with the success status
3222
+ */
3223
+ publishFlow(flowId: string): Promise<ResponseSuccess>;
3224
+ /**
3225
+ * Deprecate Flow
3226
+ *
3227
+ * @param flowId - The flow ID
3228
+ * @returns Promise with the success status
165
3229
  */
166
3230
  deprecateFlow(flowId: string): Promise<ResponseSuccess>;
167
3231
  /**
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)
3232
+ * Migrate Flows between WABAs
3233
+ *
3234
+ * @param destinationWabaId - The destination WABA ID
3235
+ * @param data - The migration data including source_waba_id and optional source_flow_names
3236
+ * @returns Promise with migration results (successes and failures)
3237
+ */
3238
+ migrateFlows(destinationWabaId: string, data: {
3239
+ source_waba_id: string;
3240
+ source_flow_names?: string[];
3241
+ }): Promise<FlowMigrationResponse>;
3242
+ }
3243
+ //#endregion
3244
+ //#region src/api/media/MediaApi.d.ts
3245
+ /**
3246
+ * API for managing WhatsApp Media.
3247
+ *
3248
+ * This API allows you to:
3249
+ * - Get media information by ID
3250
+ * - Upload media files
3251
+ * - Delete media files
3252
+ * - Download media files from URLs
3253
+ */
3254
+ declare class MediaApi extends BaseAPI implements MediaClass {
3255
+ private readonly endpoint;
3256
+ constructor(config: WabaConfigType, client: RequesterClass);
3257
+ /**
3258
+ * Retrieve media information by media ID.
3259
+ *
3260
+ * @param mediaId The media ID to retrieve information for
3261
+ * @param phone_number_id Optional phone number ID (defaults to configured one)
3262
+ * @returns Media information including URL, mime type, file size, etc.
3263
+ *
3264
+ * @example
3265
+ * const mediaInfo = await whatsappClient.media.getMediaById('media_id_123');
3266
+ */
3267
+ getMediaById(mediaId: string, phone_number_id?: string): Promise<MediaResponse>;
3268
+ /**
3269
+ * Upload a media file to WhatsApp.
3270
+ *
3271
+ * @param file The file to upload
3272
+ * @param messagingProduct The messaging product (default: 'whatsapp')
3273
+ * @returns Upload response containing the media ID
3274
+ *
3275
+ * @example
3276
+ * const file = new File([buffer], 'image.jpg', { type: 'image/jpeg' });
3277
+ * const result = await whatsappClient.media.uploadMedia(file);
3278
+ */
3279
+ uploadMedia(file: File, messagingProduct?: string): Promise<UploadMediaResponse>;
3280
+ /**
3281
+ * Delete a media file.
3282
+ *
3283
+ * @param mediaId The media ID to delete
3284
+ * @param phone_number_id Optional phone number ID (defaults to configured one)
3285
+ * @returns Response indicating success or failure
3286
+ *
3287
+ * @example
3288
+ * await whatsappClient.media.deleteMedia('media_id_123');
3289
+ */
3290
+ deleteMedia(mediaId: string, phone_number_id?: string): Promise<ResponseSuccess>;
3291
+ /**
3292
+ * Download media from a URL.
3293
+ *
3294
+ * @param mediaUrl The URL to download media from
3295
+ * @returns Blob containing the media data
3296
+ *
3297
+ * @example
3298
+ * const blob = await whatsappClient.media.downloadMedia('https://...');
3299
+ */
3300
+ downloadMedia(mediaUrl: string): Promise<Blob>;
3301
+ }
3302
+ //#endregion
3303
+ //#region src/api/messages/MessageApi.d.ts
3304
+ /**
3305
+ * Maps each message type to its appropriate payload type
3306
+ */
3307
+ 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 ? {
3308
+ message_id: string;
3309
+ emoji: string;
3310
+ } : never;
3311
+ declare class MessagesApi extends BaseAPI implements MessagesClass {
3312
+ private readonly commonMethod;
3313
+ private readonly commonEndpoint;
3314
+ constructor(config: WabaConfigType, client: RequesterClass);
3315
+ /**
3316
+ * Builds the request body for WhatsApp API messages
3317
+ * @param type The type of message to send
3318
+ * @param payload The message payload object
3319
+ * @param to The recipient's phone number
3320
+ * @param replyMessageId Optional message ID to reply to
3321
+ * @returns The formatted request body
3322
+ */
3323
+ bodyBuilder<T extends MessageTypesEnum>(type: T, payload: MessagePayloadType<T>, to: string, replyMessageId?: string): MessageRequestBody<T>;
3324
+ /**
3325
+ * Sends a request to the WhatsApp API
3326
+ * @param body The request body to send
3327
+ * @returns Promise with the API response
3328
+ */
3329
+ private send;
3330
+ /**
3331
+ * Sends an audio message via WhatsApp
3332
+ * @param params The audio message parameter object
3333
+ * @returns Promise with the message response
3334
+ */
3335
+ audio(params: MessageRequestParams<AudioMediaObject>): Promise<MessagesResponse>;
3336
+ /**
3337
+ * Sends a contact card via WhatsApp
3338
+ * @param params The contact message parameter object
3339
+ * @returns Promise with the message response
3340
+ */
3341
+ contacts(params: MessageRequestParams<[ContactObject]>): Promise<MessagesResponse>;
3342
+ /**
3343
+ * Sends a document via WhatsApp
3344
+ * @param params The document message parameter object
3345
+ * @returns Promise with the message response
3346
+ */
3347
+ document(params: MessageRequestParams<DocumentMediaObject>): Promise<MessagesResponse>;
3348
+ /**
3349
+ * Sends an image via WhatsApp
3350
+ * @param params The image message parameter object
3351
+ * @returns Promise with the message response
3352
+ */
3353
+ image(params: MessageRequestParams<ImageMediaObject>): Promise<MessagesResponse>;
3354
+ /**
3355
+ * Sends an interactive message via WhatsApp
3356
+ * @param params The interactive message parameter object
3357
+ * @returns Promise with the message response
3358
+ */
3359
+ interactive(params: MessageRequestParams<InteractiveObject>): Promise<MessagesResponse>;
3360
+ /**
3361
+ * Sends a location via WhatsApp
3362
+ * @param params The location message parameter object
3363
+ * @returns Promise with the message response
3364
+ */
3365
+ location(params: MessageRequestParams<LocationObject>): Promise<MessagesResponse>;
3366
+ /**
3367
+ * Sends a sticker via WhatsApp
3368
+ * @param params The sticker message parameter object
3369
+ * @returns Promise with the message response
3370
+ */
3371
+ sticker(params: MessageRequestParams<StickerMediaObject>): Promise<MessagesResponse>;
3372
+ /**
3373
+ * Sends a template message via WhatsApp
3374
+ * @param params The template message parameter object
3375
+ * @returns Promise with the message response
3376
+ */
3377
+ template(params: MessageRequestParams<MessageTemplateObject<ComponentTypesEnum>>): Promise<MessagesResponse>;
3378
+ /**
3379
+ * Sends a text message via WhatsApp
3380
+ * @param params The text message parameter object
3381
+ * @returns Promise with the message response
3382
+ */
3383
+ text(params: TextMessageParams): Promise<MessagesResponse>;
3384
+ /**
3385
+ * Sends a video message via WhatsApp
3386
+ * @param params The video message parameter object
3387
+ * @returns Promise with the message response
3388
+ */
3389
+ video(params: MessageRequestParams<VideoMediaObject>): Promise<MessagesResponse>;
3390
+ /**
3391
+ * Updates message status (mark as read, etc.)
3392
+ * @param params The status update parameters
3393
+ * @returns Promise with the API response
3394
+ */
3395
+ status(params: StatusParams): Promise<MessagesResponse>;
3396
+ /**
3397
+ * Marks a message as read
3398
+ * @param params Object containing messageId
3399
+ * @returns Promise with the API response
3400
+ */
3401
+ markAsRead(params: {
3402
+ messageId: string;
3403
+ }): Promise<MessagesResponse>;
3404
+ /**
3405
+ * Shows typing indicator
3406
+ * @param params Object containing messageId
3407
+ * @returns Promise with the API response
3408
+ */
3409
+ showTypingIndicator(params: {
3410
+ messageId: string;
3411
+ }): Promise<MessagesResponse>;
3412
+ /**
3413
+ * Sends a list interactive message
3414
+ * @param params The list interactive message parameters
3415
+ * @returns Promise with the message response
3416
+ */
3417
+ interactiveList(params: MessageRequestParams<InteractiveObject & {
3418
+ type: InteractiveTypesEnum.List;
3419
+ }>): Promise<MessagesResponse>;
3420
+ /**
3421
+ * Sends a CTA URL interactive message
3422
+ * @param params The CTA URL interactive message parameters
3423
+ * @returns Promise with the message response
3424
+ */
3425
+ interactiveCtaUrl(params: MessageRequestParams<InteractiveObject & {
3426
+ type: InteractiveTypesEnum.CtaUrl;
3427
+ }>): Promise<MessagesResponse>;
3428
+ /**
3429
+ * Sends a location request interactive message
3430
+ * @param params The location request interactive message parameters
3431
+ * @returns Promise with the message response
3432
+ */
3433
+ interactiveLocationRequest(params: MessageRequestParams<InteractiveObject & {
3434
+ type: InteractiveTypesEnum.LocationRequest;
3435
+ }>): Promise<MessagesResponse>;
3436
+ /**
3437
+ * Sends an address message interactive message
3438
+ * @param params The address message interactive message parameters
3439
+ * @returns Promise with the message response
3440
+ */
3441
+ interactiveAddressMessage(params: MessageRequestParams<InteractiveObject & {
3442
+ type: InteractiveTypesEnum.AddressMessage;
3443
+ }>): Promise<MessagesResponse>;
3444
+ /**
3445
+ * Sends a reply buttons interactive message
3446
+ * @param params The reply buttons interactive message parameters
3447
+ * @returns Promise with the message response
3448
+ */
3449
+ interactiveReplyButtons(params: MessageRequestParams<InteractiveObject & {
3450
+ type: InteractiveTypesEnum.Button;
3451
+ }>): Promise<MessagesResponse>;
3452
+ /**
3453
+ * Sends a flow interactive message
3454
+ * @param params The flow interactive message parameters
3455
+ * @returns Promise with the message response
3456
+ */
3457
+ interactiveFlow(params: MessageRequestParams<InteractiveObject & {
3458
+ type: InteractiveTypesEnum.Flow;
3459
+ }>): Promise<MessagesResponse>;
3460
+ /**
3461
+ * Sends a reaction to a message
3462
+ * @param params The reaction parameters
3463
+ * @returns Promise with the message response
3464
+ */
3465
+ reaction(params: ReactionParams): Promise<MessagesResponse>;
3466
+ }
3467
+ //#endregion
3468
+ //#region src/api/messages/builders/ContactMessageBuilder.d.ts
3469
+ /**
3470
+ * Builder class for creating contact messages with a fluent API
3471
+ */
3472
+ declare class ContactMessageBuilder {
3473
+ private contact;
3474
+ /**
3475
+ * Set the contact name (required)
3476
+ */
3477
+ setName(name: NameObject): this;
3478
+ /**
3479
+ * Set simple name with first name only
3480
+ */
3481
+ setSimpleName(firstName: string, lastName?: string): this;
3482
+ /**
3483
+ * Set full name details
3484
+ */
3485
+ setFullName(firstName: string, lastName?: string, middleName?: string, suffix?: string, prefix?: string): this;
3486
+ /**
3487
+ * Add phone numbers
3488
+ */
3489
+ addPhone(phone: string, type?: string, waId?: string): this;
3490
+ /**
3491
+ * Add email addresses
3492
+ */
3493
+ addEmail(email: string, type?: string): this;
3494
+ /**
3495
+ * Add address
3496
+ */
3497
+ addAddress(address: AddressesObject): this;
3498
+ /**
3499
+ * Add simple address
3500
+ */
3501
+ addSimpleAddress(street: string, city: string, country: string, type?: string): this;
3502
+ /**
3503
+ * Set organization details
3504
+ */
3505
+ setOrganization(company: string, department?: string, title?: string): this;
3506
+ /**
3507
+ * Add URL
3508
+ */
3509
+ addUrl(url: string, type?: string): this;
3510
+ /**
3511
+ * Set birthday (format: YYYY-MM-DD)
3512
+ */
3513
+ setBirthday(year: number, month: number, day: number): this;
3514
+ /**
3515
+ * Build the final contact object
3516
+ */
3517
+ build(): ContactObject;
3518
+ /**
3519
+ * Reset the builder for reuse
3520
+ */
3521
+ reset(): this;
3522
+ }
3523
+ /**
3524
+ * Factory class for common contact patterns
3525
+ */
3526
+ declare class ContactMessageFactory {
3527
+ /**
3528
+ * Create a simple contact with name and phone
3529
+ */
3530
+ static createSimpleContact(firstName: string, phone: string): ContactObject;
3531
+ /**
3532
+ * Create a business contact
3533
+ */
3534
+ static createBusinessContact(firstName: string, lastName: string, company: string, title: string, phone: string, email: string): ContactObject;
3535
+ /**
3536
+ * Create a personal contact with full details
3537
+ */
3538
+ static createPersonalContact(firstName: string, lastName: string, mobilePhone: string, email?: string, birthday?: {
3539
+ year: number;
3540
+ month: number;
3541
+ day: number;
3542
+ }): ContactObject;
3543
+ }
3544
+ //#endregion
3545
+ //#region src/api/messages/builders/InteractiveMessageBuilder.d.ts
3546
+ /**
3547
+ * Builder class for creating interactive messages with a fluent API
3548
+ */
3549
+ declare class InteractiveMessageBuilder {
3550
+ private message;
3551
+ /**
3552
+ * Set the interactive message type
3553
+ */
3554
+ setType(type: InteractiveTypesEnum): this;
3555
+ /**
3556
+ * Set the body text of the message
3557
+ */
3558
+ setBody(text: string): this;
3559
+ /**
3560
+ * Set the footer text of the message
3561
+ */
3562
+ setFooter(text: string): this;
3563
+ /**
3564
+ * Set a text header
3565
+ */
3566
+ setTextHeader(text: string): this;
3567
+ /**
3568
+ * Set an image header
3569
+ */
3570
+ setImageHeader(imageUrl: string): this;
3571
+ /**
3572
+ * Add reply buttons (for button type messages)
3573
+ */
3574
+ addReplyButtons(buttons: Array<{
3575
+ id: string;
3576
+ title: string;
3577
+ }>): this;
3578
+ /**
3579
+ * Add list sections (for list type messages)
3580
+ * Note: This creates a single section with multiple rows
3581
+ */
3582
+ addListSections(sections: Array<{
3583
+ title?: string;
3584
+ rows: Array<{
3585
+ id: string;
3586
+ title: string;
3587
+ description?: string;
3588
+ }>;
3589
+ }>): this;
3590
+ /**
3591
+ * Set the button text for list messages
3592
+ */
3593
+ setListButtonText(buttonText: string): this;
3594
+ /**
3595
+ * Set CTA URL action
3596
+ */
3597
+ setCTAUrl(displayText: string, url: string): this;
3598
+ /**
3599
+ * Build the final interactive object
3600
+ */
3601
+ build(): InteractiveObject;
3602
+ /**
3603
+ * Reset the builder for reuse
3604
+ */
3605
+ reset(): this;
3606
+ }
3607
+ /**
3608
+ * Convenience factory functions for common interactive message types
3609
+ */
3610
+ declare class InteractiveMessageFactory {
3611
+ /**
3612
+ * Create a button message with reply buttons
3613
+ */
3614
+ static createButtonMessage(bodyText: string, buttons: Array<{
3615
+ id: string;
3616
+ title: string;
3617
+ }>, options?: {
3618
+ headerText?: string;
3619
+ footerText?: string;
3620
+ }): InteractiveObject;
3621
+ /**
3622
+ * Create a list message with sections
3623
+ */
3624
+ static createListMessage(bodyText: string, buttonText: string, sections: Array<{
3625
+ title?: string;
3626
+ rows: Array<{
3627
+ id: string;
3628
+ title: string;
3629
+ description?: string;
3630
+ }>;
3631
+ }>, options?: {
3632
+ headerText?: string;
3633
+ footerText?: string;
3634
+ }): InteractiveObject;
3635
+ /**
3636
+ * Create a CTA URL message
3637
+ */
3638
+ static createCTAUrlMessage(bodyText: string, displayText: string, url: string, options?: {
3639
+ headerText?: string;
3640
+ footerText?: string;
3641
+ }): InteractiveObject;
3642
+ }
3643
+ //#endregion
3644
+ //#region src/api/messages/builders/LocationMessageBuilder.d.ts
3645
+ /**
3646
+ * Builder class for creating location messages with a fluent API
3647
+ */
3648
+ declare class LocationMessageBuilder {
3649
+ private location;
3650
+ /**
3651
+ * Set the latitude coordinate
3652
+ */
3653
+ setLatitude(latitude: number): this;
3654
+ /**
3655
+ * Set the longitude coordinate
3656
+ */
3657
+ setLongitude(longitude: number): this;
3658
+ /**
3659
+ * Set coordinates using latitude and longitude
3660
+ */
3661
+ setCoordinates(latitude: number, longitude: number): this;
3662
+ /**
3663
+ * Set the location name
3664
+ */
3665
+ setName(name: string): this;
3666
+ /**
3667
+ * Set the location address
3668
+ */
3669
+ setAddress(address: string): this;
3670
+ /**
3671
+ * Build the final location object
3672
+ */
3673
+ build(): LocationObject;
3674
+ /**
3675
+ * Reset the builder for reuse
3676
+ */
3677
+ reset(): this;
3678
+ }
3679
+ /**
3680
+ * Factory class for common location patterns
3681
+ */
3682
+ declare class LocationMessageFactory {
3683
+ /**
3684
+ * Create a simple location with just coordinates
3685
+ */
3686
+ static createSimpleLocation(latitude: number, longitude: number): LocationObject;
3687
+ /**
3688
+ * Create a location with name and address
3689
+ */
3690
+ static createNamedLocation(latitude: number, longitude: number, name: string, address: string): LocationObject;
3691
+ /**
3692
+ * Create a business location
3693
+ */
3694
+ static createBusinessLocation(latitude: number, longitude: number, businessName: string, fullAddress: string): LocationObject;
3695
+ }
3696
+ //#endregion
3697
+ //#region src/api/messages/builders/MediaMessageBuilder.d.ts
3698
+ /**
3699
+ * Base builder for media messages
3700
+ */
3701
+ declare abstract class BaseMediaBuilder<T> {
3702
+ protected media: Partial<T>;
3703
+ /**
3704
+ * Set media ID (for uploaded media)
3705
+ */
3706
+ setId(id: string): this;
3707
+ /**
3708
+ * Set media URL
3709
+ */
3710
+ setLink(url: string): this;
3711
+ /**
3712
+ * Set media caption
3713
+ */
3714
+ setCaption(caption: string): this;
3715
+ /**
3716
+ * Build the media object
3717
+ */
3718
+ build(): T;
3719
+ /**
3720
+ * Reset the builder
3721
+ */
3722
+ reset(): this;
3723
+ }
3724
+ /**
3725
+ * Builder for image messages
3726
+ */
3727
+ declare class ImageMessageBuilder extends BaseMediaBuilder<ImageMediaObject> {}
3728
+ /**
3729
+ * Builder for video messages
3730
+ */
3731
+ declare class VideoMessageBuilder extends BaseMediaBuilder<VideoMediaObject> {}
3732
+ /**
3733
+ * Builder for audio messages
3734
+ */
3735
+ declare class AudioMessageBuilder extends BaseMediaBuilder<AudioMediaObject> {
3736
+ setCaption(caption: string): this;
3737
+ }
3738
+ /**
3739
+ * Builder for document messages
3740
+ */
3741
+ declare class DocumentMessageBuilder extends BaseMediaBuilder<DocumentMediaObject> {
3742
+ /**
3743
+ * Set document filename
3744
+ */
3745
+ setFilename(filename: string): this;
3746
+ }
3747
+ /**
3748
+ * Builder for sticker messages
3749
+ */
3750
+ declare class StickerMessageBuilder extends BaseMediaBuilder<StickerMediaObject> {
3751
+ setCaption(caption: string): this;
3752
+ }
3753
+ /**
3754
+ * Factory class for common media patterns
3755
+ */
3756
+ declare class MediaMessageFactory {
3757
+ /**
3758
+ * Create an image with caption
3759
+ */
3760
+ static createImageWithCaption(linkOrId: string, caption: string, isId?: boolean): ImageMediaObject;
3761
+ /**
3762
+ * Create a video with caption
3763
+ */
3764
+ static createVideoWithCaption(linkOrId: string, caption: string, isId?: boolean): VideoMediaObject;
3765
+ /**
3766
+ * Create a document with filename
3767
+ */
3768
+ static createDocument(linkOrId: string, filename: string, caption?: string, isId?: boolean): DocumentMediaObject;
3769
+ /**
3770
+ * Create an audio message
3771
+ */
3772
+ static createAudio(linkOrId: string, isId?: boolean): AudioMediaObject;
3773
+ /**
3774
+ * Create a sticker message
3775
+ */
3776
+ static createSticker(linkOrId: string, isId?: boolean): StickerMediaObject;
3777
+ }
3778
+ //#endregion
3779
+ //#region src/api/messages/builders/ReactionMessageBuilder.d.ts
3780
+ /**
3781
+ * Builder class for creating reaction messages with a fluent API
3782
+ */
3783
+ declare class ReactionMessageBuilder {
3784
+ private reaction;
3785
+ /**
3786
+ * Set the message ID to react to
3787
+ */
3788
+ setMessageId(messageId: string): this;
3789
+ /**
3790
+ * Set the emoji for the reaction
3791
+ */
3792
+ setEmoji(emoji: string): this;
3793
+ /**
3794
+ * Remove a reaction (by sending empty emoji)
3795
+ */
3796
+ removeReaction(): this;
3797
+ /**
3798
+ * Build the final reaction object
3799
+ */
3800
+ build(): {
3801
+ message_id: string;
3802
+ emoji: string;
3803
+ };
3804
+ /**
3805
+ * Reset the builder for reuse
173
3806
  */
174
- migrateFlows(destinationWabaId: string, data: {
175
- source_waba_id: string;
176
- source_flow_names?: string[];
177
- }): Promise<FlowMigrationResponse>;
3807
+ reset(): this;
178
3808
  }
179
- //#endregion
180
- //#region src/api/media/MediaApi.d.ts
181
3809
  /**
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
3810
+ * Factory class for common reaction patterns
189
3811
  */
190
- declare class MediaApi extends BaseAPI implements MediaClass {
191
- private readonly endpoint;
192
- constructor(config: WabaConfigType, client: RequesterClass);
3812
+ declare class ReactionMessageFactory {
193
3813
  /**
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');
3814
+ * Create a like reaction
202
3815
  */
203
- getMediaById(mediaId: string, phone_number_id?: string): Promise<MediaResponse>;
3816
+ static createLike(messageId: string): {
3817
+ message_id: string;
3818
+ emoji: string;
3819
+ };
204
3820
  /**
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);
3821
+ * Create a heart reaction
214
3822
  */
215
- uploadMedia(file: File, messagingProduct?: string): Promise<UploadMediaResponse>;
3823
+ static createHeart(messageId: string): {
3824
+ message_id: string;
3825
+ emoji: string;
3826
+ };
216
3827
  /**
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');
3828
+ * Create a laughing reaction
225
3829
  */
226
- deleteMedia(mediaId: string, phone_number_id?: string): Promise<ResponseSuccess>;
3830
+ static createLaugh(messageId: string): {
3831
+ message_id: string;
3832
+ emoji: string;
3833
+ };
227
3834
  /**
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://...');
3835
+ * Create a wow reaction
235
3836
  */
236
- downloadMedia(mediaUrl: string): Promise<Blob>;
3837
+ static createWow(messageId: string): {
3838
+ message_id: string;
3839
+ emoji: string;
3840
+ };
3841
+ /**
3842
+ * Create a sad reaction
3843
+ */
3844
+ static createSad(messageId: string): {
3845
+ message_id: string;
3846
+ emoji: string;
3847
+ };
3848
+ /**
3849
+ * Create an angry reaction
3850
+ */
3851
+ static createAngry(messageId: string): {
3852
+ message_id: string;
3853
+ emoji: string;
3854
+ };
3855
+ /**
3856
+ * Remove a reaction
3857
+ */
3858
+ static removeReaction(messageId: string): {
3859
+ message_id: string;
3860
+ emoji: string;
3861
+ };
237
3862
  }
238
3863
  //#endregion
239
- //#region src/api/messages/MessageApi.d.ts
3864
+ //#region src/api/messages/builders/TemplateMessageBuilder.d.ts
3865
+ type CurrencyParameterHelper = {
3866
+ type: ParametersTypesEnum.Currency;
3867
+ currency: {
3868
+ fallback_value: string;
3869
+ code: CurrencyCodesEnum;
3870
+ amount_1000: number;
3871
+ };
3872
+ };
3873
+ type DateTimeParameterHelper = {
3874
+ type: ParametersTypesEnum.DateTime;
3875
+ date_time: {
3876
+ fallback_value: string;
3877
+ timestamp: number;
3878
+ };
3879
+ };
3880
+ type ParameterObject = CurrencyParameterHelper | DateTimeParameterHelper;
240
3881
  /**
241
- * Maps each message type to its appropriate payload type
3882
+ * Builder class for creating template messages with a fluent API
242
3883
  */
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>;
3884
+ declare class TemplateMessageBuilder {
3885
+ private template;
260
3886
  /**
261
- * Sends a request to the WhatsApp API
262
- * @param body The request body to send
263
- * @returns Promise with the API response
3887
+ * Set the template name
264
3888
  */
265
- private send;
3889
+ setName(name: string): this;
266
3890
  /**
267
- * Sends an audio message via WhatsApp
268
- * @param params The audio message parameter object
269
- * @returns Promise with the message response
3891
+ * Set the template language
270
3892
  */
271
- audio(params: MessageRequestParams<AudioMediaObject>): Promise<MessagesResponse>;
3893
+ setLanguage(code: string): this;
272
3894
  /**
273
- * Sends a contact card via WhatsApp
274
- * @param params The contact message parameter object
275
- * @returns Promise with the message response
3895
+ * Add a header component with text parameters
276
3896
  */
277
- contacts(params: MessageRequestParams<[ContactObject]>): Promise<MessagesResponse>;
3897
+ addTextHeader(parameters: string[]): this;
278
3898
  /**
279
- * Sends a document via WhatsApp
280
- * @param params The document message parameter object
281
- * @returns Promise with the message response
3899
+ * Add a header component with image
282
3900
  */
283
- document(params: MessageRequestParams<DocumentMediaObject>): Promise<MessagesResponse>;
3901
+ addImageHeader(imageUrl: string): this;
284
3902
  /**
285
- * Sends an image via WhatsApp
286
- * @param params The image message parameter object
287
- * @returns Promise with the message response
3903
+ * Add a body component with text parameters
288
3904
  */
289
- image(params: MessageRequestParams<ImageMediaObject>): Promise<MessagesResponse>;
3905
+ addBody(parameters: string[]): this;
290
3906
  /**
291
- * Sends an interactive message via WhatsApp
292
- * @param params The interactive message parameter object
293
- * @returns Promise with the message response
3907
+ * Add a footer component (usually no parameters needed)
294
3908
  */
295
- interactive(params: MessageRequestParams<InteractiveObject>): Promise<MessagesResponse>;
3909
+ addFooter(): this;
296
3910
  /**
297
- * Sends a location via WhatsApp
298
- * @param params The location message parameter object
299
- * @returns Promise with the message response
3911
+ * Add button components (for quick replies, URLs, etc.)
300
3912
  */
301
- location(params: MessageRequestParams<LocationObject>): Promise<MessagesResponse>;
3913
+ addButtons(buttons: Array<{
3914
+ index: number;
3915
+ type: 'quick_reply' | 'url';
3916
+ parameters?: string[];
3917
+ }>): this;
302
3918
  /**
303
- * Sends a sticker via WhatsApp
304
- * @param params The sticker message parameter object
305
- * @returns Promise with the message response
3919
+ * Add a currency parameter for header/body
306
3920
  */
307
- sticker(params: MessageRequestParams<StickerMediaObject>): Promise<MessagesResponse>;
3921
+ addCurrencyParameter(fallbackValue: string, currencyCode: string, amount: number): CurrencyParameterHelper;
308
3922
  /**
309
- * Sends a template message via WhatsApp
310
- * @param params The template message parameter object
311
- * @returns Promise with the message response
3923
+ * Add a date time parameter
312
3924
  */
313
- template(params: MessageRequestParams<MessageTemplateObject<ComponentTypesEnum>>): Promise<MessagesResponse>;
3925
+ addDateTimeParameter(fallbackValue: string, timestamp: number): DateTimeParameterHelper;
314
3926
  /**
315
- * Sends a text message via WhatsApp
316
- * @param params The text message parameter object
317
- * @returns Promise with the message response
3927
+ * Build the final template object
318
3928
  */
319
- text(params: TextMessageParams): Promise<MessagesResponse>;
3929
+ build(): MessageTemplateObject<ComponentTypesEnum>;
320
3930
  /**
321
- * Sends a video message via WhatsApp
322
- * @param params The video message parameter object
323
- * @returns Promise with the message response
3931
+ * Reset the builder for reuse
324
3932
  */
325
- video(params: MessageRequestParams<VideoMediaObject>): Promise<MessagesResponse>;
3933
+ reset(): this;
3934
+ }
3935
+ /**
3936
+ * Factory class for common template patterns
3937
+ */
3938
+ declare class TemplateMessageFactory {
326
3939
  /**
327
- * Updates message status (mark as read, etc.)
328
- * @param params The status update parameters
329
- * @returns Promise with the API response
3940
+ * Create a simple text-only template
330
3941
  */
331
- status(params: StatusParams): Promise<MessagesResponse>;
3942
+ static createSimpleTextTemplate(name: string, language: string, bodyParameters: string[]): MessageTemplateObject<ComponentTypesEnum>;
332
3943
  /**
333
- * Marks a message as read
334
- * @param params Object containing messageId
335
- * @returns Promise with the API response
3944
+ * Create a template with header, body and buttons
336
3945
  */
337
- markAsRead(params: {
338
- messageId: string;
339
- }): Promise<MessagesResponse>;
3946
+ static createCompleteTemplate(name: string, language: string, options: {
3947
+ headerParameters?: string[];
3948
+ headerImage?: string;
3949
+ bodyParameters: string[];
3950
+ buttons?: Array<{
3951
+ index: number;
3952
+ type: 'quick_reply' | 'url';
3953
+ parameters?: string[];
3954
+ }>;
3955
+ }): MessageTemplateObject<ComponentTypesEnum>;
340
3956
  /**
341
- * Shows typing indicator
342
- * @param params Object containing messageId
343
- * @returns Promise with the API response
3957
+ * Create an order confirmation template
344
3958
  */
345
- showTypingIndicator(params: {
346
- messageId: string;
347
- }): Promise<MessagesResponse>;
3959
+ static createOrderConfirmationTemplate(language: string, customerName: string, orderNumber: string, amount: number, currencyCode: string): MessageTemplateObject<ComponentTypesEnum>;
3960
+ }
3961
+ //#endregion
3962
+ //#region src/api/messages/builders/TextMessageBuilder.d.ts
3963
+ /**
3964
+ * Builder class for creating text messages with a fluent API
3965
+ */
3966
+ declare class TextMessageBuilder {
3967
+ private textMessage;
348
3968
  /**
349
- * Sends a list interactive message
350
- * @param params The list interactive message parameters
351
- * @returns Promise with the message response
3969
+ * Set the message body text
352
3970
  */
353
- interactiveList(params: MessageRequestParams<InteractiveObject & {
354
- type: InteractiveTypesEnum.List;
355
- }>): Promise<MessagesResponse>;
3971
+ setBody(text: string): this;
356
3972
  /**
357
- * Sends a CTA URL interactive message
358
- * @param params The CTA URL interactive message parameters
359
- * @returns Promise with the message response
3973
+ * Enable or disable URL preview
360
3974
  */
361
- interactiveCtaUrl(params: MessageRequestParams<InteractiveObject & {
362
- type: InteractiveTypesEnum.CtaUrl;
363
- }>): Promise<MessagesResponse>;
3975
+ setPreviewUrl(enable?: boolean): this;
364
3976
  /**
365
- * Sends a location request interactive message
366
- * @param params The location request interactive message parameters
367
- * @returns Promise with the message response
3977
+ * Build the final text object
368
3978
  */
369
- interactiveLocationRequest(params: MessageRequestParams<InteractiveObject & {
370
- type: InteractiveTypesEnum.LocationRequest;
371
- }>): Promise<MessagesResponse>;
3979
+ build(): TextObject;
372
3980
  /**
373
- * Sends an address message interactive message
374
- * @param params The address message interactive message parameters
375
- * @returns Promise with the message response
3981
+ * Reset the builder for reuse
376
3982
  */
377
- interactiveAddressMessage(params: MessageRequestParams<InteractiveObject & {
378
- type: InteractiveTypesEnum.AddressMessage;
379
- }>): Promise<MessagesResponse>;
3983
+ reset(): this;
3984
+ }
3985
+ /**
3986
+ * Factory class for common text message patterns
3987
+ */
3988
+ declare class TextMessageFactory {
380
3989
  /**
381
- * Sends a reply buttons interactive message
382
- * @param params The reply buttons interactive message parameters
383
- * @returns Promise with the message response
3990
+ * Create a simple text message
384
3991
  */
385
- interactiveReplyButtons(params: MessageRequestParams<InteractiveObject & {
386
- type: InteractiveTypesEnum.Button;
387
- }>): Promise<MessagesResponse>;
3992
+ static createSimpleText(body: string): TextObject;
388
3993
  /**
389
- * Sends a flow interactive message
390
- * @param params The flow interactive message parameters
391
- * @returns Promise with the message response
3994
+ * Create a text message with URL preview
392
3995
  */
393
- interactiveFlow(params: MessageRequestParams<InteractiveObject & {
394
- type: InteractiveTypesEnum.Flow;
395
- }>): Promise<MessagesResponse>;
3996
+ static createTextWithPreview(body: string): TextObject;
396
3997
  /**
397
- * Sends a reaction to a message
398
- * @param params The reaction parameters
399
- * @returns Promise with the message response
3998
+ * Create a notification message
400
3999
  */
401
- reaction(params: ReactionParams): Promise<MessagesResponse>;
4000
+ static createNotification(title: string, message: string): TextObject;
402
4001
  }
403
4002
  //#endregion
404
4003
  //#region src/api/phone/PhoneNumberApi.d.ts
@@ -845,67 +4444,6 @@ declare class WhatsApp {
845
4444
  getUserAgent(): string;
846
4445
  }
847
4446
  //#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
4447
  //#region src/core/webhook/utils/webhookUtils.d.ts
910
4448
  type MessageHandler = (whatsapp: WhatsApp, message: WebhookMessage) => void | Promise<void>;
911
4449
  type FlowHandler = (whatsapp: WhatsApp, request: FlowEndpointRequest) => any | Promise<any>;
@@ -970,75 +4508,8 @@ interface BaseResponse<T = any> {
970
4508
  setHeader?(name: string, value: string): void;
971
4509
  }
972
4510
  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
4511
  //#endregion
1041
- //#region src/core/webhook/frameworks/express.d.ts
4512
+ //#region src/core/webhook/frameworks/express/express.d.ts
1042
4513
  interface ExpressRequest extends BaseRequest {
1043
4514
  method: string;
1044
4515
  url: string;
@@ -1059,7 +4530,7 @@ interface NextFunction {
1059
4530
  interface ExpressWebhookConfig extends BaseWebhookConfig {
1060
4531
  path?: string;
1061
4532
  }
1062
- declare function webhookHandler(config: ExpressWebhookConfig): {
4533
+ declare function expressWebhookHandler(config: ExpressWebhookConfig): {
1063
4534
  GET: (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => Promise<ExpressResponse>;
1064
4535
  POST: (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => Promise<ExpressResponse>;
1065
4536
  webhook: (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => Promise<any>;
@@ -1067,7 +4538,7 @@ declare function webhookHandler(config: ExpressWebhookConfig): {
1067
4538
  processor: WebhookProcessor;
1068
4539
  };
1069
4540
  //#endregion
1070
- //#region src/core/webhook/frameworks/nextjs.d.ts
4541
+ //#region src/core/webhook/frameworks/nextjs/nextjs.d.ts
1071
4542
  interface BaseApiRequest extends BaseRequest {
1072
4543
  method?: string;
1073
4544
  url?: string;
@@ -1083,7 +4554,7 @@ interface BaseApiResponse extends BaseResponse {
1083
4554
  setHeader(name: string, value: string): void;
1084
4555
  }
1085
4556
  interface NextJsWebhookConfig extends BaseWebhookConfig {}
1086
- declare function webhookHandler$1<TRequest extends BaseApiRequest, TResponse extends BaseApiResponse>(config: NextJsWebhookConfig): {
4557
+ declare function nextjsWebhookHandler<TRequest extends BaseApiRequest, TResponse extends BaseApiResponse>(config: NextJsWebhookConfig): {
1087
4558
  GET: (req: TRequest, res: TResponse) => Promise<any>;
1088
4559
  POST: (req: TRequest, res: TResponse) => Promise<any>;
1089
4560
  webhook: (req: TRequest, res: TResponse) => Promise<any>;
@@ -1091,8 +4562,29 @@ declare function webhookHandler$1<TRequest extends BaseApiRequest, TResponse ext
1091
4562
  processor: WebhookProcessor;
1092
4563
  };
1093
4564
  //#endregion
4565
+ //#region src/core/webhook/frameworks/nextjs-app/nextjs-app.d.ts
4566
+ interface NextRequest extends Request {
4567
+ nextUrl: {
4568
+ searchParams: URLSearchParams;
4569
+ };
4570
+ }
4571
+ interface NextJsAppWebhookConfig extends WhatsAppConfig {}
4572
+ declare function nextjsAppWebhookHandler(config: NextJsAppWebhookConfig): {
4573
+ GET: (request: NextRequest) => Promise<Response>;
4574
+ POST: (request: NextRequest) => Promise<Response>;
4575
+ webhook: {
4576
+ GET: (request: NextRequest) => Promise<Response>;
4577
+ POST: (request: NextRequest) => Promise<Response>;
4578
+ };
4579
+ flow: {
4580
+ GET: (request: NextRequest) => Promise<Response>;
4581
+ POST: (request: NextRequest) => Promise<Response>;
4582
+ };
4583
+ processor: WebhookProcessor;
4584
+ };
4585
+ //#endregion
1094
4586
  //#region src/core/webhook/utils/generateXHub256Sig.d.ts
1095
4587
  declare const generateXHub256Sig: (body: string, appSecret: string) => string;
1096
4588
  //#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 };
4589
+ 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
4590
  //# sourceMappingURL=index.d.ts.map