meta-cloud-api 1.1.6 → 1.1.8

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