meta-cloud-api 1.1.6 → 1.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/dist/browser/types.d.ts +3082 -0
  2. package/dist/browser/types.d.ts.map +1 -0
  3. package/dist/browser/types.js +2 -0
  4. package/dist/browser/types.js.map +1 -0
  5. package/dist/index-C37I1sT7.d.ts +3292 -0
  6. package/dist/index-C37I1sT7.d.ts.map +1 -0
  7. package/dist/index.d.ts +40 -3328
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +1 -798
  10. package/dist/index.js.map +1 -1
  11. package/dist/{enums.js → types-Ov9U2ABw.js} +122 -2
  12. package/dist/types-Ov9U2ABw.js.map +1 -0
  13. package/dist/types.d.ts +2 -0
  14. package/dist/{client.js → types.js} +1 -4
  15. package/package.json +7 -19
  16. package/dist/api/flow/types/common.d.ts +0 -406
  17. package/dist/api/flow/types/common.d.ts.map +0 -1
  18. package/dist/api/flow/types/common.js +0 -51
  19. package/dist/api/flow/types/common.js.map +0 -1
  20. package/dist/api/flow/types/index.d.ts +0 -1
  21. package/dist/api/flow/types/index.js +0 -1
  22. package/dist/api/media/types/common.d.ts +0 -32
  23. package/dist/api/media/types/common.d.ts.map +0 -1
  24. package/dist/api/media/types/index.d.ts +0 -1
  25. package/dist/api/messages/types/common.d.ts +0 -99
  26. package/dist/api/messages/types/common.d.ts.map +0 -1
  27. package/dist/api/messages/types/contact.d.ts +0 -54
  28. package/dist/api/messages/types/contact.d.ts.map +0 -1
  29. package/dist/api/messages/types/index.d.ts +0 -8
  30. package/dist/api/messages/types/interactive.d.ts +0 -182
  31. package/dist/api/messages/types/interactive.d.ts.map +0 -1
  32. package/dist/api/messages/types/location.d.ts +0 -16
  33. package/dist/api/messages/types/location.d.ts.map +0 -1
  34. package/dist/api/messages/types/media.d.ts +0 -55
  35. package/dist/api/messages/types/media.d.ts.map +0 -1
  36. package/dist/api/messages/types/reaction.d.ts +0 -17
  37. package/dist/api/messages/types/reaction.d.ts.map +0 -1
  38. package/dist/api/messages/types/template.d.ts +0 -72
  39. package/dist/api/messages/types/template.d.ts.map +0 -1
  40. package/dist/api/messages/types/text.d.ts +0 -17
  41. package/dist/api/messages/types/text.d.ts.map +0 -1
  42. package/dist/api/phone/types/common.d.ts +0 -83
  43. package/dist/api/phone/types/common.d.ts.map +0 -1
  44. package/dist/api/phone/types/index.d.ts +0 -1
  45. package/dist/api/profile/types/common.d.ts +0 -149
  46. package/dist/api/profile/types/common.d.ts.map +0 -1
  47. package/dist/api/profile/types/index.d.ts +0 -2
  48. package/dist/api/profile/types/upload.d.ts +0 -73
  49. package/dist/api/profile/types/upload.d.ts.map +0 -1
  50. package/dist/api/qrCode/types/common.d.ts +0 -28
  51. package/dist/api/qrCode/types/common.d.ts.map +0 -1
  52. package/dist/api/qrCode/types/index.d.ts +0 -1
  53. package/dist/api/template/types/common.d.ts +0 -155
  54. package/dist/api/template/types/common.d.ts.map +0 -1
  55. package/dist/api/template/types/factory.d.ts +0 -202
  56. package/dist/api/template/types/factory.d.ts.map +0 -1
  57. package/dist/api/template/types/index.d.ts +0 -2
  58. package/dist/api/waba/types/common.d.ts +0 -122
  59. package/dist/api/waba/types/common.d.ts.map +0 -1
  60. package/dist/api/waba/types/common.js +0 -44
  61. package/dist/api/waba/types/common.js.map +0 -1
  62. package/dist/api/waba/types/index.d.ts +0 -1
  63. package/dist/api/waba/types/index.js +0 -1
  64. package/dist/client.d.ts +0 -25
  65. package/dist/core/webhook/types.d.ts +0 -737
  66. package/dist/core/webhook/types.d.ts.map +0 -1
  67. package/dist/enums.d.ts +0 -668
  68. package/dist/enums.d.ts.map +0 -1
  69. package/dist/enums.js.map +0 -1
  70. package/dist/types/base.d.ts +0 -19
  71. package/dist/types/base.d.ts.map +0 -1
  72. package/dist/types/config.d.ts +0 -80
  73. package/dist/types/config.d.ts.map +0 -1
  74. package/dist/types/enums.d.ts +0 -668
  75. package/dist/types/enums.d.ts.map +0 -1
  76. package/dist/types/enums.js +0 -681
  77. package/dist/types/enums.js.map +0 -1
  78. package/dist/types/httpsClient.d.ts +0 -21
  79. package/dist/types/httpsClient.d.ts.map +0 -1
  80. package/dist/types/index.d.ts +0 -24
  81. package/dist/types/index.js +0 -5
  82. package/dist/types/logger.d.ts +0 -11
  83. package/dist/types/logger.d.ts.map +0 -1
  84. package/dist/types/request.d.ts +0 -52
  85. package/dist/types/request.d.ts.map +0 -1
  86. package/dist/utils/isMetaError.d.ts +0 -23
  87. package/dist/utils/isMetaError.d.ts.map +0 -1
@@ -0,0 +1,3082 @@
1
+ import { IncomingHttpHeaders, IncomingMessage } from "http";
2
+
3
+ //#region src/types/enums.d.ts
4
+ declare enum CategoryEnum {
5
+ Authentication = "AUTHENTICATION",
6
+ Marketing = "MARKETING",
7
+ Utility = "UTILITY",
8
+ }
9
+ declare enum TemplateStatusEnum {
10
+ Approved = "APPROVED",
11
+ Pending = "PENDING",
12
+ Rejected = "REJECTED",
13
+ }
14
+ declare enum HttpMethodsEnum {
15
+ Get = "GET",
16
+ Post = "POST",
17
+ Put = "PUT",
18
+ Delete = "DELETE",
19
+ }
20
+ declare enum MessageTypesEnum {
21
+ Audio = "audio",
22
+ Contacts = "contacts",
23
+ Document = "document",
24
+ Image = "image",
25
+ Interactive = "interactive",
26
+ Location = "location",
27
+ Reaction = "reaction",
28
+ Sticker = "sticker",
29
+ Template = "template",
30
+ Text = "text",
31
+ Video = "video",
32
+ Button = "button",
33
+ Order = "order",
34
+ System = "system",
35
+ Unknown = "unknown",
36
+ Statuses = "statuses",
37
+ '*' = "*",
38
+ }
39
+ declare enum ParametersTypesEnum {
40
+ Action = "ACTION",
41
+ CouponCode = "COUPON_CODE",
42
+ Currency = "CURRENCY",
43
+ DateTime = "DATE_TIME",
44
+ Document = "DOCUMENT",
45
+ ExpirationTimeMs = "EXPIRATION_TIME_MS",
46
+ Image = "IMAGE",
47
+ LimitedTimeOffer = "LIMITED_TIME_OFFER",
48
+ Location = "LOCATION",
49
+ OrderStatus = "ORDER_STATUS",
50
+ Payload = "PAYLOAD",
51
+ Product = "PRODUCT",
52
+ Text = "TEXT",
53
+ TtlMinutes = "TTL_MINUTES",
54
+ Video = "VIDEO",
55
+ WebviewInteraction = "WEBVIEW_INTERACTION",
56
+ WebviewPresentation = "WEBVIEW_PRESENTATION",
57
+ }
58
+ declare enum InteractiveTypesEnum {
59
+ Button = "button",
60
+ List = "list",
61
+ Product = "product",
62
+ ProductList = "product_list",
63
+ CtaUrl = "cta_url",
64
+ LocationRequest = "location_request_message",
65
+ AddressMessage = "address_message",
66
+ Flow = "flow",
67
+ }
68
+ declare enum ButtonPositionEnum {
69
+ First = 1,
70
+ Second = 2,
71
+ Third = 3,
72
+ Fourth = 4,
73
+ Fifth = 5,
74
+ }
75
+ declare enum SubTypeEnum {
76
+ Catalog = "CATALOG",
77
+ CopyCode = "COPY_CODE",
78
+ Flow = "FLOW",
79
+ Mpm = "MPM",
80
+ OrderDetails = "ORDER_DETAILS",
81
+ QuickReply = "QUICK_REPLY",
82
+ Reminder = "REMINDER",
83
+ Url = "URL",
84
+ VoiceCall = "VOICE_CALL",
85
+ }
86
+ declare enum ComponentTypesEnum {
87
+ Header = "HEADER",
88
+ Body = "BODY",
89
+ Button = "BUTTON",
90
+ Footer = "FOOTER",
91
+ }
92
+ declare enum WabaConfigEnum {
93
+ AppId = "M4D_APP_ID",
94
+ Port = "WA_PORT",
95
+ AppSecret = "M4D_APP_SECRET",
96
+ PhoneNumberId = "WA_PHONE_NUMBER_ID",
97
+ BusinessAcctId = "WA_BUSINESS_ACCOUNT_ID",
98
+ APIVersion = "CLOUD_API_VERSION",
99
+ AccessToken = "CLOUD_API_ACCESS_TOKEN",
100
+ WebhookEndpoint = "WEBHOOK_ENDPOINT",
101
+ WebhookVerificationToken = "WEBHOOK_VERIFICATION_TOKEN",
102
+ ListenerPort = "LISTENER_PORT",
103
+ MaxRetriesAfterWait = "MAX_RETRIES_AFTER_WAIT",
104
+ RequestTimeout = "REQUEST_TIMEOUT",
105
+ Debug = "DEBUG",
106
+ PrivatePem = "FLOW_API_PRIVATE_PEM",
107
+ Passphrase = "FLOW_API_PASSPHRASE",
108
+ }
109
+ declare enum ConversationTypesEnum {
110
+ BusinessInitiated = "business_initiated",
111
+ CustomerInitiated = "customer_initiated",
112
+ ReferralConversion = "referral_conversion",
113
+ }
114
+ declare enum StatusEnum {
115
+ Delivered = "delivered",
116
+ Read = "read",
117
+ Sent = "sent",
118
+ }
119
+ declare enum VideoMediaTypesEnum {
120
+ Mp4 = "video/mp4",
121
+ Threegp = "video/3gp",
122
+ }
123
+ declare enum StickerMediaTypesEnum {
124
+ Webp = "image/webp",
125
+ }
126
+ declare enum ImageMediaTypesEnum {
127
+ Jpeg = "image/jpeg",
128
+ Png = "image/png",
129
+ }
130
+ declare enum DocumentMediaTypesEnum {
131
+ Text = "text/plain",
132
+ Pdf = "application/pdf",
133
+ Ppt = "application/vnd.ms-powerpoint",
134
+ Word = "application/msword",
135
+ Excel = "application/vnd.ms-excel",
136
+ OpenDoc = "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
137
+ OpenPres = "application/vnd.openxmlformats-officedocument.presentationml.presentation",
138
+ OpenSheet = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
139
+ }
140
+ declare enum AudioMediaTypesEnum {
141
+ Aac = "audio/aac",
142
+ Mp4 = "audio/mp4",
143
+ Mpeg = "audio/mpeg",
144
+ Amr = "audio/amr",
145
+ Ogg = "audio/ogg",
146
+ }
147
+ declare enum WebhookTypesEnum {
148
+ Audio = "audio",
149
+ Button = "button",
150
+ Document = "document",
151
+ Text = "text",
152
+ Image = "image",
153
+ Interactive = "interactive",
154
+ Order = "order",
155
+ Sticker = "sticker",
156
+ System = "system",
157
+ Unknown = "unknown",
158
+ Video = "video",
159
+ }
160
+ declare enum SystemChangeTypesEnum {
161
+ CustomerChangedNumber = "customer_changed_number",
162
+ CustomerIdentityChanged = "customer_identity_changed",
163
+ }
164
+ declare enum ReferralSourceTypesEnum {
165
+ Ad = "ad",
166
+ Post = "post",
167
+ }
168
+ declare enum RequestCodeMethodsEnum {
169
+ Sms = "SMS",
170
+ Voice = "VOICE",
171
+ }
172
+ declare enum LanguagesEnum {
173
+ Afrikaans = "af",
174
+ Albanian = "sq",
175
+ Arabic = "ar",
176
+ Azerbaijani = "az",
177
+ Bengali = "bn",
178
+ Bulgarian = "bg",
179
+ Catalan = "ca",
180
+ Chinese_CHN = "zh_CN",
181
+ Chinese_HKG = "zh_HK",
182
+ Chinese_TAI = "zh_TW",
183
+ Croatian = "hr",
184
+ Czech = "cs",
185
+ Danish = "da",
186
+ Dutch = "nl",
187
+ English = "en",
188
+ English_UK = "en_GB",
189
+ English_US = "en_US",
190
+ Estonian = "et",
191
+ Filipino = "fil",
192
+ Finnish = "fi",
193
+ French = "fr",
194
+ Georgian = "ka",
195
+ German = "de",
196
+ Greek = "el",
197
+ Gujarati = "gu",
198
+ Hausa = "ha",
199
+ Hebrew = "he",
200
+ Hindi = "hi",
201
+ Hungarian = "hu",
202
+ Indonesian = "id",
203
+ Irish = "ga",
204
+ Italian = "it",
205
+ Japanese = "ja",
206
+ Kannada = "kn",
207
+ Kazakh = "kk",
208
+ Kinyarwanda = "rw_RW",
209
+ Korean = "ko",
210
+ Kyrgyz_Kyrgyzstan = "ky_KG",
211
+ Lao = "lo",
212
+ Latvian = "lv",
213
+ Lithuanian = "lt",
214
+ Macedonian = "mk",
215
+ Malay = "ms",
216
+ Malayalam = "ml",
217
+ Marathi = "mr",
218
+ Norwegian = "nb",
219
+ Persian = "fa",
220
+ Polish = "pl",
221
+ Portuguese_BR = "pt_BR",
222
+ Portuguese_POR = "pt_PT",
223
+ Punjabi = "pa",
224
+ Romanian = "ro",
225
+ Russian = "ru",
226
+ Serbian = "sr",
227
+ Slovak = "sk",
228
+ Slovenian = "sl",
229
+ Spanish = "es",
230
+ Spanish_ARG = "es_AR",
231
+ Spanish_SPA = "es_ES",
232
+ Spanish_MEX = "es_MX",
233
+ Swahili = "sw",
234
+ Swedish = "sv",
235
+ Tamil = "ta",
236
+ Telugu = "te",
237
+ Thai = "th",
238
+ Turkish = "tr",
239
+ Ukrainian = "uk",
240
+ Urdu = "ur",
241
+ Uzbek = "uz",
242
+ Vietnamese = "vi",
243
+ Zulu = "zu",
244
+ }
245
+ declare enum CurrencyCodesEnum {
246
+ AFN = "AFN",
247
+ EUR = "EUR",
248
+ ALL = "ALL",
249
+ DZD = "DZD",
250
+ USD = "USD",
251
+ AOA = "AOA",
252
+ XCD = "XCD",
253
+ ARS = "ARS",
254
+ AMD = "AMD",
255
+ AWG = "AWG",
256
+ AUD = "AUD",
257
+ AZN = "AZN",
258
+ BSD = "BSD",
259
+ BHD = "BHD",
260
+ BDT = "BDT",
261
+ BBD = "BBD",
262
+ BYN = "BYN",
263
+ BZD = "BZD",
264
+ XOF = "XOF",
265
+ BMD = "BMD",
266
+ INR = "INR",
267
+ BTN = "BTN",
268
+ BOB = "BOB",
269
+ BOV = "BOV",
270
+ BAM = "BAM",
271
+ BWP = "BWP",
272
+ NOK = "NOK",
273
+ BRL = "BRL",
274
+ BND = "BND",
275
+ BGN = "BGN",
276
+ BIF = "BIF",
277
+ CVE = "CVE",
278
+ KHR = "KHR",
279
+ XAF = "XAF",
280
+ CAD = "CAD",
281
+ KYD = "KYD",
282
+ CLP = "CLP",
283
+ CLF = "CLF",
284
+ CNY = "CNY",
285
+ COP = "COP",
286
+ COU = "COU",
287
+ KMF = "KMF",
288
+ CDF = "CDF",
289
+ NZD = "NZD",
290
+ CRC = "CRC",
291
+ HRK = "HRK",
292
+ CUP = "CUP",
293
+ CUC = "CUC",
294
+ ANG = "ANG",
295
+ CZK = "CZK",
296
+ DKK = "DKK",
297
+ DJF = "DJF",
298
+ DOP = "DOP",
299
+ EGP = "EGP",
300
+ SVC = "SVC",
301
+ ERN = "ERN",
302
+ SZL = "SZL",
303
+ ETB = "ETB",
304
+ FKP = "FKP",
305
+ FJD = "FJD",
306
+ XPF = "XPF",
307
+ GMD = "GMD",
308
+ GEL = "GEL",
309
+ GHS = "GHS",
310
+ GIP = "GIP",
311
+ GTQ = "GTQ",
312
+ GBP = "GBP",
313
+ GNF = "GNF",
314
+ GYD = "GYD",
315
+ HTG = "HTG",
316
+ HNL = "HNL",
317
+ HKD = "HKD",
318
+ HUF = "HUF",
319
+ ISK = "ISK",
320
+ IDR = "IDR",
321
+ XDR = "XDR",
322
+ IRR = "IRR",
323
+ IQD = "IQD",
324
+ ILS = "ILS",
325
+ JMD = "JMD",
326
+ JPY = "JPY",
327
+ JOD = "JOD",
328
+ KZT = "KZT",
329
+ KES = "KES",
330
+ KPW = "KPW",
331
+ KRW = "KRW",
332
+ KWD = "KWD",
333
+ KGS = "KGS",
334
+ LAK = "LAK",
335
+ LBP = "LBP",
336
+ LSL = "LSL",
337
+ ZAR = "ZAR",
338
+ LRD = "LRD",
339
+ LYD = "LYD",
340
+ CHF = "CHF",
341
+ MOP = "MOP",
342
+ MKD = "MKD",
343
+ MGA = "MGA",
344
+ MWK = "MWK",
345
+ MYR = "MYR",
346
+ MVR = "MVR",
347
+ MRU = "MRU",
348
+ MUR = "MUR",
349
+ XUA = "XUA",
350
+ MXN = "MXN",
351
+ MXV = "MXV",
352
+ MDL = "MDL",
353
+ MNT = "MNT",
354
+ MAD = "MAD",
355
+ MZN = "MZN",
356
+ MMK = "MMK",
357
+ NAD = "NAD",
358
+ NPR = "NPR",
359
+ NIO = "NIO",
360
+ NGN = "NGN",
361
+ OMR = "OMR",
362
+ PKR = "PKR",
363
+ PAB = "PAB",
364
+ PGK = "PGK",
365
+ PYG = "PYG",
366
+ PEN = "PEN",
367
+ PHP = "PHP",
368
+ PLN = "PLN",
369
+ QAR = "QAR",
370
+ RON = "RON",
371
+ RUB = "RUB",
372
+ RWF = "RWF",
373
+ SHP = "SHP",
374
+ WST = "WST",
375
+ STN = "STN",
376
+ SAR = "SAR",
377
+ RSD = "RSD",
378
+ SCR = "SCR",
379
+ SLL = "SLL",
380
+ SGD = "SGD",
381
+ XSU = "XSU",
382
+ SBD = "SBD",
383
+ SOS = "SOS",
384
+ SSP = "SSP",
385
+ LKR = "LKR",
386
+ SDG = "SDG",
387
+ SRD = "SRD",
388
+ SEK = "SEK",
389
+ CHE = "CHE",
390
+ CHW = "CHW",
391
+ SYP = "SYP",
392
+ TWD = "TWD",
393
+ TJS = "TJS",
394
+ TZS = "TZS",
395
+ THB = "THB",
396
+ TOP = "TOP",
397
+ TTD = "TTD",
398
+ TND = "TND",
399
+ TRY = "TRY",
400
+ TMT = "TMT",
401
+ UGX = "UGX",
402
+ UAH = "UAH",
403
+ AED = "AED",
404
+ USN = "USN",
405
+ UYU = "UYU",
406
+ UYI = "UYI",
407
+ UYW = "UYW",
408
+ UZS = "UZS",
409
+ VUV = "VUV",
410
+ VES = "VES",
411
+ VND = "VND",
412
+ YER = "YER",
413
+ ZMW = "ZMW",
414
+ ZWL = "ZWL",
415
+ XBA = "XBA",
416
+ XBB = "XBB",
417
+ XBC = "XBC",
418
+ XBD = "XBD",
419
+ XTS = "XTS",
420
+ XXX = "XXX",
421
+ XAU = "XAU",
422
+ XPD = "XPD",
423
+ XPT = "XPT",
424
+ XAG = "XAG",
425
+ AFA = "AFA",
426
+ FIM = "FIM",
427
+ ALK = "ALK",
428
+ ADP = "ADP",
429
+ ESP = "ESP",
430
+ FRF = "FRF",
431
+ AOK = "AOK",
432
+ AON = "AON",
433
+ AOR = "AOR",
434
+ ARA = "ARA",
435
+ ARP = "ARP",
436
+ ARY = "ARY",
437
+ RUR = "RUR",
438
+ ATS = "ATS",
439
+ AYM = "AYM",
440
+ AZM = "AZM",
441
+ BYB = "BYB",
442
+ BYR = "BYR",
443
+ BEC = "BEC",
444
+ BEF = "BEF",
445
+ BEL = "BEL",
446
+ BOP = "BOP",
447
+ BAD = "BAD",
448
+ BRB = "BRB",
449
+ BRC = "BRC",
450
+ BRE = "BRE",
451
+ BRN = "BRN",
452
+ BRR = "BRR",
453
+ BGJ = "BGJ",
454
+ BGK = "BGK",
455
+ BGL = "BGL",
456
+ BUK = "BUK",
457
+ HRD = "HRD",
458
+ CYP = "CYP",
459
+ CSJ = "CSJ",
460
+ CSK = "CSK",
461
+ ECS = "ECS",
462
+ ECV = "ECV",
463
+ GQE = "GQE",
464
+ EEK = "EEK",
465
+ XEU = "XEU",
466
+ GEK = "GEK",
467
+ DDM = "DDM",
468
+ DEM = "DEM",
469
+ GHC = "GHC",
470
+ GHP = "GHP",
471
+ GRD = "GRD",
472
+ GNE = "GNE",
473
+ GNS = "GNS",
474
+ GWE = "GWE",
475
+ GWP = "GWP",
476
+ ITL = "ITL",
477
+ ISJ = "ISJ",
478
+ IEP = "IEP",
479
+ ILP = "ILP",
480
+ ILR = "ILR",
481
+ LAJ = "LAJ",
482
+ LVL = "LVL",
483
+ LVR = "LVR",
484
+ LSM = "LSM",
485
+ ZAL = "ZAL",
486
+ LTL = "LTL",
487
+ LTT = "LTT",
488
+ LUC = "LUC",
489
+ LUF = "LUF",
490
+ LUL = "LUL",
491
+ MGF = "MGF",
492
+ MVQ = "MVQ",
493
+ MLF = "MLF",
494
+ MTL = "MTL",
495
+ MTP = "MTP",
496
+ MRO = "MRO",
497
+ MXP = "MXP",
498
+ MZE = "MZE",
499
+ MZM = "MZM",
500
+ NLG = "NLG",
501
+ NIC = "NIC",
502
+ PEH = "PEH",
503
+ PEI = "PEI",
504
+ PES = "PES",
505
+ PLZ = "PLZ",
506
+ PTE = "PTE",
507
+ ROK = "ROK",
508
+ ROL = "ROL",
509
+ STD = "STD",
510
+ CSD = "CSD",
511
+ SKK = "SKK",
512
+ SIT = "SIT",
513
+ RHD = "RHD",
514
+ ESA = "ESA",
515
+ ESB = "ESB",
516
+ SDD = "SDD",
517
+ SDP = "SDP",
518
+ SRG = "SRG",
519
+ CHC = "CHC",
520
+ TJR = "TJR",
521
+ TPE = "TPE",
522
+ TRL = "TRL",
523
+ TMM = "TMM",
524
+ UGS = "UGS",
525
+ UGW = "UGW",
526
+ UAK = "UAK",
527
+ SUR = "SUR",
528
+ USS = "USS",
529
+ UYN = "UYN",
530
+ UYP = "UYP",
531
+ VEB = "VEB",
532
+ VEF = "VEF",
533
+ VNC = "VNC",
534
+ YDD = "YDD",
535
+ YUD = "YUD",
536
+ YUM = "YUM",
537
+ YUN = "YUN",
538
+ ZRN = "ZRN",
539
+ ZRZ = "ZRZ",
540
+ ZMK = "ZMK",
541
+ ZWC = "ZWC",
542
+ ZWD = "ZWD",
543
+ ZWN = "ZWN",
544
+ ZWR = "ZWR",
545
+ XFO = "XFO",
546
+ XRE = "XRE",
547
+ XFU = "XFU",
548
+ }
549
+ declare enum DataLocalizationRegionEnum {
550
+ AU = "AU",
551
+ // Australia
552
+ ID = "ID",
553
+ // Indonesia
554
+ IN = "IN",
555
+ // India
556
+ JP = "JP",
557
+ // Japan
558
+ SG = "SG",
559
+ // Singapore
560
+ KR = "KR",
561
+ // South Korea
562
+ DE = "DE",
563
+ // EU (Germany)
564
+ CH = "CH",
565
+ // Switzerland
566
+ GB = "GB",
567
+ // United Kingdom
568
+ BR = "BR",
569
+ // Brazil
570
+ BH = "BH",
571
+ // Bahrain
572
+ ZA = "ZA",
573
+ // South Africa
574
+ AE = "AE",
575
+ // United Arab Emirates
576
+ CA = "CA",
577
+ }
578
+ /**
579
+ * Business category values for WhatsApp Business Profile.
580
+ * These values map to specific strings displayed in the WhatsApp client.
581
+ */
582
+ declare enum BusinessVerticalEnum {
583
+ /**
584
+ * Alcoholic Beverages
585
+ */
586
+ ALCOHOL = "ALCOHOL",
587
+ /**
588
+ * Clothing and Apparel
589
+ */
590
+ APPAREL = "APPAREL",
591
+ /**
592
+ * Automotive
593
+ */
594
+ AUTO = "AUTO",
595
+ /**
596
+ * Beauty, Spa and Salon
597
+ */
598
+ BEAUTY = "BEAUTY",
599
+ /**
600
+ * Education
601
+ */
602
+ EDU = "EDU",
603
+ /**
604
+ * Entertainment
605
+ */
606
+ ENTERTAIN = "ENTERTAIN",
607
+ /**
608
+ * Event Planning and Service
609
+ */
610
+ EVENT_PLAN = "EVENT_PLAN",
611
+ /**
612
+ * Finance and Banking
613
+ */
614
+ FINANCE = "FINANCE",
615
+ /**
616
+ * Public Service
617
+ */
618
+ GOVT = "GOVT",
619
+ /**
620
+ * Food and Grocery
621
+ */
622
+ GROCERY = "GROCERY",
623
+ /**
624
+ * Medical and Health
625
+ */
626
+ HEALTH = "HEALTH",
627
+ /**
628
+ * Hotel and Lodging
629
+ */
630
+ HOTEL = "HOTEL",
631
+ /**
632
+ * Non-profit
633
+ */
634
+ NONPROFIT = "NONPROFIT",
635
+ /**
636
+ * Online Gambling & Gaming
637
+ */
638
+ ONLINE_GAMBLING = "ONLINE_GAMBLING",
639
+ /**
640
+ * Over-the-Counter Drugs
641
+ */
642
+ OTC_DRUGS = "OTC_DRUGS",
643
+ /**
644
+ * Other
645
+ */
646
+ OTHER = "OTHER",
647
+ /**
648
+ * Non-Online Gambling & Gaming (E.g. Brick and mortar)
649
+ */
650
+ PHYSICAL_GAMBLING = "PHYSICAL_GAMBLING",
651
+ /**
652
+ * Professional Services
653
+ */
654
+ PROF_SERVICES = "PROF_SERVICES",
655
+ /**
656
+ * Restaurant
657
+ */
658
+ RESTAURANT = "RESTAURANT",
659
+ /**
660
+ * Shopping and Retail
661
+ */
662
+ RETAIL = "RETAIL",
663
+ /**
664
+ * Travel and Transportation
665
+ */
666
+ TRAVEL = "TRAVEL",
667
+ }
668
+ //#endregion
669
+ //#region src/types/config.d.ts
670
+ type WhatsAppConfig = {
671
+ accessToken: string;
672
+ appId?: string;
673
+ appSecret?: string;
674
+ phoneNumberId?: number;
675
+ businessAcctId?: string;
676
+ apiVersion?: string;
677
+ webhookEndpoint?: string;
678
+ webhookVerificationToken?: string;
679
+ listenerPort?: number;
680
+ debug?: boolean;
681
+ maxRetriesAfterWait?: number;
682
+ requestTimeout?: number;
683
+ privatePem?: string;
684
+ passphrase?: string;
685
+ };
686
+ type WabaConfigType = {
687
+ /**
688
+ * The Meta for Developers business application Id for this registered application.
689
+ */
690
+ [WabaConfigEnum.AppId]: string;
691
+ /**
692
+ * The Meta for Developers business application secret for this registered application.
693
+ */
694
+ [WabaConfigEnum.AppSecret]: string;
695
+ /**
696
+ * The Meta for Developers phone number id used by the registered business.
697
+ */
698
+ [WabaConfigEnum.PhoneNumberId]: number;
699
+ /**
700
+ * The Meta for Developers business id for the registered business.
701
+ */
702
+ [WabaConfigEnum.BusinessAcctId]: string;
703
+ /**
704
+ * The version of the Cloud API being used. Starts with a "v" and follows the major number.
705
+ */
706
+ [WabaConfigEnum.APIVersion]: string;
707
+ /**
708
+ * The access token to make calls on behalf of the signed in Meta for Developers account or business.
709
+ */
710
+ [WabaConfigEnum.AccessToken]: string;
711
+ /**
712
+ * The endpoint path (e.g. if the value here is webhook, the webhook URL would look like http/https://{host}/webhook).
713
+ */
714
+ [WabaConfigEnum.WebhookEndpoint]: string;
715
+ /**
716
+ * The verification token that needs to match what is sent by the Cloud API webhook in order to subscribe.
717
+ */
718
+ [WabaConfigEnum.WebhookVerificationToken]: string;
719
+ /**
720
+ * The listener port for the webhook web server.
721
+ */
722
+ [WabaConfigEnum.ListenerPort]: number;
723
+ /**
724
+ * To turn on global debugging of the logger to print verbose output across the APIs.
725
+ */
726
+ [WabaConfigEnum.Debug]: boolean;
727
+ /**
728
+ * The total number of times a request should be retried after the wait period if it fails.
729
+ */
730
+ [WabaConfigEnum.MaxRetriesAfterWait]: number;
731
+ /**
732
+ * The timeout period for a request to quit and destroy the attempt in ms.
733
+ */
734
+ [WabaConfigEnum.RequestTimeout]: number;
735
+ /**
736
+ * The private key for the Meta for Developers business.
737
+ */
738
+ [WabaConfigEnum.PrivatePem]: string;
739
+ /**
740
+ * The passphrase for the Meta for Developers business.
741
+ */
742
+ [WabaConfigEnum.Passphrase]: string;
743
+ };
744
+ //#endregion
745
+ //#region src/types/logger.d.ts
746
+ interface LoggerInterface {
747
+ log(...data: any[]): void;
748
+ error(...data: any[]): void;
749
+ warn(...data: any[]): void;
750
+ info(...data: any[]): void;
751
+ debug(...data: any[]): void;
752
+ }
753
+ //#endregion
754
+ //#region src/types/request.d.ts
755
+ type GeneralRequestBody = Record<string, unknown>;
756
+ interface GeneralHeaderInterface {
757
+ /**
758
+ * Authorization token. This is required for all HTTP requests made to the graph API.
759
+ * @default 'Bearer '
760
+ */
761
+ Authorization: string;
762
+ /**
763
+ * Content type of the message being sent. This is required for all HTTP requests made to the graph API.
764
+ * @default 'application/json'
765
+ */
766
+ 'Content-Type': string;
767
+ /**
768
+ * User agent field sent in all requests. This is used to gather SDK usage metrics and help
769
+ * better triage support requests.
770
+ * @default `WA_SDK/${ SDK_version } (Node.js ${ process.version })`
771
+ */
772
+ 'User-Agent': string;
773
+ }
774
+ interface RequesterResponseInterface<T> {
775
+ json: () => Promise<T>;
776
+ }
777
+ interface ResponseSuccess {
778
+ success: boolean;
779
+ }
780
+ interface ResponseData<T> {
781
+ data: T;
782
+ }
783
+ interface ResponsePagination<T> {
784
+ data: T[];
785
+ paging: Paging;
786
+ }
787
+ interface Paging {
788
+ cursors: {
789
+ before: string;
790
+ after: string;
791
+ };
792
+ next: string;
793
+ }
794
+ declare class RequesterClass {
795
+ constructor(apiVersion: string, phoneNumberId: number, accessToken: string, businessAcctId: string, userAgent: string);
796
+ sendRequest: (method: HttpMethodsEnum, path: string, timeout: number, body?: GeneralRequestBody, contentType?: string, additionalHeaders?: Record<string, string>) => Promise<RequesterResponseInterface<unknown>>;
797
+ getJson<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: GeneralRequestBody, additionalHeaders?: Record<string, string>): Promise<T>;
798
+ sendFormData<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: FormData, additionalHeaders?: Record<string, string>): Promise<T>;
799
+ sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, formData: Record<string, string>, additionalHeaders?: Record<string, string>): Promise<T>;
800
+ }
801
+ //#endregion
802
+ //#region src/types/httpsClient.d.ts
803
+ type ResponseHeaderValue = string | string[] | undefined;
804
+ type ResponseHeaders = Record<string, ResponseHeaderValue>;
805
+ type ResponseJSONBody = Record<string, unknown>;
806
+ declare class HttpsClientResponseClass {
807
+ constructor(resp: Response);
808
+ statusCode: () => number;
809
+ headers: () => ResponseHeaders;
810
+ rawResponse: () => Response;
811
+ json: () => Promise<ResponseJSONBody>;
812
+ }
813
+ declare class HttpsClientClass {
814
+ constructor();
815
+ clearSockets: () => boolean;
816
+ sendRequest: (host: string, path: string, method: HttpMethodsEnum, headers: HeadersInit, timeout: number, body?: BodyInit | null) => Promise<HttpsClientResponseClass>;
817
+ }
818
+ //#endregion
819
+ //#region src/types/base.d.ts
820
+ declare class BaseClass {
821
+ constructor(config: WabaConfigType);
822
+ }
823
+ //#endregion
824
+ //#region src/api/profile/types/upload.d.ts
825
+ /**
826
+ * Response from creating an upload session.
827
+ */
828
+ interface UploadSessionResponse {
829
+ id: string;
830
+ }
831
+ /**
832
+ * Response from uploading business profile media.
833
+ */
834
+ interface UploadBusinessProfileResponse {
835
+ h: string;
836
+ }
837
+ /**
838
+ * Upload handle information containing file details and handle.
839
+ */
840
+ interface UploadHandle {
841
+ handle: string;
842
+ file_size: number;
843
+ upload_result: {
844
+ handle_type: string;
845
+ name: string;
846
+ };
847
+ }
848
+ /**
849
+ * Request parameters for creating upload session.
850
+ */
851
+ //#endregion
852
+ //#region src/api/profile/types/common.d.ts
853
+ /**
854
+ * Available fields that can be requested when retrieving a business profile.
855
+ */
856
+ type BusinessProfileField = 'about' | 'address' | 'description' | 'email' | 'profile_picture_url' | 'websites' | 'vertical';
857
+ type BusinessProfileFieldsParam = BusinessProfileField[] | string;
858
+ /**
859
+ * Business profile data structure containing all profile information.
860
+ */
861
+ interface BusinessProfileData {
862
+ /**
863
+ * The business's About text. This text appears in the business's profile, beneath its profile image,
864
+ * phone number, and contact buttons.
865
+ * - String cannot be empty
866
+ * - Strings must be between 1 and 139 characters
867
+ * - Rendered emojis are supported however their unicode values are not.
868
+ * Emoji unicode values must be Java- or JavaScript-escape encoded
869
+ * - Hyperlinks can be included but will not render as clickable links
870
+ * - Markdown is not supported
871
+ */
872
+ about?: string;
873
+ /**
874
+ * Address of the business. Character limit 256.
875
+ */
876
+ address?: string;
877
+ /**
878
+ * Description of the business. Character limit 512.
879
+ */
880
+ description?: string;
881
+ /**
882
+ * The contact email address (in valid email format) of the business. Character limit 128.
883
+ */
884
+ email?: string;
885
+ /**
886
+ * The messaging service used for the request. Always set it to "whatsapp" if you are using
887
+ * the WhatsApp Business API.
888
+ */
889
+ messaging_product: string;
890
+ /**
891
+ * Profile picture URL.
892
+ */
893
+ profile_picture_url?: string;
894
+ /**
895
+ * The URLs associated with the business. For instance, a website, Facebook Page, or Instagram.
896
+ * - You must include the http:// or https:// portion of the URL
897
+ * - There is a maximum of 2 websites with a maximum of 256 characters each
898
+ */
899
+ websites?: string[];
900
+ /**
901
+ * Business category. This can be either an empty string or one of the predefined business categories.
902
+ * @see BusinessVerticalEnum for all available options
903
+ */
904
+ vertical?: BusinessVerticalEnum | string;
905
+ }
906
+ /**
907
+ * Response structure for business profile GET requests.
908
+ */
909
+ interface BusinessProfileResponse {
910
+ data: BusinessProfileData[];
911
+ }
912
+ /**
913
+ * Request structure for updating business profile.
914
+ */
915
+ interface UpdateBusinessProfileRequest {
916
+ /**
917
+ * The messaging service used for the request. Always set it to "whatsapp" if you are using
918
+ * the WhatsApp Business API.
919
+ * @required
920
+ */
921
+ messaging_product: string;
922
+ /**
923
+ * The business's About text. This text appears in the business's profile, beneath its profile image,
924
+ * phone number, and contact buttons.
925
+ * - String cannot be empty
926
+ * - Strings must be between 1 and 139 characters
927
+ * - Rendered emojis are supported however their unicode values are not.
928
+ * Emoji unicode values must be Java- or JavaScript-escape encoded
929
+ * - Hyperlinks can be included but will not render as clickable links
930
+ * - Markdown is not supported
931
+ */
932
+ about?: string;
933
+ /**
934
+ * Address of the business. Character limit 256.
935
+ */
936
+ address?: string;
937
+ /**
938
+ * Description of the business. Character limit 512.
939
+ */
940
+ description?: string;
941
+ /**
942
+ * Business category. This can be either an empty string or one of the predefined business categories.
943
+ * @see BusinessVerticalEnum for all available options
944
+ */
945
+ vertical?: BusinessVerticalEnum | string;
946
+ /**
947
+ * The contact email address (in valid email format) of the business. Character limit 128.
948
+ */
949
+ email?: string;
950
+ /**
951
+ * The URLs associated with the business. For instance, a website, Facebook Page, or Instagram.
952
+ * - You must include the http:// or https:// portion of the URL
953
+ * - There is a maximum of 2 websites with a maximum of 256 characters each
954
+ */
955
+ websites?: string[];
956
+ /**
957
+ * Handle of the profile picture. This handle is generated when you upload the binary file
958
+ * for the profile picture to Meta using the Resumable Upload API.
959
+ */
960
+ profile_picture_handle?: string;
961
+ }
962
+ declare class BusinessProfileClass extends BaseClass {
963
+ /**
964
+ * Get your business profile.
965
+ * @param fields Specific fields to be returned in the response. If not specified, all fields will be returned.
966
+ */
967
+ getBusinessProfile(fields?: BusinessProfileFieldsParam): Promise<BusinessProfileResponse>;
968
+ /**
969
+ * Update your business profile.
970
+ * @param updateRequest The request object containing the fields to update.
971
+ */
972
+ updateBusinessProfile(updateRequest: UpdateBusinessProfileRequest): Promise<ResponseSuccess>;
973
+ /**
974
+ * Create an upload session for profile picture.
975
+ * @param fileLength Length of the file to be uploaded in bytes.
976
+ * @param fileType MIME type of the file (e.g., 'image/jpeg').
977
+ * @param fileName Name of the file.
978
+ */
979
+ createUploadSession(fileLength: number, fileType: string, fileName: string): Promise<UploadSessionResponse>;
980
+ /**
981
+ * Upload media file to the upload session.
982
+ * @param uploadId The ID of the upload session.
983
+ * @param file The binary data of the file.
984
+ */
985
+ uploadMedia(uploadId: string, file: Buffer): Promise<UploadBusinessProfileResponse>;
986
+ /**
987
+ * Get the upload handle information.
988
+ * @param uploadId The ID of the upload session.
989
+ */
990
+ getUploadHandle(uploadId: string): Promise<UploadHandle>;
991
+ }
992
+ //#endregion
993
+ //#region src/api/phone/types/common.d.ts
994
+ type QualityRating = 'GREEN' | 'YELLOW' | 'RED' | 'NA';
995
+ type AccountMode = 'LIVE' | 'SANDBOX';
996
+ type CodeVerificationStatus = 'NOT_VERIFIED' | 'VERIFIED' | 'EXPIRED' | 'PENDING' | 'DELETED' | 'MIGRATED' | 'BANNED' | 'RESTRICTED' | 'RATE_LIMITED' | 'FLAGGED' | 'CONNECTED' | 'DISCONNECTED' | 'UNKNOWN' | 'UNVERIFIED';
997
+ type MessagingLimitTier = 'TIER_50' | 'TIER_250' | 'TIER_1K' | 'TIER_10K' | 'TIER_100K' | 'TIER_UNLIMITED';
998
+ type PlatformType = 'CLOUD_API' | 'ON_PREMISE' | 'NOT_APPLICABLE';
999
+ type ThroughputLevel = 'STANDARD' | 'HIGH' | 'NOT_APPLICABLE';
1000
+ type HealthStatusEntity = {
1001
+ entity_type: string;
1002
+ id: string;
1003
+ can_send_message: string;
1004
+ additional_info?: string[];
1005
+ errors?: Array<{
1006
+ error_code: number;
1007
+ error_description: string;
1008
+ possible_solution: string;
1009
+ }>;
1010
+ };
1011
+ type HealthStatus = {
1012
+ can_send_message: string;
1013
+ entities: HealthStatusEntity[];
1014
+ };
1015
+ type QualityScore = {
1016
+ score: QualityRating;
1017
+ };
1018
+ type Throughput = {
1019
+ level: ThroughputLevel;
1020
+ };
1021
+ type PhoneNumberResponse = {
1022
+ display_phone_number: string;
1023
+ id: string;
1024
+ quality_rating: QualityRating;
1025
+ verified_name: string;
1026
+ account_mode?: AccountMode;
1027
+ certificate?: string;
1028
+ code_verification_status?: CodeVerificationStatus;
1029
+ conversational_automation?: Record<string, unknown>;
1030
+ eligibility_for_api_business_global_search?: string;
1031
+ health_status?: HealthStatus;
1032
+ is_official_business_account?: boolean;
1033
+ is_on_biz_app?: boolean;
1034
+ is_pin_enabled?: boolean;
1035
+ is_preverified_number?: boolean;
1036
+ last_onboarded_time?: string;
1037
+ messaging_limit_tier?: MessagingLimitTier;
1038
+ name_status?: string;
1039
+ new_certificate?: string;
1040
+ new_name_status?: string;
1041
+ platform_type?: PlatformType;
1042
+ quality_score?: QualityScore;
1043
+ search_visibility?: string;
1044
+ status?: CodeVerificationStatus;
1045
+ throughput?: Throughput;
1046
+ };
1047
+ type Cursors = {
1048
+ before: string;
1049
+ after: string;
1050
+ };
1051
+ type PhoneNumbersResponse = {
1052
+ data: PhoneNumberResponse[];
1053
+ paging: Paging;
1054
+ };
1055
+ type RequestVerificationCodeRequest = {
1056
+ code_method: 'SMS' | 'VOICE';
1057
+ language: string;
1058
+ };
1059
+ type VerifyCodeRequest = {
1060
+ code: string;
1061
+ };
1062
+ type TwoStepVerificationParams = {
1063
+ pin: string;
1064
+ };
1065
+ interface PhoneNumberClass {
1066
+ getPhoneNumberById(fields?: string): Promise<PhoneNumberResponse>;
1067
+ getPhoneNumbers(): Promise<PhoneNumbersResponse>;
1068
+ requestVerificationCode(params: RequestVerificationCodeRequest): Promise<ResponseSuccess>;
1069
+ verifyCode(params: VerifyCodeRequest): Promise<ResponseSuccess>;
1070
+ }
1071
+ //#endregion
1072
+ //#region src/api/template/types/common.d.ts
1073
+ type TemplateFormat = 'TEXT' | 'IMAGE' | 'VIDEO' | 'DOCUMENT' | 'LOCATION' | 'PRODUCT';
1074
+ type PhoneNumberButton = {
1075
+ type: 'PHONE_NUMBER';
1076
+ text: string;
1077
+ phone_number: string;
1078
+ };
1079
+ type URLButton = {
1080
+ type: 'URL';
1081
+ text: string;
1082
+ url: string;
1083
+ example?: string[];
1084
+ };
1085
+ type QuickReplyButton = {
1086
+ type: 'QUICK_REPLY';
1087
+ text: string;
1088
+ };
1089
+ type CopyCodeButton = {
1090
+ type: 'COPY_CODE';
1091
+ example: string;
1092
+ };
1093
+ type FlowButton = {
1094
+ type: 'FLOW';
1095
+ text: string;
1096
+ flow_id?: string;
1097
+ flow_name?: string;
1098
+ flow_json?: string;
1099
+ flow_action?: 'navigate' | 'data_exchange';
1100
+ navigate_screen?: string;
1101
+ };
1102
+ type MPMButton = {
1103
+ type: 'MPM';
1104
+ action?: {
1105
+ thumbnail_product_retailer_id: string;
1106
+ sections: Array<{
1107
+ title?: string;
1108
+ product_items: Array<{
1109
+ product_retailer_id: string;
1110
+ }>;
1111
+ }>;
1112
+ };
1113
+ };
1114
+ type OTPButton = {
1115
+ type: 'OTP';
1116
+ };
1117
+ type SPMButton = {
1118
+ type: 'SPM';
1119
+ action?: {
1120
+ product_retailer_id: string;
1121
+ };
1122
+ };
1123
+ type CatalogButton = {
1124
+ type: 'CATALOG';
1125
+ action?: {
1126
+ thumbnail_product_retailer_id: string;
1127
+ };
1128
+ };
1129
+ type TemplateButton = PhoneNumberButton | URLButton | QuickReplyButton | CopyCodeButton | FlowButton | MPMButton | OTPButton | SPMButton | CatalogButton;
1130
+ type TemplateHeaderExample = {
1131
+ header_text?: string[];
1132
+ header_text_named_params?: Array<{
1133
+ param_name: string;
1134
+ example: string;
1135
+ }>;
1136
+ header_handle?: string[];
1137
+ };
1138
+ type TemplateHeader = {
1139
+ type: 'HEADER';
1140
+ format: TemplateFormat;
1141
+ text?: string;
1142
+ example?: TemplateHeaderExample;
1143
+ };
1144
+ type TemplateBody = {
1145
+ type: 'BODY';
1146
+ text: string;
1147
+ example?: {
1148
+ body_text?: Array<Array<string>>;
1149
+ body_text_named_params?: Array<{
1150
+ param_name: string;
1151
+ example: string;
1152
+ }>;
1153
+ };
1154
+ };
1155
+ type TemplateFooter = {
1156
+ type: 'FOOTER';
1157
+ text: string;
1158
+ };
1159
+ type TemplateButtons = {
1160
+ type: 'BUTTONS';
1161
+ buttons: TemplateButton[];
1162
+ };
1163
+ type TemplateLimitedTimeOffer = {
1164
+ type: 'LIMITED_TIME_OFFER';
1165
+ limited_time_offer: {
1166
+ expiration_time_ms: number;
1167
+ };
1168
+ };
1169
+ type TemplateCarousel = {
1170
+ type: 'CAROUSEL';
1171
+ cards: Array<{
1172
+ card_index: number;
1173
+ components: ComponentTypes[];
1174
+ }>;
1175
+ };
1176
+ type MediaCarouselCard = {
1177
+ card_index: number;
1178
+ components: (TemplateHeader | TemplateBody | TemplateButtons)[];
1179
+ };
1180
+ type ProductCarouselCard = {
1181
+ card_index: number;
1182
+ components: TemplateHeader[];
1183
+ };
1184
+ type ComponentTypes = TemplateHeader | TemplateBody | TemplateFooter | TemplateButtons | TemplateLimitedTimeOffer | TemplateCarousel;
1185
+ type TemplateRequestBody = GeneralRequestBody & {
1186
+ name: string;
1187
+ language: LanguagesEnum;
1188
+ category?: CategoryEnum;
1189
+ components?: ComponentTypes[];
1190
+ };
1191
+ type TemplateResponse = {
1192
+ id: string;
1193
+ status: string;
1194
+ language: LanguagesEnum;
1195
+ category: CategoryEnum;
1196
+ name: string;
1197
+ components: ComponentTypes[];
1198
+ };
1199
+ type TemplateGetParams = {
1200
+ limit?: number;
1201
+ name?: string;
1202
+ language?: LanguagesEnum;
1203
+ category?: CategoryEnum;
1204
+ status?: TemplateStatusEnum;
1205
+ };
1206
+ type TemplateDeleteParams = {
1207
+ hsm_id: string;
1208
+ name: string;
1209
+ };
1210
+ declare class TemplateClass {
1211
+ getTemplate(templateId: string): Promise<TemplateResponse>;
1212
+ updateTemplate(templateId: string, template: Partial<TemplateRequestBody>): Promise<ResponseSuccess>;
1213
+ getTemplates(params?: TemplateGetParams): Promise<ResponsePagination<TemplateResponse>>;
1214
+ createTemplate(template: TemplateRequestBody): Promise<TemplateResponse>;
1215
+ deleteTemplate(params: TemplateDeleteParams): Promise<ResponseSuccess>;
1216
+ }
1217
+ //#endregion
1218
+ //#region src/api/template/types/factory.d.ts
1219
+ interface TextParameter {
1220
+ type: 'text';
1221
+ value: string;
1222
+ }
1223
+ interface CurrencyParameter {
1224
+ type: 'currency';
1225
+ amount_1000: number;
1226
+ code: CurrencyCodesEnum;
1227
+ fallback_value: string;
1228
+ }
1229
+ interface DateTimeParameter {
1230
+ type: 'date_time';
1231
+ fallback_value: string;
1232
+ }
1233
+ interface MediaParameter {
1234
+ type: 'image' | 'video' | 'document';
1235
+ handle?: string;
1236
+ link?: string;
1237
+ }
1238
+ interface LocationParameter {
1239
+ type: 'location';
1240
+ latitude?: number;
1241
+ longitude?: number;
1242
+ name?: string;
1243
+ address?: string;
1244
+ }
1245
+ interface ProductParameter {
1246
+ type: 'product';
1247
+ product_retailer_id: string;
1248
+ }
1249
+ type TemplateParameter = TextParameter | CurrencyParameter | DateTimeParameter | MediaParameter | LocationParameter | ProductParameter;
1250
+ interface HeaderOptions {
1251
+ format: TemplateFormat;
1252
+ text?: string;
1253
+ parameters?: TemplateParameter[];
1254
+ example?: {
1255
+ header_text?: string[];
1256
+ header_text_named_params?: Array<{
1257
+ param_name: string;
1258
+ example: string;
1259
+ }>;
1260
+ header_handle?: string[];
1261
+ };
1262
+ }
1263
+ interface BodyOptions {
1264
+ text: string;
1265
+ parameters?: TemplateParameter[];
1266
+ example?: {
1267
+ body_text?: string[][];
1268
+ body_text_named_params?: Array<{
1269
+ param_name: string;
1270
+ example: string;
1271
+ }>;
1272
+ };
1273
+ }
1274
+ interface FooterOptions {
1275
+ text: string;
1276
+ }
1277
+ interface ButtonOptions {
1278
+ phone_number?: {
1279
+ text: string;
1280
+ phone_number: string;
1281
+ };
1282
+ url?: {
1283
+ text: string;
1284
+ url: string;
1285
+ example?: string;
1286
+ };
1287
+ quick_reply?: {
1288
+ text: string;
1289
+ }[];
1290
+ copy_code?: {
1291
+ example: string;
1292
+ };
1293
+ flow?: {
1294
+ text: string;
1295
+ flow_id?: string;
1296
+ flow_name?: string;
1297
+ flow_json?: string;
1298
+ flow_action?: 'navigate' | 'data_exchange';
1299
+ navigate_screen?: string;
1300
+ };
1301
+ mpm?: boolean;
1302
+ otp?: boolean;
1303
+ spm?: boolean;
1304
+ }
1305
+ interface CarouselCard {
1306
+ image?: string;
1307
+ video?: string;
1308
+ product?: string;
1309
+ body?: string;
1310
+ bodyParameters?: TemplateParameter[];
1311
+ buttons?: ButtonOptions;
1312
+ }
1313
+ interface CarouselOptions {
1314
+ cards: CarouselCard[];
1315
+ }
1316
+ interface LimitedTimeOfferOptions {
1317
+ expiration_time_ms: number;
1318
+ }
1319
+ interface ProductSection {
1320
+ title?: string;
1321
+ product_items: Array<{
1322
+ product_retailer_id: string;
1323
+ }>;
1324
+ }
1325
+ interface TemplateOptions {
1326
+ name: string;
1327
+ language: LanguagesEnum;
1328
+ category: CategoryEnum;
1329
+ header?: HeaderOptions;
1330
+ body?: BodyOptions;
1331
+ footer?: FooterOptions;
1332
+ buttons?: ButtonOptions;
1333
+ carousel?: CarouselOptions;
1334
+ limitedTimeOffer?: LimitedTimeOfferOptions;
1335
+ }
1336
+ interface OTPTemplateOptions {
1337
+ name: string;
1338
+ language: LanguagesEnum;
1339
+ code_expiration_minutes?: number;
1340
+ add_security_recommendation?: boolean;
1341
+ }
1342
+ interface AuthenticationTemplateOptions {
1343
+ name: string;
1344
+ language: LanguagesEnum;
1345
+ code_expiration_minutes?: number;
1346
+ add_security_recommendation?: boolean;
1347
+ copy_code_button?: boolean;
1348
+ }
1349
+ interface CatalogTemplateOptions {
1350
+ name: string;
1351
+ language: LanguagesEnum;
1352
+ header?: Omit<HeaderOptions, 'format'>;
1353
+ body: BodyOptions;
1354
+ footer?: FooterOptions;
1355
+ thumbnail_product_retailer_id: string;
1356
+ }
1357
+ interface CouponTemplateOptions {
1358
+ name: string;
1359
+ language: LanguagesEnum;
1360
+ header?: Omit<HeaderOptions, 'format'>;
1361
+ body: BodyOptions;
1362
+ footer?: FooterOptions;
1363
+ coupon_code: string;
1364
+ }
1365
+ interface LimitedTimeOfferTemplateOptions {
1366
+ name: string;
1367
+ language: LanguagesEnum;
1368
+ header?: Omit<HeaderOptions, 'format'>;
1369
+ body: BodyOptions;
1370
+ footer?: FooterOptions;
1371
+ expiration_time_ms: number;
1372
+ }
1373
+ interface MediaCardCarouselTemplateOptions {
1374
+ name: string;
1375
+ language: LanguagesEnum;
1376
+ cards: Array<{
1377
+ header: {
1378
+ format: 'IMAGE' | 'VIDEO';
1379
+ example: {
1380
+ header_handle: string[];
1381
+ };
1382
+ };
1383
+ body: BodyOptions;
1384
+ buttons?: ButtonOptions;
1385
+ }>;
1386
+ }
1387
+ interface MPMTemplateOptions {
1388
+ name: string;
1389
+ language: LanguagesEnum;
1390
+ header?: Omit<HeaderOptions, 'format'>;
1391
+ body: BodyOptions;
1392
+ footer?: FooterOptions;
1393
+ thumbnail_product_retailer_id: string;
1394
+ sections: ProductSection[];
1395
+ }
1396
+ interface ProductCardCarouselTemplateOptions {
1397
+ name: string;
1398
+ language: LanguagesEnum;
1399
+ header?: Omit<HeaderOptions, 'format'>;
1400
+ body: BodyOptions;
1401
+ footer?: FooterOptions;
1402
+ cards: Array<{
1403
+ product_retailer_id: string;
1404
+ }>;
1405
+ }
1406
+ interface SPMTemplateOptions {
1407
+ name: string;
1408
+ language: LanguagesEnum;
1409
+ header?: Omit<HeaderOptions, 'format'>;
1410
+ body: BodyOptions;
1411
+ footer?: FooterOptions;
1412
+ product_retailer_id: string;
1413
+ }
1414
+ //#endregion
1415
+ //#region src/api/messages/types/text.d.ts
1416
+ type TextObject = {
1417
+ body: string;
1418
+ preview_url?: boolean;
1419
+ };
1420
+ interface TextMessageParams extends MessageRequestParams<TextObject | string> {
1421
+ previewUrl?: boolean;
1422
+ }
1423
+ //#endregion
1424
+ //#region src/api/messages/types/template.d.ts
1425
+ type LanguageObject = {
1426
+ policy: 'deterministic';
1427
+ code: LanguagesEnum;
1428
+ };
1429
+ type ParametersObject<T extends ParametersTypesEnum> = {
1430
+ type: T;
1431
+ };
1432
+ type SimpleTextObject$1 = {
1433
+ text: string;
1434
+ };
1435
+ type TextParametersObject = ParametersObject<ParametersTypesEnum.Text> & SimpleTextObject$1;
1436
+ type CouponCodeParametersObject = ParametersObject<ParametersTypesEnum.CouponCode> & {
1437
+ coupon_code: string;
1438
+ };
1439
+ type CurrencyObject = {
1440
+ fallback_value: string;
1441
+ code: CurrencyCodesEnum;
1442
+ amount_1000: number;
1443
+ };
1444
+ type CurrencyParametersObject = ParametersObject<ParametersTypesEnum.Currency> & {
1445
+ currency: CurrencyObject;
1446
+ };
1447
+ type DateTimeObject = {
1448
+ fallback_value: string;
1449
+ };
1450
+ type DateTimeParametersObject = ParametersObject<ParametersTypesEnum.Currency> & {
1451
+ date_time: DateTimeObject;
1452
+ };
1453
+ type DocumentMediaObject$2 = {
1454
+ id?: string;
1455
+ link?: string;
1456
+ caption?: string;
1457
+ filename?: string;
1458
+ };
1459
+ type ImageMediaObject$2 = {
1460
+ id?: string;
1461
+ link?: string;
1462
+ caption?: string;
1463
+ };
1464
+ type VideoMediaObject$2 = {
1465
+ id?: string;
1466
+ link?: string;
1467
+ caption?: string;
1468
+ };
1469
+ type DocumentParametersObject = ParametersObject<ParametersTypesEnum.Document> & DocumentMediaObject$2;
1470
+ type ImageParametersObject = ParametersObject<ParametersTypesEnum.Image> & ImageMediaObject$2;
1471
+ type VideoParametersObject = ParametersObject<ParametersTypesEnum.Video> & VideoMediaObject$2;
1472
+ type ComponentObject<T extends ComponentTypesEnum> = {
1473
+ type: T;
1474
+ parameters: (CurrencyParametersObject | DateTimeParametersObject | DocumentParametersObject | ImageParametersObject | TextParametersObject | VideoParametersObject | CouponCodeParametersObject)[];
1475
+ };
1476
+ type ButtonComponentObject = ComponentObject<ComponentTypesEnum.Button> & {
1477
+ parameters?: (TextParametersObject | PayloadParametersObject)[];
1478
+ sub_type: SubTypeEnum;
1479
+ index: ButtonPositionEnum;
1480
+ };
1481
+ type PayloadParametersObject = ParametersObject<ParametersTypesEnum.Payload> & {
1482
+ payload: string;
1483
+ };
1484
+ type MessageTemplateObject<T extends ComponentTypesEnum> = {
1485
+ name: string;
1486
+ language: LanguageObject;
1487
+ components?: (ComponentObject<T> | ButtonComponentObject)[];
1488
+ };
1489
+ //#endregion
1490
+ //#region src/api/messages/types/media.d.ts
1491
+ type MetaMediaObject = {
1492
+ id: string;
1493
+ link?: never;
1494
+ };
1495
+ type HostedMediaObject = {
1496
+ id?: never;
1497
+ link: string;
1498
+ };
1499
+ type AudioMediaObject = MetaMediaObject | HostedMediaObject;
1500
+ type MetaDocumentMediaObject = MetaMediaObject & {
1501
+ caption?: string;
1502
+ filename?: string;
1503
+ };
1504
+ type HostedDocumentMediaObject = HostedMediaObject & {
1505
+ caption?: string;
1506
+ filename?: string;
1507
+ };
1508
+ type DocumentMediaObject = MetaDocumentMediaObject | HostedDocumentMediaObject;
1509
+ type MetaImageMediaObject = MetaMediaObject & {
1510
+ caption?: string;
1511
+ };
1512
+ type HostedImageMediaObject = HostedMediaObject & {
1513
+ caption?: string;
1514
+ };
1515
+ type ImageMediaObject = MetaImageMediaObject | HostedImageMediaObject;
1516
+ type MetaVideoMediaObject = MetaMediaObject & {
1517
+ caption?: string;
1518
+ };
1519
+ type HostedVideoMediaObject = HostedMediaObject & {
1520
+ caption?: string;
1521
+ };
1522
+ type VideoMediaObject = MetaVideoMediaObject | HostedVideoMediaObject;
1523
+ type StickerMediaObject = MetaMediaObject | HostedMediaObject;
1524
+ //#endregion
1525
+ //#region src/api/messages/types/contact.d.ts
1526
+ type AddressesObject = {
1527
+ street?: string;
1528
+ city?: string;
1529
+ state?: string;
1530
+ zip?: string;
1531
+ country?: string;
1532
+ country_code?: string;
1533
+ type?: 'HOME' | 'WORK' | string;
1534
+ };
1535
+ type EmailObject = {
1536
+ email?: string;
1537
+ type?: 'HOME' | 'WORK' | string;
1538
+ };
1539
+ type NameObject = {
1540
+ formatted_name: string;
1541
+ first_name?: string;
1542
+ last_name?: string;
1543
+ middle_name?: string;
1544
+ suffix?: string;
1545
+ prefix?: string;
1546
+ };
1547
+ type OrgObject = {
1548
+ company?: string;
1549
+ department?: string;
1550
+ title?: string;
1551
+ };
1552
+ type PhoneObject = {
1553
+ phone?: 'PHONE_NUMBER';
1554
+ type?: 'CELL' | 'MAIN' | 'IPHONE' | 'HOME' | 'WORK' | string;
1555
+ wa_id?: string;
1556
+ };
1557
+ type URLObject = {
1558
+ url?: string;
1559
+ type?: 'HOME' | 'WORK' | string;
1560
+ };
1561
+ type ContactObject = {
1562
+ addresses?: AddressesObject[];
1563
+ birthday?: `${number}${number}${number}${number}-${number}${number}-${number}${number}`;
1564
+ emails?: EmailObject[];
1565
+ name: NameObject;
1566
+ org?: OrgObject;
1567
+ phones?: PhoneObject[];
1568
+ urls?: URLObject[];
1569
+ };
1570
+ //#endregion
1571
+ //#region src/api/messages/types/location.d.ts
1572
+ type LocationObject = {
1573
+ longitude: number;
1574
+ latitude: number;
1575
+ name?: string;
1576
+ address?: string;
1577
+ };
1578
+ //#endregion
1579
+ //#region src/api/messages/types/interactive.d.ts
1580
+ type DocumentMediaObject$1 = {
1581
+ id?: string;
1582
+ link?: string;
1583
+ caption?: string;
1584
+ filename?: string;
1585
+ };
1586
+ type ImageMediaObject$1 = {
1587
+ id?: string;
1588
+ link?: string;
1589
+ caption?: string;
1590
+ };
1591
+ type VideoMediaObject$1 = {
1592
+ id?: string;
1593
+ link?: string;
1594
+ caption?: string;
1595
+ };
1596
+ type ProductObject = {
1597
+ product_retailer_id: string;
1598
+ };
1599
+ type SimpleTextObject = {
1600
+ text: string;
1601
+ };
1602
+ type RowObject = {
1603
+ id: string;
1604
+ title: string;
1605
+ description?: string;
1606
+ };
1607
+ type MultiProductSectionObject = {
1608
+ product_items: ProductObject[];
1609
+ rows?: never;
1610
+ title?: string;
1611
+ };
1612
+ type ListSectionObject = {
1613
+ product_items?: never;
1614
+ rows: RowObject[];
1615
+ title?: string;
1616
+ };
1617
+ type SectionObject = MultiProductSectionObject | ListSectionObject;
1618
+ type ButtonObject = {
1619
+ title: string;
1620
+ id: string;
1621
+ };
1622
+ type ReplyButtonObject = {
1623
+ type: 'reply';
1624
+ reply: ButtonObject;
1625
+ };
1626
+ type ActionObject = {
1627
+ buttons?: ReplyButtonObject[];
1628
+ catalog_id?: string;
1629
+ product_retailer_id?: string;
1630
+ sections?: SectionObject[];
1631
+ };
1632
+ type HeaderObject = {
1633
+ type: 'document' | 'image' | 'text' | 'video';
1634
+ document?: DocumentMediaObject$1;
1635
+ image?: ImageMediaObject$1;
1636
+ text?: string;
1637
+ video?: VideoMediaObject$1;
1638
+ };
1639
+ type ButtonInteractiveObject = {
1640
+ type: InteractiveTypesEnum.Button;
1641
+ body: SimpleTextObject;
1642
+ footer?: SimpleTextObject;
1643
+ header?: HeaderObject;
1644
+ action: ActionObject;
1645
+ };
1646
+ type ListInteractiveObject = {
1647
+ type: InteractiveTypesEnum.List;
1648
+ body: SimpleTextObject;
1649
+ footer?: SimpleTextObject;
1650
+ header?: HeaderObject;
1651
+ action: ActionObject;
1652
+ };
1653
+ type ProductInteractiveObject = {
1654
+ type: InteractiveTypesEnum.Product;
1655
+ body?: SimpleTextObject;
1656
+ footer?: SimpleTextObject;
1657
+ header?: HeaderObject;
1658
+ action: ActionObject;
1659
+ };
1660
+ type ProductListInteractiveObject = {
1661
+ type: InteractiveTypesEnum.ProductList;
1662
+ body: SimpleTextObject;
1663
+ footer?: SimpleTextObject;
1664
+ header: HeaderObject;
1665
+ action: ActionObject;
1666
+ };
1667
+ type CtaUrlParameters = {
1668
+ display_text: string;
1669
+ url: string;
1670
+ };
1671
+ type CtaUrlActionObject = {
1672
+ name: 'cta_url';
1673
+ parameters: CtaUrlParameters;
1674
+ };
1675
+ type CtaUrlInteractiveObject = {
1676
+ type: InteractiveTypesEnum.CtaUrl;
1677
+ body?: SimpleTextObject;
1678
+ footer?: SimpleTextObject;
1679
+ header?: HeaderObject;
1680
+ action: CtaUrlActionObject;
1681
+ };
1682
+ type LocationRequestActionObject = {
1683
+ name: 'send_location';
1684
+ };
1685
+ type LocationRequestInteractiveObject = {
1686
+ type: InteractiveTypesEnum.LocationRequest;
1687
+ body: SimpleTextObject;
1688
+ footer?: SimpleTextObject;
1689
+ header?: HeaderObject;
1690
+ action: LocationRequestActionObject;
1691
+ };
1692
+ type AddressValues = {
1693
+ name?: string;
1694
+ phone_number?: string;
1695
+ in_pin_code?: string;
1696
+ house_number?: string;
1697
+ floor_number?: string;
1698
+ tower_number?: string;
1699
+ building_name?: string;
1700
+ address?: string;
1701
+ landmark_area?: string;
1702
+ city?: string;
1703
+ state?: string;
1704
+ };
1705
+ type SavedAddress = {
1706
+ id: string;
1707
+ value: AddressValues;
1708
+ };
1709
+ type ValidationErrors = { [key in keyof AddressValues]?: string };
1710
+ type AddressMessageParameters = {
1711
+ country: string;
1712
+ values?: AddressValues;
1713
+ saved_addresses?: SavedAddress[];
1714
+ validation_errors?: ValidationErrors;
1715
+ };
1716
+ type AddressMessageActionObject = {
1717
+ name: 'address_message';
1718
+ parameters: AddressMessageParameters;
1719
+ };
1720
+ type AddressMessageInteractiveObject = {
1721
+ type: InteractiveTypesEnum.AddressMessage;
1722
+ body: SimpleTextObject;
1723
+ footer?: SimpleTextObject;
1724
+ header?: HeaderObject;
1725
+ action: AddressMessageActionObject;
1726
+ };
1727
+ type FlowParameters = {
1728
+ flow_message_version: string;
1729
+ flow_id?: string;
1730
+ flow_name?: string;
1731
+ flow_cta: string;
1732
+ mode?: 'draft' | 'published';
1733
+ flow_token: string;
1734
+ flow_action: 'navigate' | 'data_exchange';
1735
+ flow_action_payload?: {
1736
+ screen?: string;
1737
+ data?: Record<string, string>;
1738
+ };
1739
+ };
1740
+ type FlowActionObject = {
1741
+ name: 'flow';
1742
+ parameters: FlowParameters;
1743
+ };
1744
+ type FlowInteractiveObject = {
1745
+ type: InteractiveTypesEnum.Flow;
1746
+ body: SimpleTextObject;
1747
+ footer?: SimpleTextObject;
1748
+ header?: HeaderObject;
1749
+ action: FlowActionObject;
1750
+ };
1751
+ type InteractiveObject = ButtonInteractiveObject | ListInteractiveObject | ProductInteractiveObject | ProductListInteractiveObject | CtaUrlInteractiveObject | LocationRequestInteractiveObject | AddressMessageInteractiveObject | FlowInteractiveObject;
1752
+ //#endregion
1753
+ //#region src/api/messages/types/reaction.d.ts
1754
+ interface ReactionParams {
1755
+ messageId: string;
1756
+ emoji: string;
1757
+ to: string;
1758
+ }
1759
+ //#endregion
1760
+ //#region src/api/messages/types/common.d.ts
1761
+ type GeneralMessageBody = GeneralRequestBody & {
1762
+ /**
1763
+ * The Meta messaging product name.
1764
+ * @default 'whatsapp'
1765
+ */
1766
+ messaging_product: 'whatsapp';
1767
+ };
1768
+ type ConTextObject = {
1769
+ message_id: string;
1770
+ };
1771
+ type MessageRequestBody<T extends MessageTypesEnum> = GeneralMessageBody & {
1772
+ recipient_type?: string;
1773
+ to: string;
1774
+ context?: ConTextObject;
1775
+ type?: T;
1776
+ };
1777
+ interface MessageRequestParams<T> {
1778
+ body: T;
1779
+ to: string;
1780
+ replyMessageId?: string;
1781
+ }
1782
+ interface StatusParams {
1783
+ status: string;
1784
+ messageId: string;
1785
+ typingIndicator?: {
1786
+ type: string;
1787
+ };
1788
+ }
1789
+ type MessagesResponse = GeneralMessageBody & {
1790
+ contacts: [{
1791
+ input: string;
1792
+ wa_id: string;
1793
+ }];
1794
+ messages: [{
1795
+ id: string;
1796
+ }];
1797
+ };
1798
+ declare class MessagesClass extends BaseClass {
1799
+ text(params: TextMessageParams): Promise<MessagesResponse>;
1800
+ template(params: MessageRequestParams<MessageTemplateObject<ComponentTypesEnum>>): Promise<MessagesResponse>;
1801
+ audio(params: MessageRequestParams<AudioMediaObject>): Promise<MessagesResponse>;
1802
+ document(params: MessageRequestParams<DocumentMediaObject>): Promise<MessagesResponse>;
1803
+ image(params: MessageRequestParams<ImageMediaObject>): Promise<MessagesResponse>;
1804
+ video(params: MessageRequestParams<VideoMediaObject>): Promise<MessagesResponse>;
1805
+ sticker(params: MessageRequestParams<StickerMediaObject>): Promise<MessagesResponse>;
1806
+ contacts(params: MessageRequestParams<[ContactObject]>): Promise<MessagesResponse>;
1807
+ location(params: MessageRequestParams<LocationObject>): Promise<MessagesResponse>;
1808
+ interactive(params: MessageRequestParams<InteractiveObject>): Promise<MessagesResponse>;
1809
+ interactiveList(params: MessageRequestParams<InteractiveObject & {
1810
+ type: InteractiveTypesEnum.List;
1811
+ }>): Promise<MessagesResponse>;
1812
+ interactiveCtaUrl(params: MessageRequestParams<InteractiveObject & {
1813
+ type: InteractiveTypesEnum.CtaUrl;
1814
+ }>): Promise<MessagesResponse>;
1815
+ interactiveLocationRequest(params: MessageRequestParams<InteractiveObject & {
1816
+ type: InteractiveTypesEnum.LocationRequest;
1817
+ }>): Promise<MessagesResponse>;
1818
+ interactiveAddressMessage(params: MessageRequestParams<InteractiveObject & {
1819
+ type: InteractiveTypesEnum.AddressMessage;
1820
+ }>): Promise<MessagesResponse>;
1821
+ interactiveReplyButtons(params: MessageRequestParams<InteractiveObject & {
1822
+ type: InteractiveTypesEnum.Button;
1823
+ }>): Promise<MessagesResponse>;
1824
+ interactiveFlow(params: MessageRequestParams<InteractiveObject & {
1825
+ type: InteractiveTypesEnum.Flow;
1826
+ }>): Promise<MessagesResponse>;
1827
+ reaction(params: ReactionParams): Promise<MessagesResponse>;
1828
+ markAsRead(params: {
1829
+ messageId: string;
1830
+ }): Promise<MessagesResponse>;
1831
+ showTypingIndicator(params: {
1832
+ messageId: string;
1833
+ }): Promise<MessagesResponse>;
1834
+ status(params: StatusParams): Promise<MessagesResponse>;
1835
+ }
1836
+ //#endregion
1837
+ //#region src/api/media/types/common.d.ts
1838
+ type MediaResponse = {
1839
+ id: string;
1840
+ url: string;
1841
+ mime_type: string;
1842
+ sha256: string;
1843
+ file_size: number;
1844
+ messaging_product: 'whatsapp';
1845
+ };
1846
+ type MediasResponse = {
1847
+ data: MediaResponse[];
1848
+ paging: {
1849
+ cursors: {
1850
+ before: string;
1851
+ after: string;
1852
+ };
1853
+ };
1854
+ };
1855
+ type UploadMediaResponse = {
1856
+ id: string;
1857
+ };
1858
+ interface MediaClass {
1859
+ getMediaById(mediaId: string, phone_number_id?: string): Promise<MediaResponse>;
1860
+ uploadMedia(file: File, messagingProduct?: string): Promise<UploadMediaResponse>;
1861
+ deleteMedia(mediaId: string, phone_number_id?: string): Promise<ResponseSuccess>;
1862
+ downloadMedia(mediaUrl: string): Promise<Blob>;
1863
+ }
1864
+ //#endregion
1865
+ //#region src/core/webhook/types.d.ts
1866
+ interface WebhookContact {
1867
+ /**
1868
+ * WhatsApp ID of the contact. Business can respond to this contact using this ID.
1869
+ */
1870
+ wa_id: string;
1871
+ /**
1872
+ * Additional unique, alphanumeric identifier for a WhatsApp user
1873
+ */
1874
+ user_id?: string;
1875
+ /**
1876
+ * Profile of Whatsapp user
1877
+ */
1878
+ profile: {
1879
+ /**
1880
+ * The display name of the contact
1881
+ */
1882
+ name: string;
1883
+ };
1884
+ }
1885
+ /**
1886
+ * Base message interface with common properties
1887
+ */
1888
+ interface BaseMessage {
1889
+ id: string;
1890
+ from: string;
1891
+ timestamp: string;
1892
+ type: MessageTypesEnum;
1893
+ /**
1894
+ * Context object, included when a user replies or interacts
1895
+ */
1896
+ context?: {
1897
+ /**
1898
+ * ID of the message
1899
+ */
1900
+ id?: string;
1901
+ /**
1902
+ * ID of the sender
1903
+ */
1904
+ from?: string;
1905
+ /**
1906
+ * ID of the message being replied to or interacted with
1907
+ */
1908
+ message_id: string;
1909
+ /**
1910
+ * ID of the forwarded message, if applicable
1911
+ */
1912
+ forwarded?: boolean;
1913
+ /**
1914
+ * Frequently forwarded status
1915
+ */
1916
+ frequently_forwarded?: boolean;
1917
+ /**
1918
+ * Original message information if the message was referred
1919
+ */
1920
+ referred_product?: {
1921
+ /**
1922
+ * Catalog ID
1923
+ */
1924
+ catalog_id: string;
1925
+ /**
1926
+ * Product ID
1927
+ */
1928
+ product_retailer_id: string;
1929
+ };
1930
+ };
1931
+ /**
1932
+ * Errors array, if the message had errors
1933
+ */
1934
+ errors?: Array<{
1935
+ /**
1936
+ * Error code
1937
+ */
1938
+ code: number;
1939
+ /**
1940
+ * Error title
1941
+ */
1942
+ title: string;
1943
+ /**
1944
+ * Error message
1945
+ */
1946
+ message: string;
1947
+ /**
1948
+ * Error details object
1949
+ */
1950
+ error_data?: {
1951
+ /**
1952
+ * Describes the error details
1953
+ */
1954
+ details: string;
1955
+ };
1956
+ }>;
1957
+ }
1958
+ /**
1959
+ * Text message interface
1960
+ */
1961
+ interface TextMessage extends BaseMessage {
1962
+ type: MessageTypesEnum.Text;
1963
+ text: {
1964
+ /**
1965
+ * The text content of the message
1966
+ */
1967
+ body: string;
1968
+ preview_url?: boolean;
1969
+ };
1970
+ }
1971
+ /**
1972
+ * Image message interface
1973
+ */
1974
+ interface ImageMessage extends BaseMessage {
1975
+ type: MessageTypesEnum.Image;
1976
+ image: {
1977
+ /**
1978
+ * The image caption (if provided)
1979
+ */
1980
+ caption?: string;
1981
+ /**
1982
+ * The SHA256 hash of the image
1983
+ */
1984
+ sha256?: string;
1985
+ /**
1986
+ * The ID for the image
1987
+ */
1988
+ id: string;
1989
+ /**
1990
+ * The MIME type of the image
1991
+ */
1992
+ mime_type: string;
1993
+ };
1994
+ }
1995
+ /**
1996
+ * Video message interface
1997
+ */
1998
+ interface VideoMessage extends BaseMessage {
1999
+ type: MessageTypesEnum.Video;
2000
+ video: {
2001
+ /**
2002
+ * The video caption (if provided)
2003
+ */
2004
+ caption?: string;
2005
+ /**
2006
+ * The SHA256 hash of the video
2007
+ */
2008
+ sha256?: string;
2009
+ /**
2010
+ * The ID for the video
2011
+ */
2012
+ id: string;
2013
+ /**
2014
+ * The MIME type of the video
2015
+ */
2016
+ mime_type: string;
2017
+ };
2018
+ }
2019
+ /**
2020
+ * Audio message interface
2021
+ */
2022
+ interface AudioMessage extends BaseMessage {
2023
+ type: MessageTypesEnum.Audio;
2024
+ audio: {
2025
+ /**
2026
+ * The ID for the audio file
2027
+ */
2028
+ id: string;
2029
+ /**
2030
+ * The MIME type of the audio file
2031
+ */
2032
+ mime_type: string;
2033
+ /**
2034
+ * Whether the audio is a voice message
2035
+ */
2036
+ voice?: boolean;
2037
+ };
2038
+ }
2039
+ /**
2040
+ * Document message interface
2041
+ */
2042
+ interface DocumentMessage extends BaseMessage {
2043
+ type: MessageTypesEnum.Document;
2044
+ document: {
2045
+ /**
2046
+ * The document caption (if provided)
2047
+ */
2048
+ caption?: string;
2049
+ /**
2050
+ * The document filename
2051
+ */
2052
+ filename: string;
2053
+ /**
2054
+ * The SHA256 hash of the document
2055
+ */
2056
+ sha256?: string;
2057
+ /**
2058
+ * The ID for the document
2059
+ */
2060
+ id: string;
2061
+ /**
2062
+ * The MIME type of the document
2063
+ */
2064
+ mime_type: string;
2065
+ };
2066
+ }
2067
+ /**
2068
+ * Sticker message interface
2069
+ */
2070
+ interface StickerMessage extends BaseMessage {
2071
+ type: MessageTypesEnum.Sticker;
2072
+ sticker: {
2073
+ /**
2074
+ * The ID for the sticker
2075
+ */
2076
+ id: string;
2077
+ /**
2078
+ * Whether this is an animated sticker
2079
+ */
2080
+ animated: boolean;
2081
+ /**
2082
+ * The MIME type of the sticker
2083
+ */
2084
+ mime_type: string;
2085
+ };
2086
+ }
2087
+ /**
2088
+ * Reaction message interface
2089
+ */
2090
+ interface ReactionMessage extends BaseMessage {
2091
+ type: MessageTypesEnum.Reaction;
2092
+ reaction: {
2093
+ /**
2094
+ * The ID of the message being reacted to
2095
+ */
2096
+ message_id: string;
2097
+ /**
2098
+ * Emoji used for the reaction
2099
+ */
2100
+ emoji: string;
2101
+ };
2102
+ }
2103
+ /**
2104
+ * Contacts message interface
2105
+ */
2106
+ interface ContactsMessage extends BaseMessage {
2107
+ type: MessageTypesEnum.Contacts;
2108
+ contacts: Array<{
2109
+ /**
2110
+ * The contact's name
2111
+ */
2112
+ name: {
2113
+ /**
2114
+ * The formatted name
2115
+ */
2116
+ formatted_name: string;
2117
+ /**
2118
+ * The first name
2119
+ */
2120
+ first_name?: string;
2121
+ /**
2122
+ * The last name
2123
+ */
2124
+ last_name?: string;
2125
+ /**
2126
+ * The middle name
2127
+ */
2128
+ middle_name?: string;
2129
+ /**
2130
+ * The suffix
2131
+ */
2132
+ suffix?: string;
2133
+ /**
2134
+ * The prefix
2135
+ */
2136
+ prefix?: string;
2137
+ };
2138
+ /**
2139
+ * The contact's phone numbers
2140
+ */
2141
+ phones?: Array<{
2142
+ phone: string;
2143
+ type?: string;
2144
+ wa_id?: string;
2145
+ }>;
2146
+ /**
2147
+ * The contact's emails
2148
+ */
2149
+ emails?: Array<{
2150
+ email: string;
2151
+ type?: string;
2152
+ }>;
2153
+ /**
2154
+ * The contact's addresses
2155
+ */
2156
+ addresses?: Array<{
2157
+ street?: string;
2158
+ city?: string;
2159
+ state?: string;
2160
+ zip?: string;
2161
+ country?: string;
2162
+ country_code?: string;
2163
+ type?: string;
2164
+ }>;
2165
+ /**
2166
+ * The contact's organizations
2167
+ */
2168
+ org?: {
2169
+ company?: string;
2170
+ department?: string;
2171
+ title?: string;
2172
+ };
2173
+ /**
2174
+ * The contact's URLs
2175
+ */
2176
+ urls?: Array<{
2177
+ url: string;
2178
+ type?: string;
2179
+ }>;
2180
+ /**
2181
+ * The contact's birthday (YYYY-MM-DD format)
2182
+ */
2183
+ birthday?: string;
2184
+ }>;
2185
+ }
2186
+ /**
2187
+ * Location message interface
2188
+ */
2189
+ interface LocationMessage extends BaseMessage {
2190
+ type: MessageTypesEnum.Location;
2191
+ location: {
2192
+ /**
2193
+ * Latitude of the location
2194
+ */
2195
+ latitude: number;
2196
+ /**
2197
+ * Longitude of the location
2198
+ */
2199
+ longitude: number;
2200
+ /**
2201
+ * Name of the location
2202
+ */
2203
+ name?: string;
2204
+ /**
2205
+ * Address of the location
2206
+ */
2207
+ address?: string;
2208
+ };
2209
+ }
2210
+ /**
2211
+ * Interactive message interface
2212
+ */
2213
+ interface InteractiveMessage extends BaseMessage {
2214
+ type: MessageTypesEnum.Interactive;
2215
+ interactive: {
2216
+ /**
2217
+ * Type of the interactive message
2218
+ * Can be: button_reply, list_reply, flow, nfm_reply, etc.
2219
+ */
2220
+ type: string;
2221
+ /**
2222
+ * ID for the button that was clicked
2223
+ */
2224
+ button_reply?: {
2225
+ id: string;
2226
+ title: string;
2227
+ };
2228
+ /**
2229
+ * ID for the list item that was selected
2230
+ */
2231
+ list_reply?: {
2232
+ id: string;
2233
+ title: string;
2234
+ description?: string;
2235
+ };
2236
+ /**
2237
+ * NFM (No-Code Flow Message) reply data
2238
+ */
2239
+ nfm_reply?: {
2240
+ /**
2241
+ * Response data in JSON format
2242
+ */
2243
+ response_json: string;
2244
+ /**
2245
+ * Body text of the reply
2246
+ */
2247
+ body: string;
2248
+ /**
2249
+ * Name of the flow
2250
+ */
2251
+ name: string;
2252
+ };
2253
+ };
2254
+ }
2255
+ /**
2256
+ * System message interface
2257
+ */
2258
+ interface SystemMessage extends BaseMessage {
2259
+ type: MessageTypesEnum.System;
2260
+ system: {
2261
+ /**
2262
+ * The type of system update
2263
+ */
2264
+ type: string;
2265
+ /**
2266
+ * User's identity if the update is a customer identity change
2267
+ */
2268
+ identity?: string;
2269
+ /**
2270
+ * Old and new phone numbers if the update is a phone number change
2271
+ */
2272
+ customer?: {
2273
+ /**
2274
+ * The previous phone number
2275
+ */
2276
+ previous_wa_id: string;
2277
+ /**
2278
+ * The new phone number
2279
+ */
2280
+ wa_id: string;
2281
+ };
2282
+ };
2283
+ }
2284
+ /**
2285
+ * Order message interface
2286
+ */
2287
+ interface OrderMessage extends BaseMessage {
2288
+ type: MessageTypesEnum.Order;
2289
+ order: {
2290
+ /**
2291
+ * Catalog ID
2292
+ */
2293
+ catalog_id: string;
2294
+ /**
2295
+ * Product items in the order
2296
+ */
2297
+ product_items: Array<{
2298
+ /**
2299
+ * Product ID
2300
+ */
2301
+ product_retailer_id: string;
2302
+ /**
2303
+ * Quantity of the product
2304
+ */
2305
+ quantity: number;
2306
+ /**
2307
+ * Item price
2308
+ */
2309
+ item_price: number;
2310
+ /**
2311
+ * Currency code
2312
+ */
2313
+ currency: string;
2314
+ }>;
2315
+ /**
2316
+ * Text message included with the order
2317
+ */
2318
+ text?: string;
2319
+ };
2320
+ }
2321
+ /**
2322
+ * Button message interface
2323
+ */
2324
+ interface ButtonMessage extends BaseMessage {
2325
+ type: MessageTypesEnum.Button;
2326
+ button: {
2327
+ /**
2328
+ * The payload for the button
2329
+ */
2330
+ payload: string;
2331
+ /**
2332
+ * Button text
2333
+ */
2334
+ text: string;
2335
+ };
2336
+ }
2337
+ /**
2338
+ * Union type for all message types
2339
+ */
2340
+
2341
+ /**
2342
+ * Represents a message received through the webhook
2343
+ * Based on Meta's documentation: https://developers.facebook.com/docs/whatsapp/cloud-api/webhooks/components#messages-object
2344
+ */
2345
+ interface WebhookMessage {
2346
+ /**
2347
+ * The WhatsApp Business Account ID
2348
+ */
2349
+ wabaId: string;
2350
+ /**
2351
+ * The message ID
2352
+ */
2353
+ id: string;
2354
+ /**
2355
+ * The sender's phone number
2356
+ */
2357
+ from: string;
2358
+ /**
2359
+ * The timestamp of the message
2360
+ */
2361
+ timestamp: string;
2362
+ /**
2363
+ * The type of message (text, image, etc.)
2364
+ */
2365
+ type: MessageTypesEnum;
2366
+ /**
2367
+ * The phone number ID that received the message
2368
+ */
2369
+ phoneNumberId: string;
2370
+ /**
2371
+ * The display phone number that received the message
2372
+ */
2373
+ displayPhoneNumber: string;
2374
+ /**
2375
+ * The profile name of the sender
2376
+ */
2377
+ profileName: string;
2378
+ text?: TextMessage['text'];
2379
+ image?: ImageMessage['image'];
2380
+ video?: VideoMessage['video'];
2381
+ audio?: AudioMessage['audio'];
2382
+ document?: DocumentMessage['document'];
2383
+ sticker?: StickerMessage['sticker'];
2384
+ location?: LocationMessage['location'];
2385
+ contacts?: ContactsMessage['contacts'];
2386
+ interactive?: InteractiveMessage['interactive'];
2387
+ button?: ButtonMessage['button'];
2388
+ order?: OrderMessage['order'];
2389
+ system?: SystemMessage['system'];
2390
+ reaction?: ReactionMessage['reaction'];
2391
+ statuses?: {
2392
+ /**
2393
+ * Arbitrary string included in sent message
2394
+ */
2395
+ biz_opaque_callback_data?: string;
2396
+ /**
2397
+ * Information about the conversation
2398
+ */
2399
+ conversation?: {
2400
+ /**
2401
+ * Represents the ID of the conversation the given status notification belongs to
2402
+ */
2403
+ id: string;
2404
+ /**
2405
+ * Describes conversation category
2406
+ */
2407
+ origin: {
2408
+ /**
2409
+ * Indicates conversation category. This can also be referred to as a conversation entry point
2410
+ * - authentication: Conversation opened by business sending template categorized as AUTHENTICATION
2411
+ * - marketing: Conversation opened by business sending template categorized as MARKETING
2412
+ * - utility: Conversation opened by business sending template categorized as UTILITY
2413
+ * - service: Conversation opened by business replying to customer within service window
2414
+ * - referral_conversion: Free entry point conversation
2415
+ */
2416
+ type: 'authentication' | 'marketing' | 'utility' | 'service' | 'referral_conversion';
2417
+ };
2418
+ /**
2419
+ * Date when the conversation expires. Only present for messages with status 'sent'
2420
+ */
2421
+ expiration_timestamp?: string;
2422
+ };
2423
+ /**
2424
+ * Array of error objects describing the error
2425
+ */
2426
+ errors?: Array<{
2427
+ /**
2428
+ * Error code
2429
+ */
2430
+ code: number;
2431
+ /**
2432
+ * Error code title
2433
+ */
2434
+ title: string;
2435
+ /**
2436
+ * Error code message
2437
+ */
2438
+ message: string;
2439
+ /**
2440
+ * Error details object
2441
+ */
2442
+ error_data?: {
2443
+ /**
2444
+ * Describes the error details
2445
+ */
2446
+ details: string;
2447
+ };
2448
+ }>;
2449
+ /**
2450
+ * The ID for the message that the business sent to a customer
2451
+ */
2452
+ id: string;
2453
+ /**
2454
+ * Pricing information for the message/conversation
2455
+ */
2456
+ pricing?: {
2457
+ /**
2458
+ * Indicates if the given message or conversation is billable
2459
+ * @deprecated This field is deprecated. Visit the WhatsApp Changelog for more information.
2460
+ */
2461
+ billable?: boolean;
2462
+ /**
2463
+ * Indicates the conversation category:
2464
+ * - authentication: Authentication conversation
2465
+ * - authentication_international: Authentication-international conversation
2466
+ * - marketing: Marketing conversation
2467
+ * - utility: Utility conversation
2468
+ * - service: Service conversation
2469
+ * - referral_conversion: Free entry point conversation
2470
+ */
2471
+ category: 'authentication' | 'authentication_international' | 'marketing' | 'utility' | 'service' | 'referral_conversion';
2472
+ /**
2473
+ * Type of pricing model used by the business. Current supported value is CBP
2474
+ */
2475
+ pricing_model: 'CBP';
2476
+ };
2477
+ /**
2478
+ * The customer's WhatsApp ID. Business can respond to customer using this ID.
2479
+ * This ID may not match the customer's phone number.
2480
+ */
2481
+ recipient_id: string;
2482
+ /**
2483
+ * Status of the message:
2484
+ * - delivered: Message has been delivered
2485
+ * - read: Message has been read by the customer
2486
+ * - sent: Message has been sent to the customer
2487
+ */
2488
+ status: 'delivered' | 'read' | 'sent';
2489
+ /**
2490
+ * Unix timestamp for the status message
2491
+ */
2492
+ timestamp: string;
2493
+ };
2494
+ /**
2495
+ * The original message data as received from the webhook
2496
+ */
2497
+ originalData: any;
2498
+ }
2499
+ /**
2500
+ * Webhook event received from WhatsApp
2501
+ */
2502
+ interface WebhookEvent {
2503
+ /**
2504
+ * The field type of the event
2505
+ */
2506
+ field: string;
2507
+ /**
2508
+ * The event data
2509
+ */
2510
+ value: any;
2511
+ /**
2512
+ * The timestamp when the event was received
2513
+ */
2514
+ timestamp: number;
2515
+ }
2516
+ /**
2517
+ * Message handler function type
2518
+ */
2519
+ //#endregion
2520
+ //#region src/api/qrCode/types/common.d.ts
2521
+ type QrCodeResponse = {
2522
+ code: string;
2523
+ prefilled_message: string;
2524
+ deep_link_url: string;
2525
+ qr_image_url?: string;
2526
+ };
2527
+ type QrCodesResponse = ResponseData<QrCodeResponse[]>;
2528
+ type CreateQrCodeRequest = {
2529
+ prefilled_message: string;
2530
+ generate_qr_image?: 'SVG' | 'PNG';
2531
+ };
2532
+ type UpdateQrCodeRequest = {
2533
+ code: string;
2534
+ prefilled_message: string;
2535
+ };
2536
+ interface QrCodeClass {
2537
+ createQrCode(request: CreateQrCodeRequest): Promise<QrCodeResponse>;
2538
+ getQrCodes(): Promise<QrCodesResponse>;
2539
+ getQrCode(qrCodeId: string): Promise<QrCodeResponse>;
2540
+ updateQrCode(request: UpdateQrCodeRequest): Promise<QrCodeResponse>;
2541
+ deleteQrCode(qrCodeId: string): Promise<ResponseSuccess>;
2542
+ }
2543
+ //#endregion
2544
+ //#region src/api/waba/types/common.d.ts
2545
+ /**
2546
+ * WhatsApp Business Account subscription configuration
2547
+ */
2548
+ type WabaSubscription = {
2549
+ whatsapp_business_api_data: {
2550
+ id: string;
2551
+ link: string;
2552
+ name: string;
2553
+ category: string;
2554
+ };
2555
+ override_callback_uri?: string;
2556
+ };
2557
+ /**
2558
+ * Parameters for updating WABA subscription
2559
+ */
2560
+ interface UpdateWabaSubscription {
2561
+ override_callback_uri: string;
2562
+ verify_token: string;
2563
+ }
2564
+ /**
2565
+ * Response containing all WABA subscriptions
2566
+ */
2567
+ interface WabaSubscriptions {
2568
+ data: Array<WabaSubscription>;
2569
+ }
2570
+ /**
2571
+ * WABA account review status enumeration
2572
+ */
2573
+ declare enum WabaAccountReviewStatus {
2574
+ Approved = "APPROVED",
2575
+ Active = "ACTIVE",
2576
+ Inactive = "INACTIVE",
2577
+ Disabled = "DISABLED",
2578
+ }
2579
+ /**
2580
+ * WABA health status for message sending capability
2581
+ */
2582
+ declare enum WabaHealthStatusCanSendMessage {
2583
+ Blocked = "BLOCKED",
2584
+ Limited = "LIMITED",
2585
+ Available = "AVAILABLE",
2586
+ }
2587
+ /**
2588
+ * WABA account status enumeration
2589
+ */
2590
+ declare enum WabaAccountStatus {
2591
+ Approved = "APPROVED",
2592
+ Active = "ACTIVE",
2593
+ Inactive = "INACTIVE",
2594
+ Disabled = "DISABLED",
2595
+ }
2596
+ /**
2597
+ * Business verification status enumeration
2598
+ */
2599
+ declare enum WabaBusinessVerificationStatus {
2600
+ Verified = "verified",
2601
+ PendingSubmission = "pending_submission",
2602
+ Unverified = "unverified",
2603
+ Rejected = "rejected",
2604
+ }
2605
+ /**
2606
+ * WABA health status error details
2607
+ */
2608
+ interface WabaHealthStatusError {
2609
+ error_code?: number;
2610
+ error_description?: string;
2611
+ possible_solution?: string;
2612
+ }
2613
+ /**
2614
+ * WABA health status entity information
2615
+ */
2616
+ interface WabaHealthStatusEntity {
2617
+ entity_type?: string;
2618
+ id?: string;
2619
+ can_send_message?: string;
2620
+ errors?: WabaHealthStatusError[];
2621
+ }
2622
+ /**
2623
+ * Overall WABA health status
2624
+ */
2625
+ interface WabaHealthStatus {
2626
+ can_send_message?: WabaHealthStatusCanSendMessage;
2627
+ entities?: WabaHealthStatusEntity[];
2628
+ }
2629
+ /**
2630
+ * WhatsApp Business Account information
2631
+ */
2632
+ interface WabaAccount {
2633
+ account_review_status?: WabaAccountReviewStatus;
2634
+ id?: string;
2635
+ health_status?: WabaHealthStatus;
2636
+ status?: WabaAccountStatus;
2637
+ business_verification_status?: WabaBusinessVerificationStatus;
2638
+ message_template_namespace?: string;
2639
+ name?: string;
2640
+ ownership_type?: string;
2641
+ currency?: string;
2642
+ }
2643
+ /**
2644
+ * Available fields for WABA account queries
2645
+ */
2646
+ type WabaAccountFields = 'id' | 'name' | 'account_review_status' | 'auth_international_rate_eligibility' | 'business_verification_status' | 'country' | 'currency' | 'health_status' | 'status' | 'ownership_type' | 'message_template_namespace';
2647
+ /**
2648
+ * Parameter type for specifying which WABA account fields to retrieve
2649
+ */
2650
+ type WabaAccountFieldsParam = WabaAccountFields[];
2651
+ /**
2652
+ * Interface defining all WABA API methods
2653
+ */
2654
+ interface WABAClass {
2655
+ getWabaAccount(fields?: WabaAccountFieldsParam): Promise<WabaAccount>;
2656
+ getAllWabaSubscriptions(): Promise<WabaSubscriptions>;
2657
+ updateWabaSubscription(params: UpdateWabaSubscription): Promise<ResponseSuccess>;
2658
+ unsubscribeFromWaba(): Promise<ResponseSuccess>;
2659
+ }
2660
+ //#endregion
2661
+ //#region src/utils/isMetaError.d.ts
2662
+ interface MetaError extends Error {
2663
+ error: {
2664
+ message: string;
2665
+ type: string;
2666
+ code: number;
2667
+ error_data?: {
2668
+ messaging_product: 'whatsapp';
2669
+ details: string;
2670
+ };
2671
+ error_subcode?: number;
2672
+ fbtrace_id: string;
2673
+ };
2674
+ }
2675
+ /**
2676
+ * Determines if the error is a Meta API error response
2677
+ * @param error Any error object to check
2678
+ * @returns Type guard indicating if error is a Meta API error
2679
+ */
2680
+ //#endregion
2681
+ //#region src/api/flow/types/common.d.ts
2682
+ /**
2683
+ * Enum for Flow Status
2684
+ */
2685
+ declare enum FlowStatusEnum {
2686
+ Draft = "DRAFT",
2687
+ Published = "PUBLISHED",
2688
+ Throttled = "THROTTLED",
2689
+ Blocked = "BLOCKED",
2690
+ Deprecated = "DEPRECATED",
2691
+ }
2692
+ /**
2693
+ * Enum for Flow Categories
2694
+ */
2695
+ declare enum FlowCategoryEnum {
2696
+ SignUp = "SIGN_UP",
2697
+ SignIn = "SIGN_IN",
2698
+ AppointmentBooking = "APPOINTMENT_BOOKING",
2699
+ LeadGeneration = "LEAD_GENERATION",
2700
+ ContactUs = "CONTACT_US",
2701
+ CustomerSupport = "CUSTOMER_SUPPORT",
2702
+ Survey = "SURVEY",
2703
+ Other = "OTHER",
2704
+ }
2705
+ declare enum FlowActionEnum {
2706
+ INIT = "INIT",
2707
+ BACK = "BACK",
2708
+ DATA_EXCHANGE = "data_exchange",
2709
+ }
2710
+ /**
2711
+ * Enum for Flow Types in webhook handlers
2712
+ * Used to register handlers for specific flow events
2713
+ */
2714
+ declare enum FlowTypeEnum {
2715
+ /** Health check/ping requests */
2716
+ Ping = "ping",
2717
+ /** Data exchange requests */
2718
+ Change = "data_exchange",
2719
+ /** Error notification requests */
2720
+ Error = "error",
2721
+ /** Match all flow action types */
2722
+ All = "*",
2723
+ }
2724
+ type FlowType = (typeof FlowTypeEnum)[keyof typeof FlowTypeEnum];
2725
+ /**
2726
+ * Flow Validation Error Pointer
2727
+ */
2728
+ interface FlowValidationErrorPointer {
2729
+ line_start: number;
2730
+ line_end: number;
2731
+ column_start: number;
2732
+ column_end: number;
2733
+ path: string;
2734
+ }
2735
+ /**
2736
+ * Flow Validation Error
2737
+ */
2738
+ interface FlowValidationError {
2739
+ error: string;
2740
+ error_type: string;
2741
+ message: string;
2742
+ line_start: number;
2743
+ line_end: number;
2744
+ column_start: number;
2745
+ column_end: number;
2746
+ pointers: FlowValidationErrorPointer[];
2747
+ }
2748
+ /**
2749
+ * Flow Item
2750
+ */
2751
+ interface Flow {
2752
+ id: string;
2753
+ name: string;
2754
+ status: FlowStatusEnum;
2755
+ categories: FlowCategoryEnum[];
2756
+ validation_errors: FlowValidationError[];
2757
+ }
2758
+ /**
2759
+ * Pagination Cursors
2760
+ */
2761
+ interface PaginationCursors {
2762
+ before: string;
2763
+ after: string;
2764
+ }
2765
+ /**
2766
+ * Pagination Object
2767
+ */
2768
+ interface Pagination {
2769
+ cursors: PaginationCursors;
2770
+ }
2771
+ /**
2772
+ * Flows List Response
2773
+ */
2774
+ interface FlowsListResponse {
2775
+ data: Flow[];
2776
+ paging: Pagination;
2777
+ }
2778
+ /**
2779
+ * Flow Asset
2780
+ */
2781
+ interface FlowAsset {
2782
+ name: string;
2783
+ asset_type: string;
2784
+ download_url: string;
2785
+ }
2786
+ /**
2787
+ * Flow Assets Response
2788
+ */
2789
+ interface FlowAssetsResponse {
2790
+ data: FlowAsset[];
2791
+ paging: Pagination;
2792
+ }
2793
+ /**
2794
+ * Flow Preview
2795
+ */
2796
+ interface FlowPreview {
2797
+ preview_url: string;
2798
+ expires_at: string;
2799
+ }
2800
+ /**
2801
+ * Flow Preview Response
2802
+ */
2803
+ interface FlowPreviewResponse {
2804
+ preview: FlowPreview;
2805
+ id: string;
2806
+ }
2807
+ /**
2808
+ * Flow Migration Result
2809
+ */
2810
+ interface FlowMigrationResult {
2811
+ source_name: string;
2812
+ source_id: string;
2813
+ migrated_id: string;
2814
+ }
2815
+ /**
2816
+ * Flow Migration Failure
2817
+ */
2818
+ interface FlowMigrationFailure {
2819
+ source_name: string;
2820
+ error_code: string;
2821
+ error_message: string;
2822
+ }
2823
+ /**
2824
+ * Create Flow Response
2825
+ */
2826
+ interface CreateFlowResponse {
2827
+ id: string;
2828
+ success: boolean;
2829
+ validation_errors?: FlowValidationError[];
2830
+ }
2831
+ /**
2832
+ * Update Flow Response
2833
+ */
2834
+ interface UpdateFlowResponse {
2835
+ success: boolean;
2836
+ validation_errors?: FlowValidationError[];
2837
+ }
2838
+ /**
2839
+ * Flow Migration Response
2840
+ */
2841
+ interface FlowMigrationResponse {
2842
+ migrated_flows: FlowMigrationResult[];
2843
+ failed_flows: FlowMigrationFailure[];
2844
+ }
2845
+ /**
2846
+ * Validate Flow JSON Response
2847
+ */
2848
+ interface ValidateFlowJsonResponse {
2849
+ valid: boolean;
2850
+ success: boolean;
2851
+ validation_errors?: FlowValidationError[];
2852
+ }
2853
+ /**
2854
+ * WhatsApp Flow Endpoint - Encrypted Request Payload
2855
+ * Represents the raw encrypted data received from WhatsApp
2856
+ */
2857
+ interface FlowEncryptedRequestPayload {
2858
+ encrypted_aes_key: string;
2859
+ encrypted_flow_data: string;
2860
+ initial_vector: string;
2861
+ }
2862
+ /**
2863
+ * WhatsApp Flow Endpoint - Decrypted Request Response
2864
+ * Represents the successfully decrypted data and encryption keys
2865
+ */
2866
+ interface FlowDecryptedRequestResponse {
2867
+ decryptedBody: any;
2868
+ aesKeyBuffer: Buffer;
2869
+ initialVectorBuffer: Buffer;
2870
+ }
2871
+ /**
2872
+ * WhatsApp Flow Endpoint - HTTP Request with Body
2873
+ * Represents an HTTP request with the encrypted payload
2874
+ */
2875
+ interface FlowHttpRequest extends IncomingMessage {
2876
+ body: FlowEncryptedRequestPayload;
2877
+ headers: IncomingHttpHeaders;
2878
+ }
2879
+ /**
2880
+ * WhatsApp Flow Endpoint - Health Check Request
2881
+ * Represents the structure of a health check request
2882
+ */
2883
+ interface FlowHealthCheckRequest {
2884
+ action: 'ping';
2885
+ version: '3.0';
2886
+ }
2887
+ /**
2888
+ * WhatsApp Flow Endpoint - Health Check Response
2889
+ * The expected response structure for health check requests
2890
+ */
2891
+ interface FlowHealthCheckResponse {
2892
+ data: {
2893
+ status: 'active';
2894
+ };
2895
+ }
2896
+ /**
2897
+ * WhatsApp Flow Endpoint - Data Exchange Request
2898
+ * Represents the structure of a data exchange request
2899
+ */
2900
+ interface FlowDataExchangeRequest {
2901
+ version: '3.0';
2902
+ action: FlowActionEnum;
2903
+ screen: string;
2904
+ flow_token: string;
2905
+ data?: Record<string, any> & {
2906
+ error_message?: string;
2907
+ };
2908
+ }
2909
+ /**
2910
+ * WhatsApp Flow Endpoint - Data Exchange Response
2911
+ * The expected response structure for data exchange requests
2912
+ */
2913
+ interface FlowDataExchangeResponse {
2914
+ screen?: string;
2915
+ data?: Record<string, any | {
2916
+ error_message?: string;
2917
+ }>;
2918
+ }
2919
+ /**
2920
+ * WhatsApp Flow Endpoint - Success Screen Response
2921
+ * The expected response structure for success screen requests
2922
+ */
2923
+ interface FlowSuccessScreenResponse {
2924
+ screen: 'SUCCESS';
2925
+ data: {
2926
+ extension_message_response?: {
2927
+ params?: {
2928
+ flow_token: string;
2929
+ [key: string]: string;
2930
+ };
2931
+ };
2932
+ };
2933
+ }
2934
+ /**
2935
+ * WhatsApp Flow Endpoint - Error Notification Request
2936
+ * Represents the structure of an error notification request
2937
+ */
2938
+ interface FlowErrorNotificationRequest {
2939
+ version: '3.0';
2940
+ action: Exclude<FlowActionEnum, FlowActionEnum.BACK>;
2941
+ screen: string;
2942
+ flow_token: string;
2943
+ data: {
2944
+ error: string;
2945
+ error_message: string;
2946
+ };
2947
+ }
2948
+ /**
2949
+ * WhatsApp Flow Endpoint - Error Notification Response
2950
+ * The expected response structure for error notification requests
2951
+ */
2952
+ interface FlowErrorNotificationResponse {
2953
+ acknowledged: boolean;
2954
+ }
2955
+ /**
2956
+ * WhatsApp Flow Endpoint - Comprehensive Request Object
2957
+ * A combined type that includes all possible fields from different request types
2958
+ * with all fields being optional for flexibility
2959
+ */
2960
+ interface FlowEndpointRequest {
2961
+ version?: '3.0';
2962
+ action?: 'ping' | FlowActionEnum;
2963
+ screen?: string;
2964
+ flow_token?: string;
2965
+ data?: Record<string, any> & {
2966
+ error_key?: string;
2967
+ error_message?: string;
2968
+ };
2969
+ }
2970
+ /**
2971
+ * WhatsApp Flow Endpoint - Response
2972
+ * Union type for all possible response types from a Flow endpoint
2973
+ */
2974
+ type FlowEndpointResponse = FlowHealthCheckResponse | FlowDataExchangeResponse | FlowErrorNotificationResponse | FlowSuccessScreenResponse;
2975
+ interface FlowClass {
2976
+ /**
2977
+ * List Flows
2978
+ *
2979
+ * @param wabaId - The WABA ID
2980
+ * @returns Promise with the list of flows
2981
+ */
2982
+ listFlows(wabaId: string): Promise<FlowsListResponse>;
2983
+ /**
2984
+ * Create Flow
2985
+ *
2986
+ * @param wabaId - The WABA ID
2987
+ * @param data - The flow data including name, categories, endpoint_uri, and optional clone_flow_id
2988
+ * @returns Promise with the created flow ID
2989
+ */
2990
+ createFlow(wabaId: string, data: {
2991
+ name: string;
2992
+ categories?: FlowCategoryEnum[];
2993
+ endpoint_uri?: string;
2994
+ clone_flow_id?: string;
2995
+ flow_json?: string;
2996
+ publish?: boolean;
2997
+ }): Promise<CreateFlowResponse>;
2998
+ /**
2999
+ * Get Flow
3000
+ *
3001
+ * @param flowId - The flow ID
3002
+ * @param fields - Optional fields to return
3003
+ * @param dateFormat - Optional date format
3004
+ * @returns Promise with the flow details
3005
+ */
3006
+ getFlow(flowId: string, fields?: string, dateFormat?: string): Promise<Flow | FlowPreviewResponse>;
3007
+ /**
3008
+ * Update Flow Metadata
3009
+ *
3010
+ * @param flowId - The flow ID
3011
+ * @param data - The flow metadata to update
3012
+ * @returns Promise with the success status
3013
+ */
3014
+ updateFlowMetadata(flowId: string, data: {
3015
+ name?: string;
3016
+ categories?: FlowCategoryEnum[];
3017
+ endpoint_uri?: string;
3018
+ application_id?: string;
3019
+ }): Promise<ResponseSuccess>;
3020
+ /**
3021
+ * Delete Flow
3022
+ *
3023
+ * @param flowId - The flow ID
3024
+ * @returns Promise with the success status
3025
+ */
3026
+ deleteFlow(flowId: string): Promise<ResponseSuccess>;
3027
+ /**
3028
+ * List Assets (Get Flow JSON URL)
3029
+ *
3030
+ * @param flowId - The flow ID
3031
+ * @returns Promise with the list of assets
3032
+ */
3033
+ listAssets(flowId: string): Promise<FlowAssetsResponse>;
3034
+ /**
3035
+ * Update Flow JSON
3036
+ *
3037
+ * @param flowId - The flow ID
3038
+ * @param data - The asset data including asset_type, file, and name
3039
+ * @returns Promise with the success status and validation errors
3040
+ */
3041
+ updateFlowJson(flowId: string, data: {
3042
+ file: Blob | Buffer | object;
3043
+ name?: string;
3044
+ }): Promise<UpdateFlowResponse>;
3045
+ /**
3046
+ * Validate Flow JSON by attempting an update without publishing.
3047
+ * This is a convenience method; the API doesn't have a dedicated validation endpoint.
3048
+ *
3049
+ * @param flowId - The ID of the Flow (must exist, can be in DRAFT status).
3050
+ * @param flowJsonData - The Flow JSON content as a Buffer, JSON object, or Blob.
3051
+ * @returns Promise indicating if the JSON is valid and includes validation errors if any.
3052
+ */
3053
+ validateFlowJson(flowId: string, flowJsonData: Blob | Buffer | object): Promise<ValidateFlowJsonResponse>;
3054
+ /**
3055
+ * Publish Flow
3056
+ *
3057
+ * @param flowId - The flow ID
3058
+ * @returns Promise with the success status
3059
+ */
3060
+ publishFlow(flowId: string): Promise<ResponseSuccess>;
3061
+ /**
3062
+ * Deprecate Flow
3063
+ *
3064
+ * @param flowId - The flow ID
3065
+ * @returns Promise with the success status
3066
+ */
3067
+ deprecateFlow(flowId: string): Promise<ResponseSuccess>;
3068
+ /**
3069
+ * Migrate Flows
3070
+ *
3071
+ * @param wabaId - The destination WABA ID
3072
+ * @param data - The migration data including source_waba_id and optional source_flow_names
3073
+ * @returns Promise with migration results
3074
+ */
3075
+ migrateFlows(wabaId: string, data: {
3076
+ source_waba_id: string;
3077
+ source_flow_names?: string[];
3078
+ }): Promise<FlowMigrationResponse>;
3079
+ }
3080
+ //#endregion
3081
+ export { type AccountMode, type AudioMediaObject, AudioMediaTypesEnum, type AuthenticationTemplateOptions, type BaseClass, type BodyOptions, 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, type Flow, FlowActionEnum, type FlowAsset, type FlowAssetsResponse, type FlowButton, 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, FlowStatusEnum, type FlowSuccessScreenResponse, type FlowType, FlowTypeEnum, type FlowValidationError, type FlowValidationErrorPointer, type FlowsListResponse, type FooterOptions, type GeneralHeaderInterface, type GeneralMessageBody, type GeneralRequestBody, type HeaderOptions, type HealthStatus, type HealthStatusEntity, HttpMethodsEnum, type HttpsClientClass, type HttpsClientResponseClass, type ImageMediaObject, ImageMediaTypesEnum, type InteractiveObject, InteractiveTypesEnum, LanguagesEnum, type LimitedTimeOfferOptions, type LimitedTimeOfferTemplateOptions, type LocationObject, type LocationParameter, type LoggerInterface, type MPMButton, type MPMTemplateOptions, type MediaCardCarouselTemplateOptions, type MediaCarouselCard, type MediaClass, type MediaParameter, type MediaResponse, type MediasResponse, type MessageRequestBody, type MessageRequestParams, type MessageTemplateObject, MessageTypesEnum, type MessagesClass, type MessagesResponse, type MessagingLimitTier, type MetaError, type OTPButton, type OTPTemplateOptions, type Pagination, type PaginationCursors, type Paging, ParametersTypesEnum, type PhoneNumberButton, type PhoneNumberClass, type PhoneNumberResponse, type PhoneNumbersResponse, type PlatformType, type ProductCardCarouselTemplateOptions, type ProductCarouselCard, type ProductParameter, type ProductSection, type QrCodeClass, type QrCodeResponse, type QrCodesResponse, type QualityRating, type QualityScore, type QuickReplyButton, type ReactionParams, ReferralSourceTypesEnum, RequestCodeMethodsEnum, type RequestVerificationCodeRequest, type RequesterClass, type RequesterResponseInterface, type ResponseData, type ResponseHeaderValue, type ResponseHeaders, type ResponseJSONBody, type ResponsePagination, type ResponseSuccess, type SPMButton, type SPMTemplateOptions, StatusEnum, type StatusParams, type StickerMediaObject, StickerMediaTypesEnum, SubTypeEnum, SystemChangeTypesEnum, 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, type TwoStepVerificationParams, 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, WabaBusinessVerificationStatus, WabaConfigEnum, type WabaConfigType, type WabaHealthStatus, WabaHealthStatusCanSendMessage, type WabaHealthStatusEntity, type WabaHealthStatusError, type WabaSubscription, type WabaSubscriptions, type WebhookContact, type WebhookEvent, type WebhookMessage, WebhookTypesEnum, type WhatsAppConfig };
3082
+ //# sourceMappingURL=types.d.ts.map