meta-cloud-api 0.2.15 → 0.2.16

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
@@ -0,0 +1,352 @@
1
+ import { B as BaseClass, b as ResponseSuccess, a as BaseAPI, R as RequesterClass } from './base-BG2gtoDs.js';
2
+ import { WabaConfigType } from './shared/types/config.js';
3
+ import { d as BusinessVerticalEnum } from './enums-Z1f7QuVx.js';
4
+
5
+ /**
6
+ * Upload session information for creating upload sessions.
7
+ */
8
+ interface UploadSession {
9
+ id: string;
10
+ video?: boolean;
11
+ }
12
+ /**
13
+ * Response from creating an upload session.
14
+ */
15
+ interface UploadSessionResponse {
16
+ id: string;
17
+ }
18
+ /**
19
+ * Response from uploading business profile media.
20
+ */
21
+ interface UploadBusinessProfileResponse {
22
+ h: string;
23
+ }
24
+ /**
25
+ * Upload handle information containing file details and handle.
26
+ */
27
+ interface UploadHandle {
28
+ handle: string;
29
+ file_size: number;
30
+ upload_result: {
31
+ handle_type: string;
32
+ name: string;
33
+ };
34
+ }
35
+ /**
36
+ * Request parameters for creating upload session.
37
+ */
38
+ interface CreateUploadSessionParams {
39
+ /**
40
+ * Length of the file to be uploaded in bytes.
41
+ */
42
+ fileLength: number;
43
+ /**
44
+ * MIME type of the file (e.g., 'image/jpeg').
45
+ */
46
+ fileType: string;
47
+ /**
48
+ * Name of the file with extension.
49
+ */
50
+ fileName: string;
51
+ }
52
+ /**
53
+ * Request parameters for uploading media.
54
+ */
55
+ interface UploadMediaParams {
56
+ /**
57
+ * The upload session ID from createUploadSession response.
58
+ */
59
+ uploadId: string;
60
+ /**
61
+ * The binary data of the file (Buffer).
62
+ */
63
+ file: Buffer;
64
+ }
65
+ /**
66
+ * Request parameters for getting upload handle.
67
+ */
68
+ interface GetUploadHandleParams {
69
+ /**
70
+ * The upload session ID from createUploadSession response.
71
+ */
72
+ uploadId: string;
73
+ }
74
+
75
+ /**
76
+ * Available fields that can be requested when retrieving a business profile.
77
+ */
78
+ type BusinessProfileField = 'about' | 'address' | 'description' | 'email' | 'profile_picture_url' | 'websites' | 'vertical';
79
+ type BusinessProfileFieldsParam = BusinessProfileField[] | string;
80
+ /**
81
+ * Business profile data structure containing all profile information.
82
+ */
83
+ interface BusinessProfileData {
84
+ /**
85
+ * The business's About text. This text appears in the business's profile, beneath its profile image,
86
+ * phone number, and contact buttons.
87
+ * - String cannot be empty
88
+ * - Strings must be between 1 and 139 characters
89
+ * - Rendered emojis are supported however their unicode values are not.
90
+ * Emoji unicode values must be Java- or JavaScript-escape encoded
91
+ * - Hyperlinks can be included but will not render as clickable links
92
+ * - Markdown is not supported
93
+ */
94
+ about?: string;
95
+ /**
96
+ * Address of the business. Character limit 256.
97
+ */
98
+ address?: string;
99
+ /**
100
+ * Description of the business. Character limit 512.
101
+ */
102
+ description?: string;
103
+ /**
104
+ * The contact email address (in valid email format) of the business. Character limit 128.
105
+ */
106
+ email?: string;
107
+ /**
108
+ * The messaging service used for the request. Always set it to "whatsapp" if you are using
109
+ * the WhatsApp Business API.
110
+ */
111
+ messaging_product: string;
112
+ /**
113
+ * Profile picture URL.
114
+ */
115
+ profile_picture_url?: string;
116
+ /**
117
+ * The URLs associated with the business. For instance, a website, Facebook Page, or Instagram.
118
+ * - You must include the http:// or https:// portion of the URL
119
+ * - There is a maximum of 2 websites with a maximum of 256 characters each
120
+ */
121
+ websites?: string[];
122
+ /**
123
+ * Business category. This can be either an empty string or one of the predefined business categories.
124
+ * @see BusinessVerticalEnum for all available options
125
+ */
126
+ vertical?: BusinessVerticalEnum | string;
127
+ }
128
+ /**
129
+ * Response structure for business profile GET requests.
130
+ */
131
+ interface BusinessProfileResponse {
132
+ data: BusinessProfileData[];
133
+ }
134
+ /**
135
+ * Request structure for updating business profile.
136
+ */
137
+ interface UpdateBusinessProfileRequest {
138
+ /**
139
+ * The messaging service used for the request. Always set it to "whatsapp" if you are using
140
+ * the WhatsApp Business API.
141
+ * @required
142
+ */
143
+ messaging_product: string;
144
+ /**
145
+ * The business's About text. This text appears in the business's profile, beneath its profile image,
146
+ * phone number, and contact buttons.
147
+ * - String cannot be empty
148
+ * - Strings must be between 1 and 139 characters
149
+ * - Rendered emojis are supported however their unicode values are not.
150
+ * Emoji unicode values must be Java- or JavaScript-escape encoded
151
+ * - Hyperlinks can be included but will not render as clickable links
152
+ * - Markdown is not supported
153
+ */
154
+ about?: string;
155
+ /**
156
+ * Address of the business. Character limit 256.
157
+ */
158
+ address?: string;
159
+ /**
160
+ * Description of the business. Character limit 512.
161
+ */
162
+ description?: string;
163
+ /**
164
+ * Business category. This can be either an empty string or one of the predefined business categories.
165
+ * @see BusinessVerticalEnum for all available options
166
+ */
167
+ vertical?: BusinessVerticalEnum | string;
168
+ /**
169
+ * The contact email address (in valid email format) of the business. Character limit 128.
170
+ */
171
+ email?: string;
172
+ /**
173
+ * The URLs associated with the business. For instance, a website, Facebook Page, or Instagram.
174
+ * - You must include the http:// or https:// portion of the URL
175
+ * - There is a maximum of 2 websites with a maximum of 256 characters each
176
+ */
177
+ websites?: string[];
178
+ /**
179
+ * Handle of the profile picture. This handle is generated when you upload the binary file
180
+ * for the profile picture to Meta using the Resumable Upload API.
181
+ */
182
+ profile_picture_handle?: string;
183
+ }
184
+ declare class BusinessProfileClass extends BaseClass {
185
+ /**
186
+ * Get your business profile.
187
+ * @param fields Specific fields to be returned in the response. If not specified, all fields will be returned.
188
+ */
189
+ getBusinessProfile(fields?: BusinessProfileFieldsParam): Promise<BusinessProfileResponse>;
190
+ /**
191
+ * Update your business profile.
192
+ * @param updateRequest The request object containing the fields to update.
193
+ */
194
+ updateBusinessProfile(updateRequest: UpdateBusinessProfileRequest): Promise<ResponseSuccess>;
195
+ /**
196
+ * Create an upload session for profile picture.
197
+ * @param fileLength Length of the file to be uploaded in bytes.
198
+ * @param fileType MIME type of the file (e.g., 'image/jpeg').
199
+ * @param fileName Name of the file.
200
+ */
201
+ createUploadSession(fileLength: number, fileType: string, fileName: string): Promise<UploadSessionResponse>;
202
+ /**
203
+ * Upload media file to the upload session.
204
+ * @param uploadId The ID of the upload session.
205
+ * @param file The binary data of the file.
206
+ */
207
+ uploadMedia(uploadId: string, file: Buffer): Promise<UploadBusinessProfileResponse>;
208
+ /**
209
+ * Get the upload handle information.
210
+ * @param uploadId The ID of the upload session.
211
+ */
212
+ getUploadHandle(uploadId: string): Promise<UploadHandle>;
213
+ }
214
+
215
+ /**
216
+ * API for managing WhatsApp Business Profiles and profile pictures.
217
+ *
218
+ * This API allows you to:
219
+ * - Get business profile information
220
+ * - Update business profile details
221
+ * - Upload profile pictures using a three-step process:
222
+ * 1. Create an upload session
223
+ * 2. Upload the image binary data
224
+ * 3. Get the upload handle to use when updating the profile
225
+ */
226
+ declare class BusinessProfileApi extends BaseAPI implements BusinessProfileClass {
227
+ private readonly endpoint;
228
+ constructor(config: WabaConfigType, client: RequesterClass);
229
+ /**
230
+ * Get your business profile information.
231
+ *
232
+ * Use this method to retrieve details about your WhatsApp business profile, including
233
+ * about text, address, description, email, profile picture URL, websites, and vertical.
234
+ *
235
+ * @param fields Fields to be returned in the response. If not specified, all fields will be returned.
236
+ * Possible values: about, address, description, email, profile_picture_url, websites, vertical
237
+ * @returns The business profile information.
238
+ *
239
+ * @example
240
+ * // Get all business profile fields
241
+ * const profile = await whatsappClient.businessProfile.getBusinessProfile();
242
+ *
243
+ * // Get specific business profile fields
244
+ * const profile = await whatsappClient.businessProfile.getBusinessProfile('about,address,email');
245
+ *
246
+ * // Using the BusinessProfileFieldsParam type
247
+ * const profile = await whatsappClient.businessProfile.getBusinessProfile(['about', 'address', 'email']);
248
+ */
249
+ getBusinessProfile(fields?: BusinessProfileFieldsParam): Promise<BusinessProfileResponse>;
250
+ /**
251
+ * Update your business profile.
252
+ *
253
+ * Use this method to update one or more fields of your WhatsApp business profile.
254
+ *
255
+ * @param updateRequest The request object containing the fields to update.
256
+ * - messaging_product: Required. Always set to "whatsapp".
257
+ * - about: Optional. Business's About text (1-139 characters).
258
+ * - address: Optional. Business address (max 256 characters).
259
+ * - description: Optional. Business description (max 512 characters).
260
+ * - vertical: Optional. Business category (use BusinessVerticalEnum for type safety).
261
+ * - email: Optional. Contact email (valid format, max 128 characters).
262
+ * - websites: Optional. Up to 2 URLs (max 256 characters each).
263
+ * - profile_picture_handle: Optional. Handle from upload process.
264
+ * @returns Response indicating success or failure.
265
+ *
266
+ * @example
267
+ * // Update business profile with multiple fields including vertical using enum
268
+ * await whatsappClient.businessProfile.updateBusinessProfile({
269
+ * messaging_product: 'whatsapp',
270
+ * about: 'We provide excellent service',
271
+ * email: 'contact@example.com',
272
+ * websites: ['https://example.com'],
273
+ * vertical: BusinessVerticalEnum.RETAIL
274
+ * });
275
+ */
276
+ updateBusinessProfile(updateRequest: UpdateBusinessProfileRequest): Promise<ResponseSuccess>;
277
+ /**
278
+ * Create an upload session for a profile picture.
279
+ *
280
+ * This is the first step in the profile picture upload process.
281
+ *
282
+ * @param fileLength Length of the file to be uploaded in bytes.
283
+ * @param fileType MIME type of the file (e.g., 'image/jpeg').
284
+ * @param fileName Name of the file with extension.
285
+ * @returns Response containing the upload session ID needed for the next step.
286
+ *
287
+ * @example
288
+ * // Create upload session for profile picture
289
+ * const session = await whatsappClient.businessProfile.createUploadSession(
290
+ * fileBuffer.length,
291
+ * 'image/jpeg',
292
+ * 'profile.jpg'
293
+ * );
294
+ * const uploadSessionId = session.upload_session_id;
295
+ */
296
+ createUploadSession(fileLength: number, fileType: string, fileName: string): Promise<UploadSessionResponse>;
297
+ /**
298
+ * Upload media file to the upload session.
299
+ *
300
+ * This is the second step in the profile picture upload process.
301
+ * Upload the binary content of the file to the previously created upload session.
302
+ *
303
+ * @param uploadId The upload session ID from createUploadSession response.
304
+ * @param file The binary data of the file (Buffer).
305
+ * @returns Response indicating success or failure.
306
+ *
307
+ * @example
308
+ * // Upload the actual file content
309
+ * await whatsappClient.businessProfile.uploadMedia(
310
+ * uploadSessionId,
311
+ * fileBuffer
312
+ * );
313
+ */
314
+ uploadMedia(uploadId: string, file: Buffer): Promise<UploadBusinessProfileResponse>;
315
+ /**
316
+ * Get the upload handle information.
317
+ *
318
+ * This is the third step in the profile picture upload process.
319
+ * After uploading the file, get the handle to use when updating the profile.
320
+ *
321
+ * @param uploadId The upload session ID from createUploadSession response.
322
+ * @returns Response containing the upload handle information.
323
+ *
324
+ * @example
325
+ * // Complete profile picture update process
326
+ * // 1. Create upload session
327
+ * const session = await whatsappClient.businessProfile.createUploadSession(
328
+ * fileBuffer.length, 'image/jpeg', 'profile.jpg'
329
+ * );
330
+ *
331
+ * // 2. Upload the image data
332
+ * await whatsappClient.businessProfile.uploadMedia(
333
+ * session.upload_session_id, fileBuffer
334
+ * );
335
+ *
336
+ * // 3. Get the handle for the uploaded file
337
+ * const handleInfo = await whatsappClient.businessProfile.getUploadHandle(
338
+ * session.upload_session_id
339
+ * );
340
+ *
341
+ * // 4. Update profile with new picture and business information
342
+ * await whatsappClient.businessProfile.updateBusinessProfile({
343
+ * messaging_product: 'whatsapp',
344
+ * profile_picture_handle: handleInfo.handle,
345
+ * vertical: BusinessVerticalEnum.RESTAURANT,
346
+ * about: 'Delicious food served daily'
347
+ * });
348
+ */
349
+ getUploadHandle(uploadId: string): Promise<UploadHandle>;
350
+ }
351
+
352
+ export { BusinessProfileApi as B, type CreateUploadSessionParams as C, type GetUploadHandleParams as G, type UpdateBusinessProfileRequest as U, BusinessProfileClass as a, type BusinessProfileResponse as b, type BusinessProfileData as c, type BusinessProfileField as d, type BusinessProfileFieldsParam as e, type UploadBusinessProfileResponse as f, type UploadHandle as g, type UploadMediaParams as h, type UploadSession as i, type UploadSessionResponse as j };
@@ -0,0 +1,21 @@
1
+ import { d as ResponseData, b as ResponseSuccess, a as BaseAPI, R as RequesterClass } from './base-BG2gtoDs.js';
2
+ import { WabaConfigType } from './shared/types/config.js';
3
+
4
+ type EncryptionPublicKeyResponse = ResponseData<{
5
+ business_public_key: string;
6
+ business_public_key_signature_status: 'VALID' | 'MISMATCH';
7
+ }>;
8
+
9
+ interface EncryptionClass {
10
+ getEncryptionPublicKey(): Promise<EncryptionPublicKeyResponse>;
11
+ setEncryptionPublicKey(businessPublicKey: string): Promise<ResponseSuccess>;
12
+ }
13
+
14
+ declare class EncryptionApi extends BaseAPI implements EncryptionClass {
15
+ private readonly endpoint;
16
+ constructor(config: WabaConfigType, client: RequesterClass);
17
+ getEncryptionPublicKey(): Promise<EncryptionPublicKeyResponse>;
18
+ setEncryptionPublicKey(businessPublicKey: string): Promise<ResponseSuccess>;
19
+ }
20
+
21
+ export { EncryptionApi as E, type EncryptionClass as a, type EncryptionPublicKeyResponse as b };