meta-cloud-api 1.1.8 → 1.1.10

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