meta-cloud-api 0.2.15 → 0.2.17

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 (111) hide show
  1. package/dist/BusinessProfileApi-DDkv2WQK.d.ts +352 -0
  2. package/dist/EncryptionApi-CwxQlC-2.d.ts +21 -0
  3. package/dist/FlowApi-BIBrWYEv.d.ts +471 -0
  4. package/dist/MediaApi-VqxndaBJ.d.ts +89 -0
  5. package/dist/MessageApi-CHc6bn3g.d.ts +591 -0
  6. package/dist/PhoneNumberApi-C-bs6YAe.d.ts +141 -0
  7. package/dist/QrCodeApi-BjlyPUXV.d.ts +97 -0
  8. package/dist/RegistrationApi-D7Bg8BUz.d.ts +46 -0
  9. package/dist/TemplateApi-dmZbvMkO.d.ts +117 -0
  10. package/dist/TwoStepVerificationApi-DaYWPjY_.d.ts +32 -0
  11. package/dist/WabaApi-CMoTCWiH.d.ts +174 -0
  12. package/dist/base-BG2gtoDs.d.ts +46 -0
  13. package/dist/chunk-2NJVBJUN.js +2 -0
  14. package/dist/chunk-2NJVBJUN.js.map +1 -0
  15. package/dist/chunk-3MO3BTBC.js +2 -0
  16. package/dist/chunk-3MO3BTBC.js.map +1 -0
  17. package/dist/chunk-4C666HHU.js +2 -0
  18. package/dist/chunk-4C666HHU.js.map +1 -0
  19. package/dist/chunk-5JGM556C.js +2 -0
  20. package/dist/chunk-5JGM556C.js.map +1 -0
  21. package/dist/chunk-7GL74SXM.js +2 -0
  22. package/dist/chunk-7GL74SXM.js.map +1 -0
  23. package/dist/chunk-7NQLQPLH.js +2 -0
  24. package/dist/chunk-7NQLQPLH.js.map +1 -0
  25. package/dist/chunk-A264MT4Q.js +2 -0
  26. package/dist/chunk-A264MT4Q.js.map +1 -0
  27. package/dist/chunk-BZ5QDXNR.js +2 -0
  28. package/dist/chunk-BZ5QDXNR.js.map +1 -0
  29. package/dist/chunk-EYGUX4EA.js +2 -0
  30. package/dist/chunk-EYGUX4EA.js.map +1 -0
  31. package/dist/chunk-FFOE5YKT.js +2 -0
  32. package/dist/chunk-FFOE5YKT.js.map +1 -0
  33. package/dist/chunk-GIQLIMOD.js +2 -0
  34. package/dist/chunk-GIQLIMOD.js.map +1 -0
  35. package/dist/chunk-KFPOVYEJ.js +2 -0
  36. package/dist/chunk-KFPOVYEJ.js.map +1 -0
  37. package/dist/chunk-O2OTHNWM.js +2 -0
  38. package/dist/chunk-O2OTHNWM.js.map +1 -0
  39. package/dist/chunk-UQPD6GIF.js +2 -0
  40. package/dist/chunk-UQPD6GIF.js.map +1 -0
  41. package/dist/chunk-VW3LGHTJ.js +2 -0
  42. package/dist/chunk-VW3LGHTJ.js.map +1 -0
  43. package/dist/chunk-XIIJD6SG.js +2 -0
  44. package/dist/chunk-XIIJD6SG.js.map +1 -0
  45. package/dist/chunk-XPPDOFBN.js +2 -0
  46. package/dist/chunk-XPPDOFBN.js.map +1 -0
  47. package/dist/enums-Z1f7QuVx.d.ts +687 -0
  48. package/dist/features/encryption/index.d.ts +9 -0
  49. package/dist/features/encryption/index.js +2 -0
  50. package/dist/features/flow/index.d.ts +9 -0
  51. package/dist/features/flow/index.js +2 -0
  52. package/dist/features/media/index.d.ts +9 -0
  53. package/dist/features/media/index.js +2 -0
  54. package/dist/features/messages/index.d.ts +9 -0
  55. package/dist/features/messages/index.js +2 -0
  56. package/dist/features/messages/index.js.map +1 -0
  57. package/dist/features/phone/index.d.ts +9 -0
  58. package/dist/features/phone/index.js +2 -0
  59. package/dist/features/phone/index.js.map +1 -0
  60. package/dist/features/profile/index.d.ts +9 -0
  61. package/dist/features/profile/index.js +2 -0
  62. package/dist/features/profile/index.js.map +1 -0
  63. package/dist/features/qrCode/index.d.ts +9 -0
  64. package/dist/features/qrCode/index.js +2 -0
  65. package/dist/features/qrCode/index.js.map +1 -0
  66. package/dist/features/registration/index.d.ts +9 -0
  67. package/dist/features/registration/index.js +2 -0
  68. package/dist/features/registration/index.js.map +1 -0
  69. package/dist/features/template/index.d.ts +9 -0
  70. package/dist/features/template/index.js +2 -0
  71. package/dist/features/template/index.js.map +1 -0
  72. package/dist/features/twoStepVerification/index.d.ts +9 -0
  73. package/dist/features/twoStepVerification/index.js +2 -0
  74. package/dist/features/twoStepVerification/index.js.map +1 -0
  75. package/dist/features/waba/index.d.ts +9 -0
  76. package/dist/features/waba/index.js +2 -0
  77. package/dist/features/waba/index.js.map +1 -0
  78. package/dist/index.d.ts +546 -28
  79. package/dist/index.js +2 -2
  80. package/dist/index.js.map +1 -1
  81. package/dist/shared/types/config.d.ts +78 -0
  82. package/dist/shared/types/config.js +2 -0
  83. package/dist/shared/types/config.js.map +1 -0
  84. package/dist/shared/types/enums.d.ts +1 -0
  85. package/dist/shared/types/enums.js +2 -0
  86. package/dist/shared/types/enums.js.map +1 -0
  87. package/dist/shared/utils/isMetaError.d.ts +21 -0
  88. package/dist/shared/utils/isMetaError.js +2 -0
  89. package/dist/shared/utils/isMetaError.js.map +1 -0
  90. package/package.json +80 -15
  91. package/dist/api/index.d.ts +0 -496
  92. package/dist/api/index.js +0 -2
  93. package/dist/chunk-IE2YYEC7.js +0 -2
  94. package/dist/chunk-IE2YYEC7.js.map +0 -1
  95. package/dist/chunk-IMPHLXRA.js +0 -2
  96. package/dist/chunk-IMPHLXRA.js.map +0 -1
  97. package/dist/chunk-KW56EPP7.js +0 -2
  98. package/dist/chunk-KW56EPP7.js.map +0 -1
  99. package/dist/chunk-SLDCD6XR.js +0 -2
  100. package/dist/chunk-SLDCD6XR.js.map +0 -1
  101. package/dist/chunk-UVPYV4PL.js +0 -2
  102. package/dist/chunk-UVPYV4PL.js.map +0 -1
  103. package/dist/types/index.d.ts +0 -513
  104. package/dist/types/index.js +0 -2
  105. package/dist/utils/index.d.ts +0 -71
  106. package/dist/utils/index.js +0 -2
  107. package/dist/waba-RRlZTQUG.d.ts +0 -2229
  108. package/dist/whatsapp-DmeO83A8.d.ts +0 -46
  109. /package/dist/{api → features/encryption}/index.js.map +0 -0
  110. /package/dist/{types → features/flow}/index.js.map +0 -0
  111. /package/dist/{utils → features/media}/index.js.map +0 -0
package/dist/index.d.ts CHANGED
@@ -1,12 +1,524 @@
1
+ import { M as MessageTypesEnum, H as HttpMethodsEnum, S as SDKEnums } from './enums-Z1f7QuVx.js';
2
+ export { a as StatusEnum, W as WebhookTypesEnum } from './enums-Z1f7QuVx.js';
3
+ import { WhatsAppConfig, WabaConfigType } from './shared/types/config.js';
1
4
  import { IncomingMessage } from 'http';
2
- import { H as HttpMethodsEnum, c as RequesterClass, d as WabaConfigType, S as SDKEnums, e as MessageTypesEnum, f as FlowEndpointRequest, g as FlowTypeEnum } from './waba-RRlZTQUG.js';
3
- export { a$ as AccountMode, aA as AudioMediaObject, G as AudioMediaTypesEnum, aB as AudioMessageRequestBody, h as BaseClass, B as BusinessProfileClass, k as BusinessProfileData, i as BusinessProfileField, j as BusinessProfileFieldsParam, l as BusinessProfileResponse, Z as BusinessVerticalEnum, u as ButtonPositionEnum, t as ButtonTypesEnum, C as CategoryEnum, b0 as CodeVerificationStatus, bE as ComponentTypes, v as ComponentTypesEnum, aC as ContactObject, aD as ContactsMessageRequestBody, x as ConversationTypesEnum, bu as CopyCodeButton, ad as CreateFlowResponse, bg as CreateQrCodeRequest, X as CurrencyCodesEnum, b9 as Cursors, Y as DataLocalizationRegionEnum, aE as DocumentMediaObject, D as DocumentMediaTypesEnum, aF as DocumentMessageRequestBody, E as EncryptionClass, q as EncryptionPublicKeyResponse, a3 as Flow, a0 as FlowActionEnum, a7 as FlowAsset, a8 as FlowAssetsResponse, bv as FlowButton, $ as FlowCategoryEnum, F as FlowClass, am as FlowDataExchangeRequest, an as FlowDataExchangeResponse, ai as FlowDecryptedRequestResponse, ah as FlowEncryptedRequestPayload, ar as FlowEndpointResponse, ap as FlowErrorNotificationRequest, aq as FlowErrorNotificationResponse, ak as FlowHealthCheckRequest, al as FlowHealthCheckResponse, aj as FlowHttpRequest, ac as FlowMigrationFailure, af as FlowMigrationResponse, ab as FlowMigrationResult, a9 as FlowPreview, aa as FlowPreviewResponse, _ as FlowStatusEnum, ao as FlowSuccessScreenResponse, a2 as FlowValidationError, a1 as FlowValidationErrorPointer, a6 as FlowsListResponse, bk as GeneralHeaderInterface, av as GeneralMessageBody, bj as GeneralRequestBody, b5 as HealthStatus, b4 as HealthStatusEntity, aG as ImageMediaObject, A as ImageMediaTypesEnum, aH as ImageMessageRequestBody, aJ as InteractiveMessageRequestBody, aI as InteractiveObject, I as InteractiveTypesEnum, O as LanguagesEnum, aU as LocationMessageRequestBody, aT as LocationObject, bw as MPMButton, b as MediaClass, as as MediaResponse, at as MediasResponse, az as MessageRequestBody, aW as MessageRequestParams, aR as MessageTemplateObject, aS as MessageTemplateRequestBody, M as MessagesClass, aV as MessagesResponse, b1 as MessagingLimitTier, bx as OTPButton, a5 as Pagination, a4 as PaginationCursors, bp as Paging, s as ParametersTypesEnum, br as PhoneNumberButton, P as PhoneNumberClass, b8 as PhoneNumberResponse, ba as PhoneNumbersResponse, b2 as PlatformType, Q as QrCodeClass, be as QrCodeResponse, bf as QrCodesResponse, a_ as QualityRating, b6 as QualityScore, bt as QuickReplyButton, aM as ReactionMessageRequestBody, aY as ReactionParams, L as ReferralSourceTypesEnum, R as RegistrationClass, bi as RegistrationRequest, N as RequestCodeMethodsEnum, bb as RequestVerificationCodeRequest, bl as RequesterResponseInterface, bn as ResponseData, bo as ResponsePagination, bm as ResponseSuccess, by as SPMButton, y as StatusEnum, aw as StatusObject, aZ as StatusParams, ay as StatusRequestBody, aK as StickerMediaObject, z as StickerMediaTypesEnum, aL as StickerMessageRequestBody, K as SystemChangeTypesEnum, bC as TemplateBody, bz as TemplateButton, T as TemplateClass, bI as TemplateDeleteParams, bD as TemplateFooter, bq as TemplateFormat, bH as TemplateGetParams, bB as TemplateHeader, bA as TemplateHeaderExample, bF as TemplateRequestBody, bG as TemplateResponse, r as TemplateStatusEnum, aX as TextMessageParams, aO as TextMessageRequestBody, aN as TextObject, b7 as Throughput, b3 as ThroughputLevel, a as TwoStepVerificationClass, bd as TwoStepVerificationParams, bJ as TwoStepVerificationRequest, ax as TypingIndicatorObject, bs as URLButton, U as UpdateBusinessProfileRequest, ae as UpdateFlowResponse, bh as UpdateQrCodeRequest, bL as UpdateWabaSubscription, o as UploadBusinessProfileResponse, p as UploadHandle, au as UploadMediaResponse, m as UploadSession, n as UploadSessionResponse, ag as ValidateFlowJsonResponse, bc as VerifyCodeRequest, aP as VideoMediaObject, V as VideoMediaTypesEnum, aQ as VideoMessageRequestBody, W as WABAClass, bU as WabaAccount, bV as WabaAccountFields, bW as WabaAccountFieldsParam, bN as WabaAccountReviewStatus, bP as WabaAccountStatus, bQ as WabaBusinessVerificationStatus, w as WabaConfigEnum, bT as WabaHealthStatus, bO as WabaHealthStatusCanSendMessage, bS as WabaHealthStatusEntity, bR as WabaHealthStatusError, bK as WabaSubscription, bM as WabaSubscriptions, J as WebhookTypesEnum } from './waba-RRlZTQUG.js';
4
- import { HttpsClientClass, HttpsClientResponseClass, WebhookMessage, WebhookEvent } from './types/index.js';
5
- export { EventField, EventHandler, LoggerInterface, MessageHandler, MessageStatus, ResponseHeaderValue, ResponseHeaders, ResponseJSONBody, WebhookContact } from './types/index.js';
6
- import { W as WhatsAppClass, a as WhatsAppConfig } from './whatsapp-DmeO83A8.js';
7
- import { MessagesAPI as MessagesApi, TemplateAPI as TemplateApi, PhoneNumberAPI as PhoneNumberApi, QrCodeAPI, EncryptionAPI, TwoStepVerificationAPI, RegistrationAPI, MediaAPI, WabaAPI, FlowAPI, BusinessProfileAPI } from './api/index.js';
5
+ import { F as FlowApi, a as FlowEndpointRequest, b as FlowTypeEnum } from './FlowApi-BIBrWYEv.js';
6
+ export { c as Flow, d as FlowClass, e as FlowEndpointResponse } from './FlowApi-BIBrWYEv.js';
7
+ import { E as EncryptionApi } from './EncryptionApi-CwxQlC-2.js';
8
+ import { M as MediaApi } from './MediaApi-VqxndaBJ.js';
9
+ export { a as MediaClass, b as MediaResponse, c as MediasResponse, U as UploadMediaResponse } from './MediaApi-VqxndaBJ.js';
10
+ import { M as MessagesApi } from './MessageApi-CHc6bn3g.js';
11
+ export { A as AudioMediaObject, C as ContactObject, D as DocumentMediaObject, I as ImageMediaObject, a as InteractiveObject, L as LocationObject, b as MessageRequestParams, d as MessageTemplateObject, c as MessagesResponse, R as ReactionParams, S as StatusParams, e as StickerMediaObject, T as TextMessageParams, f as TextObject, V as VideoMediaObject } from './MessageApi-CHc6bn3g.js';
12
+ import { P as PhoneNumberApi } from './PhoneNumberApi-C-bs6YAe.js';
13
+ export { a as PhoneNumberClass, b as PhoneNumberResponse } from './PhoneNumberApi-C-bs6YAe.js';
14
+ import { B as BusinessProfileApi } from './BusinessProfileApi-DDkv2WQK.js';
15
+ export { a as BusinessProfileClass, b as BusinessProfileResponse } from './BusinessProfileApi-DDkv2WQK.js';
16
+ import { Q as QrCodeApi } from './QrCodeApi-BjlyPUXV.js';
17
+ export { a as QrCodeClass, b as QrCodeResponse } from './QrCodeApi-BjlyPUXV.js';
18
+ import { R as RegistrationApi } from './RegistrationApi-D7Bg8BUz.js';
19
+ export { a as RegistrationClass } from './RegistrationApi-D7Bg8BUz.js';
20
+ import { T as TemplateApi } from './TemplateApi-dmZbvMkO.js';
21
+ export { a as TemplateClass, b as TemplateResponse } from './TemplateApi-dmZbvMkO.js';
22
+ import { T as TwoStepVerificationApi } from './TwoStepVerificationApi-DaYWPjY_.js';
23
+ import { W as WabaApi } from './WabaApi-CMoTCWiH.js';
24
+ export { b as WABAClass, a as WabaAccount } from './WabaApi-CMoTCWiH.js';
8
25
  import { Agent } from 'https';
9
- export { MetaError, generateXHub256Sig, importConfig, isFlowDataExchangeRequest, isFlowErrorRequest, isFlowPingRequest, isMetaError, objectToQueryString } from './utils/index.js';
26
+ import { R as RequesterClass } from './base-BG2gtoDs.js';
27
+ export { MetaError, isMetaError } from './shared/utils/isMetaError.js';
28
+
29
+ /**
30
+ * Represents a message received through the webhook
31
+ * Based on Meta's documentation: https://developers.facebook.com/docs/whatsapp/cloud-api/webhooks/components#messages-object
32
+ */
33
+ interface WebhookMessage {
34
+ /**
35
+ * The message ID
36
+ */
37
+ id: string;
38
+ /**
39
+ * The sender's phone number
40
+ */
41
+ from: string;
42
+ /**
43
+ * The timestamp of the message
44
+ */
45
+ timestamp: string;
46
+ /**
47
+ * The type of message (text, image, etc.)
48
+ */
49
+ type: MessageTypesEnum;
50
+ /**
51
+ * The phone number ID that received the message
52
+ */
53
+ phoneNumberId: string;
54
+ /**
55
+ * The display phone number that received the message
56
+ */
57
+ displayPhoneNumber: string;
58
+ /**
59
+ * The profile name of the sender
60
+ */
61
+ profileName: string;
62
+ /**
63
+ * Text object for text messages
64
+ */
65
+ text?: {
66
+ /**
67
+ * The text content of the message
68
+ */
69
+ body: string;
70
+ };
71
+ /**
72
+ * Image object for image messages
73
+ */
74
+ image?: {
75
+ /**
76
+ * The image caption (if provided)
77
+ */
78
+ caption?: string;
79
+ /**
80
+ * The SHA256 hash of the image
81
+ */
82
+ sha256?: string;
83
+ /**
84
+ * The ID for the image
85
+ */
86
+ id: string;
87
+ /**
88
+ * The MIME type of the image
89
+ */
90
+ mime_type: string;
91
+ };
92
+ /**
93
+ * Video object for video messages
94
+ */
95
+ video?: {
96
+ /**
97
+ * The video caption (if provided)
98
+ */
99
+ caption?: string;
100
+ /**
101
+ * The SHA256 hash of the video
102
+ */
103
+ sha256?: string;
104
+ /**
105
+ * The ID for the video
106
+ */
107
+ id: string;
108
+ /**
109
+ * The MIME type of the video
110
+ */
111
+ mime_type: string;
112
+ };
113
+ /**
114
+ * Audio object for audio messages
115
+ */
116
+ audio?: {
117
+ /**
118
+ * The ID for the audio file
119
+ */
120
+ id: string;
121
+ /**
122
+ * The MIME type of the audio file
123
+ */
124
+ mime_type: string;
125
+ /**
126
+ * Whether the audio is a voice message
127
+ */
128
+ voice?: boolean;
129
+ };
130
+ /**
131
+ * Document object for document messages
132
+ */
133
+ document?: {
134
+ /**
135
+ * The document caption (if provided)
136
+ */
137
+ caption?: string;
138
+ /**
139
+ * The document filename
140
+ */
141
+ filename: string;
142
+ /**
143
+ * The SHA256 hash of the document
144
+ */
145
+ sha256?: string;
146
+ /**
147
+ * The ID for the document
148
+ */
149
+ id: string;
150
+ /**
151
+ * The MIME type of the document
152
+ */
153
+ mime_type: string;
154
+ };
155
+ /**
156
+ * Sticker object for sticker messages
157
+ */
158
+ sticker?: {
159
+ /**
160
+ * The ID for the sticker
161
+ */
162
+ id: string;
163
+ /**
164
+ * Whether this is an animated sticker
165
+ */
166
+ animated: boolean;
167
+ /**
168
+ * The MIME type of the sticker
169
+ */
170
+ mime_type: string;
171
+ };
172
+ /**
173
+ * Reaction object for reaction messages
174
+ */
175
+ reaction?: {
176
+ /**
177
+ * The ID of the message being reacted to
178
+ */
179
+ message_id: string;
180
+ /**
181
+ * Emoji used for the reaction
182
+ */
183
+ emoji: string;
184
+ };
185
+ /**
186
+ * Contacts object for contact messages
187
+ */
188
+ contacts?: Array<{
189
+ /**
190
+ * The contact's name
191
+ */
192
+ name: {
193
+ /**
194
+ * The formatted name
195
+ */
196
+ formatted_name: string;
197
+ /**
198
+ * The first name
199
+ */
200
+ first_name?: string;
201
+ /**
202
+ * The last name
203
+ */
204
+ last_name?: string;
205
+ /**
206
+ * The middle name
207
+ */
208
+ middle_name?: string;
209
+ /**
210
+ * The suffix
211
+ */
212
+ suffix?: string;
213
+ /**
214
+ * The prefix
215
+ */
216
+ prefix?: string;
217
+ };
218
+ /**
219
+ * The contact's phone numbers
220
+ */
221
+ phones?: Array<{
222
+ phone: string;
223
+ type?: string;
224
+ wa_id?: string;
225
+ }>;
226
+ /**
227
+ * The contact's emails
228
+ */
229
+ emails?: Array<{
230
+ email: string;
231
+ type?: string;
232
+ }>;
233
+ /**
234
+ * The contact's addresses
235
+ */
236
+ addresses?: Array<{
237
+ street?: string;
238
+ city?: string;
239
+ state?: string;
240
+ zip?: string;
241
+ country?: string;
242
+ country_code?: string;
243
+ type?: string;
244
+ }>;
245
+ /**
246
+ * The contact's organizations
247
+ */
248
+ org?: {
249
+ company?: string;
250
+ department?: string;
251
+ title?: string;
252
+ };
253
+ /**
254
+ * The contact's URLs
255
+ */
256
+ urls?: Array<{
257
+ url: string;
258
+ type?: string;
259
+ }>;
260
+ /**
261
+ * The contact's birthday (YYYY-MM-DD format)
262
+ */
263
+ birthday?: string;
264
+ }>;
265
+ /**
266
+ * Location object for location messages
267
+ */
268
+ location?: {
269
+ /**
270
+ * Latitude of the location
271
+ */
272
+ latitude: number;
273
+ /**
274
+ * Longitude of the location
275
+ */
276
+ longitude: number;
277
+ /**
278
+ * Name of the location
279
+ */
280
+ name?: string;
281
+ /**
282
+ * Address of the location
283
+ */
284
+ address?: string;
285
+ };
286
+ /**
287
+ * Interactive object for interactive messages
288
+ */
289
+ interactive?: {
290
+ /**
291
+ * Type of the interactive message
292
+ * Can be: button_reply, list_reply, flow, nfm_reply, etc.
293
+ */
294
+ type: string;
295
+ /**
296
+ * ID for the button that was clicked
297
+ */
298
+ button_reply?: {
299
+ id: string;
300
+ title: string;
301
+ };
302
+ /**
303
+ * ID for the list item that was selected
304
+ */
305
+ list_reply?: {
306
+ id: string;
307
+ title: string;
308
+ description?: string;
309
+ };
310
+ /**
311
+ * NFM (No-Code Flow Message) reply data
312
+ */
313
+ nfm_reply?: {
314
+ /**
315
+ * Response data in JSON format
316
+ */
317
+ response_json: string;
318
+ /**
319
+ * Body text of the reply
320
+ */
321
+ body: string;
322
+ /**
323
+ * Name of the flow
324
+ */
325
+ name: string;
326
+ };
327
+ };
328
+ /**
329
+ * System object for system messages (like user phone number changes)
330
+ */
331
+ system?: {
332
+ /**
333
+ * The type of system update
334
+ */
335
+ type: string;
336
+ /**
337
+ * User's identity if the update is a customer identity change
338
+ */
339
+ identity?: string;
340
+ /**
341
+ * Old and new phone numbers if the update is a phone number change
342
+ */
343
+ customer?: {
344
+ /**
345
+ * The previous phone number
346
+ */
347
+ previous_wa_id: string;
348
+ /**
349
+ * The new phone number
350
+ */
351
+ wa_id: string;
352
+ };
353
+ };
354
+ /**
355
+ * Order object for order messages
356
+ */
357
+ order?: {
358
+ /**
359
+ * Catalog ID
360
+ */
361
+ catalog_id: string;
362
+ /**
363
+ * Product items in the order
364
+ */
365
+ product_items: Array<{
366
+ /**
367
+ * Product ID
368
+ */
369
+ product_retailer_id: string;
370
+ /**
371
+ * Quantity of the product
372
+ */
373
+ quantity: number;
374
+ /**
375
+ * Item price
376
+ */
377
+ item_price: number;
378
+ /**
379
+ * Currency code
380
+ */
381
+ currency: string;
382
+ }>;
383
+ /**
384
+ * Text message included with the order
385
+ */
386
+ text?: string;
387
+ };
388
+ /**
389
+ * Context object, included when a user replies or interacts
390
+ */
391
+ context?: {
392
+ /**
393
+ * ID of the message
394
+ */
395
+ id?: string;
396
+ /**
397
+ * ID of the sender
398
+ */
399
+ from?: string;
400
+ /**
401
+ * ID of the message being replied to or interacted with
402
+ */
403
+ message_id: string;
404
+ /**
405
+ * ID of the forwarded message, if applicable
406
+ */
407
+ forwarded?: boolean;
408
+ /**
409
+ * Frequently forwarded status
410
+ */
411
+ frequently_forwarded?: boolean;
412
+ /**
413
+ * Original message information if the message was referred
414
+ */
415
+ referred_product?: {
416
+ /**
417
+ * Catalog ID
418
+ */
419
+ catalog_id: string;
420
+ /**
421
+ * Product ID
422
+ */
423
+ product_retailer_id: string;
424
+ };
425
+ };
426
+ /**
427
+ * Errors array, if the message had errors
428
+ */
429
+ errors?: Array<{
430
+ /**
431
+ * Error code
432
+ */
433
+ code: number;
434
+ /**
435
+ * Error title
436
+ */
437
+ title: string;
438
+ /**
439
+ * Error message
440
+ */
441
+ message: string;
442
+ /**
443
+ * Error details object
444
+ */
445
+ error_data?: {
446
+ /**
447
+ * Describes the error details
448
+ */
449
+ details: string;
450
+ };
451
+ }>;
452
+ /**
453
+ * Button object for button messages
454
+ */
455
+ button?: {
456
+ /**
457
+ * The payload for the button
458
+ */
459
+ payload: string;
460
+ /**
461
+ * Button text
462
+ */
463
+ text: string;
464
+ };
465
+ /**
466
+ * The original message data as received from the webhook
467
+ */
468
+ originalData: any;
469
+ }
470
+ /**
471
+ * Webhook event received from WhatsApp
472
+ */
473
+ interface WebhookEvent {
474
+ /**
475
+ * The field type of the event
476
+ */
477
+ field: string;
478
+ /**
479
+ * The event data
480
+ */
481
+ value: any;
482
+ /**
483
+ * The timestamp when the event was received
484
+ */
485
+ timestamp: number;
486
+ }
487
+
488
+ type ResponseHeaderValue = string | string[] | undefined;
489
+ type ResponseHeaders = Record<string, ResponseHeaderValue>;
490
+ type ResponseJSONBody = Record<string, unknown>;
491
+ declare class HttpsClientResponseClass {
492
+ constructor(resp: Response);
493
+ statusCode: () => number;
494
+ headers: () => ResponseHeaders;
495
+ rawResponse: () => Response;
496
+ json: () => Promise<ResponseJSONBody>;
497
+ }
498
+ declare class HttpsClientClass {
499
+ constructor();
500
+ clearSockets: () => boolean;
501
+ sendRequest: (host: string, path: string, method: HttpMethodsEnum, headers: HeadersInit, timeout: number, body?: BodyInit | null) => Promise<HttpsClientResponseClass>;
502
+ }
503
+
504
+ declare class WhatsAppClass {
505
+ constructor(config?: WhatsAppConfig);
506
+ readonly messages: MessagesApi;
507
+ readonly templates: TemplateApi;
508
+ readonly phoneNumber: PhoneNumberApi;
509
+ readonly qrCode: QrCodeApi;
510
+ readonly encryption: EncryptionApi;
511
+ readonly twoStepVerification: TwoStepVerificationApi;
512
+ readonly registration: RegistrationApi;
513
+ readonly media: MediaApi;
514
+ readonly waba: WabaApi;
515
+ readonly flow: FlowApi;
516
+ readonly businessProfile: BusinessProfileApi;
517
+ updateTimeout(ms: number): boolean;
518
+ updatePhoneNumberId(phoneNumberId: number): boolean;
519
+ updateAccessToken(accessToken: string): boolean;
520
+ updateWabaId(wabaId: string): boolean;
521
+ }
10
522
 
11
523
  declare class HttpsClient implements HttpsClientClass {
12
524
  agent: Agent;
@@ -15,6 +527,8 @@ declare class HttpsClient implements HttpsClientClass {
15
527
  sendRequest(hostname: string, path: string, method: HttpMethodsEnum, headers: HeadersInit, timeout: number, body?: BodyInit | null): Promise<HttpsClientResponseClass>;
16
528
  }
17
529
 
530
+ declare const importConfig: (inputConfig?: WhatsAppConfig) => WabaConfigType;
531
+
18
532
  declare class Requester implements RequesterClass {
19
533
  client: Readonly<HttpsClient>;
20
534
  accessToken: Readonly<string>;
@@ -39,14 +553,14 @@ declare class WhatsApp implements WhatsAppClass {
39
553
  readonly messages: MessagesApi;
40
554
  readonly templates: TemplateApi;
41
555
  readonly phoneNumber: PhoneNumberApi;
42
- readonly qrCode: QrCodeAPI;
43
- readonly encryption: EncryptionAPI;
44
- readonly twoStepVerification: TwoStepVerificationAPI;
45
- readonly registration: RegistrationAPI;
46
- readonly media: MediaAPI;
47
- readonly waba: WabaAPI;
48
- readonly flow: FlowAPI;
49
- readonly businessProfile: BusinessProfileAPI;
556
+ readonly qrCode: QrCodeApi;
557
+ readonly encryption: EncryptionApi;
558
+ readonly twoStepVerification: TwoStepVerificationApi;
559
+ readonly registration: RegistrationApi;
560
+ readonly media: MediaApi;
561
+ readonly waba: WabaApi;
562
+ readonly flow: FlowApi;
563
+ readonly businessProfile: BusinessProfileApi;
50
564
  static readonly Enums: typeof SDKEnums;
51
565
  constructor(config?: WhatsAppConfig);
52
566
  private userAgent;
@@ -99,47 +613,51 @@ declare class WebhookHandler {
99
613
  * Process incoming messages
100
614
  */
101
615
  private processMessages;
616
+ /**
617
+ * Process other webhook events
618
+ */
102
619
  private processEvent;
103
620
  /**
104
621
  * Register a message handler for a specific message type
105
- * @param type Message type to handle, or '*' for all types
106
- * @param handler The handler function
107
622
  */
108
623
  onMessage(type: MessageTypesEnum, handler: (whatsapp: WhatsApp, message: WebhookMessage) => void | Promise<void>): void;
109
624
  /**
110
- * Register a general event handler
111
- * @param field Event field to handle, or '*' for all fields
112
- * @param handler The handler function
625
+ * Register an event handler for a specific field
113
626
  */
114
627
  onEvent(field: string, handler: (event: WebhookEvent) => void | Promise<void>): void;
115
628
  /**
116
- * Register a pre-processing handler for all messages
117
- * @param handler The handler function
629
+ * Register a pre-process handler that runs before all message handlers
118
630
  */
119
631
  onMessagePreProcess(handler: (whatsapp: WhatsApp, message: WebhookMessage) => void | Promise<void>): void;
120
632
  /**
121
- * Register a post-processing handler for all messages
122
- * @param handler The handler function
633
+ * Register a post-process handler that runs after all message handlers
123
634
  */
124
635
  onMessagePostProcess(handler: (whatsapp: WhatsApp, message: WebhookMessage) => void | Promise<void>): void;
125
636
  handleFlowRequest<Req extends IRequest & {
126
637
  rawBody: string;
127
638
  }, Res extends IResponse>(req: Req, res: Res): Promise<void>;
639
+ /**
640
+ * Validate the request signature
641
+ */
128
642
  isRequestSignatureValid(req: IRequest & {
129
643
  rawBody: string;
130
644
  }): boolean;
645
+ /**
646
+ * Decrypt a flow request
647
+ */
131
648
  decryptRequest(body: any): {
132
649
  decryptedBody: FlowEndpointRequest;
133
650
  aesKeyBuffer: Buffer;
134
651
  initialVectorBuffer: Buffer;
135
652
  };
653
+ /**
654
+ * Encrypt a flow response
655
+ */
136
656
  private encryptResponse;
137
657
  /**
138
- * Register a Flow action handler for a specific flow type
139
- * @param type The flow type to handle (ping, change, error), or '*' for all types
140
- * @param handler The handler function that receives the WhatsApp client and the Flow request
658
+ * Register a flow handler for a specific flow type
141
659
  */
142
660
  onFlow(type: FlowTypeEnum, handler: (whatsapp: WhatsApp, request: FlowEndpointRequest) => any | Promise<any>): void;
143
661
  }
144
662
 
145
- export { FlowEndpointRequest, FlowTypeEnum, HttpMethodsEnum, HttpsClientClass, HttpsClientResponseClass, type IRequest, type IResponse, MessageTypesEnum, RequesterClass, WabaConfigType, WebhookEvent, WebhookHandler, WebhookMessage, WhatsAppClass, WhatsAppConfig, WhatsApp as default };
663
+ export { BusinessProfileApi, EncryptionApi, FlowApi, FlowEndpointRequest, HttpMethodsEnum, type IRequest, type IResponse, MessageTypesEnum, MessagesApi, PhoneNumberApi, QrCodeApi, RegistrationApi, TemplateApi, TwoStepVerificationApi, WabaApi, WabaConfigType, WebhookHandler, WhatsApp as default, importConfig };