meta-cloud-api 1.0.0 → 1.0.1
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.
- package/LICENSE +21 -0
- package/README.md +405 -0
- package/dist/BusinessProfileApi-WXscSgo-.d.ts +353 -0
- package/dist/EncryptionApi-D7pt-OXT.d.ts +22 -0
- package/dist/FlowApi-UAvzhJfV.d.ts +136 -0
- package/dist/MediaApi-BrEKpqi_.d.ts +90 -0
- package/dist/MessageApi-Circorzz.d.ts +587 -0
- package/dist/PhoneNumberApi-DKlu9PHl.d.ts +142 -0
- package/dist/QrCodeApi-7vDwIBHR.d.ts +98 -0
- package/dist/RegistrationApi-qO_qoti9.d.ts +47 -0
- package/dist/TemplateApi-xGgIZt89.d.ts +161 -0
- package/dist/TwoStepVerificationApi-DfNPIz-C.d.ts +33 -0
- package/dist/WabaApi-DqQi_68m.d.ts +175 -0
- package/dist/WebhookProcessor-ByAe7Kf_.d.ts +707 -0
- package/dist/WhatsApp-BIBtT-y9.d.ts +82 -0
- package/dist/api/encryption/index.d.ts +10 -0
- package/dist/api/encryption/index.js +2 -0
- package/dist/api/encryption/index.js.map +1 -0
- package/dist/api/flow/index.d.ts +10 -0
- package/dist/api/flow/index.js +2 -0
- package/dist/api/flow/index.js.map +1 -0
- package/dist/api/index.d.ts +16 -0
- package/dist/api/index.js +2 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/media/index.d.ts +10 -0
- package/dist/api/media/index.js +2 -0
- package/dist/api/media/index.js.map +1 -0
- package/dist/api/messages/index.d.ts +10 -0
- package/dist/api/messages/index.js +2 -0
- package/dist/api/messages/index.js.map +1 -0
- package/dist/api/phone/index.d.ts +10 -0
- package/dist/api/phone/index.js +2 -0
- package/dist/api/phone/index.js.map +1 -0
- package/dist/api/profile/index.d.ts +10 -0
- package/dist/api/profile/index.js +2 -0
- package/dist/api/profile/index.js.map +1 -0
- package/dist/api/qrCode/index.d.ts +10 -0
- package/dist/api/qrCode/index.js +2 -0
- package/dist/api/qrCode/index.js.map +1 -0
- package/dist/api/registration/index.d.ts +10 -0
- package/dist/api/registration/index.js +2 -0
- package/dist/api/registration/index.js.map +1 -0
- package/dist/api/template/index.d.ts +215 -0
- package/dist/api/template/index.js +2 -0
- package/dist/api/template/index.js.map +1 -0
- package/dist/api/twoStepVerification/index.d.ts +10 -0
- package/dist/api/twoStepVerification/index.js +2 -0
- package/dist/api/twoStepVerification/index.js.map +1 -0
- package/dist/api/waba/index.d.ts +10 -0
- package/dist/api/waba/index.js +2 -0
- package/dist/api/waba/index.js.map +1 -0
- package/dist/base-CdGDdVEl.d.ts +18 -0
- package/dist/chunk-7QBIZCJ4.js +2 -0
- package/dist/chunk-7QBIZCJ4.js.map +1 -0
- package/dist/chunk-AMHQGG6Z.js +2 -0
- package/dist/chunk-AMHQGG6Z.js.map +1 -0
- package/dist/chunk-B7DCL6I7.js +10 -0
- package/dist/chunk-B7DCL6I7.js.map +1 -0
- package/dist/chunk-CRZ7EUYR.js +2 -0
- package/dist/chunk-CRZ7EUYR.js.map +1 -0
- package/dist/chunk-FKXSL2JK.js +3 -0
- package/dist/chunk-FKXSL2JK.js.map +1 -0
- package/dist/chunk-FSKBLPGE.js +2 -0
- package/dist/chunk-FSKBLPGE.js.map +1 -0
- package/dist/chunk-HJGN3PO4.js +3 -0
- package/dist/chunk-HJGN3PO4.js.map +1 -0
- package/dist/chunk-IYSR44P6.js +2 -0
- package/dist/chunk-IYSR44P6.js.map +1 -0
- package/dist/chunk-JC6YMVID.js +2 -0
- package/dist/chunk-JC6YMVID.js.map +1 -0
- package/dist/chunk-JPAV644F.js +2 -0
- package/dist/chunk-JPAV644F.js.map +1 -0
- package/dist/chunk-JXCLRKQ7.js +2 -0
- package/dist/chunk-JXCLRKQ7.js.map +1 -0
- package/dist/chunk-KMAH6636.js +2 -0
- package/dist/chunk-KMAH6636.js.map +1 -0
- package/dist/chunk-L4ESAO2S.js +2 -0
- package/dist/chunk-L4ESAO2S.js.map +1 -0
- package/dist/chunk-LV3TULSI.js +2 -0
- package/dist/chunk-LV3TULSI.js.map +1 -0
- package/dist/chunk-MJEG3K4V.js +2 -0
- package/dist/chunk-MJEG3K4V.js.map +1 -0
- package/dist/chunk-NLF2JGYY.js +2 -0
- package/dist/chunk-NLF2JGYY.js.map +1 -0
- package/dist/chunk-OA2SW4AF.js +2 -0
- package/dist/chunk-OA2SW4AF.js.map +1 -0
- package/dist/chunk-PHPQ5HP3.js +2 -0
- package/dist/chunk-PHPQ5HP3.js.map +1 -0
- package/dist/chunk-RIL6QABY.js +2 -0
- package/dist/chunk-RIL6QABY.js.map +1 -0
- package/dist/chunk-RWCVPWRC.js +2 -0
- package/dist/chunk-RWCVPWRC.js.map +1 -0
- package/dist/chunk-SNNRWNGZ.js +2 -0
- package/dist/chunk-SNNRWNGZ.js.map +1 -0
- package/dist/chunk-UCBYECNQ.js +2 -0
- package/dist/chunk-UCBYECNQ.js.map +1 -0
- package/dist/chunk-VHAODWCN.js +2 -0
- package/dist/chunk-VHAODWCN.js.map +1 -0
- package/dist/chunk-WGGN32O2.js +2 -0
- package/dist/chunk-WGGN32O2.js.map +1 -0
- package/dist/common-DDXsNyLF.d.ts +376 -0
- package/dist/core/webhook/frameworks/express.d.ts +48 -0
- package/dist/core/webhook/frameworks/express.js +2 -0
- package/dist/core/webhook/frameworks/express.js.map +1 -0
- package/dist/core/webhook/frameworks/nextjs.d.ts +44 -0
- package/dist/core/webhook/frameworks/nextjs.js +2 -0
- package/dist/core/webhook/frameworks/nextjs.js.map +1 -0
- package/dist/core/webhook/index.d.ts +26 -0
- package/dist/core/webhook/index.js +2 -0
- package/dist/core/webhook/index.js.map +1 -0
- package/dist/core/whatsapp/index.d.ts +40 -0
- package/dist/core/whatsapp/index.js +2 -0
- package/dist/core/whatsapp/index.js.map +1 -0
- package/dist/enums-BZd9T2ul.d.ts +707 -0
- package/dist/httpsClient-v4gmltzS.d.ts +19 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/logger-BdE0Vyim.d.ts +9 -0
- package/dist/request-vYMaEfk5.d.ts +50 -0
- package/dist/types/config.d.ts +78 -0
- package/dist/types/config.js +2 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/enums.d.ts +1 -0
- package/dist/types/enums.js +2 -0
- package/dist/types/enums.js.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/index.d.ts +98 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +240 -8
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
import { a as BaseClass, B as BaseAPI } from './base-CdGDdVEl.js';
|
|
2
|
+
import { WabaConfigType } from './types/config.js';
|
|
3
|
+
import { e as ResponseSuccess, R as RequesterClass } from './request-vYMaEfk5.js';
|
|
4
|
+
import { k as BusinessVerticalEnum } from './enums-BZd9T2ul.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Upload session information for creating upload sessions.
|
|
8
|
+
*/
|
|
9
|
+
interface UploadSession {
|
|
10
|
+
id: string;
|
|
11
|
+
video?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Response from creating an upload session.
|
|
15
|
+
*/
|
|
16
|
+
interface UploadSessionResponse {
|
|
17
|
+
id: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Response from uploading business profile media.
|
|
21
|
+
*/
|
|
22
|
+
interface UploadBusinessProfileResponse {
|
|
23
|
+
h: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Upload handle information containing file details and handle.
|
|
27
|
+
*/
|
|
28
|
+
interface UploadHandle {
|
|
29
|
+
handle: string;
|
|
30
|
+
file_size: number;
|
|
31
|
+
upload_result: {
|
|
32
|
+
handle_type: string;
|
|
33
|
+
name: string;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Request parameters for creating upload session.
|
|
38
|
+
*/
|
|
39
|
+
interface CreateUploadSessionParams {
|
|
40
|
+
/**
|
|
41
|
+
* Length of the file to be uploaded in bytes.
|
|
42
|
+
*/
|
|
43
|
+
fileLength: number;
|
|
44
|
+
/**
|
|
45
|
+
* MIME type of the file (e.g., 'image/jpeg').
|
|
46
|
+
*/
|
|
47
|
+
fileType: string;
|
|
48
|
+
/**
|
|
49
|
+
* Name of the file with extension.
|
|
50
|
+
*/
|
|
51
|
+
fileName: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Request parameters for uploading media.
|
|
55
|
+
*/
|
|
56
|
+
interface UploadMediaParams {
|
|
57
|
+
/**
|
|
58
|
+
* The upload session ID from createUploadSession response.
|
|
59
|
+
*/
|
|
60
|
+
uploadId: string;
|
|
61
|
+
/**
|
|
62
|
+
* The binary data of the file (Buffer).
|
|
63
|
+
*/
|
|
64
|
+
file: Buffer;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Request parameters for getting upload handle.
|
|
68
|
+
*/
|
|
69
|
+
interface GetUploadHandleParams {
|
|
70
|
+
/**
|
|
71
|
+
* The upload session ID from createUploadSession response.
|
|
72
|
+
*/
|
|
73
|
+
uploadId: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Available fields that can be requested when retrieving a business profile.
|
|
78
|
+
*/
|
|
79
|
+
type BusinessProfileField = 'about' | 'address' | 'description' | 'email' | 'profile_picture_url' | 'websites' | 'vertical';
|
|
80
|
+
type BusinessProfileFieldsParam = BusinessProfileField[] | string;
|
|
81
|
+
/**
|
|
82
|
+
* Business profile data structure containing all profile information.
|
|
83
|
+
*/
|
|
84
|
+
interface BusinessProfileData {
|
|
85
|
+
/**
|
|
86
|
+
* The business's About text. This text appears in the business's profile, beneath its profile image,
|
|
87
|
+
* phone number, and contact buttons.
|
|
88
|
+
* - String cannot be empty
|
|
89
|
+
* - Strings must be between 1 and 139 characters
|
|
90
|
+
* - Rendered emojis are supported however their unicode values are not.
|
|
91
|
+
* Emoji unicode values must be Java- or JavaScript-escape encoded
|
|
92
|
+
* - Hyperlinks can be included but will not render as clickable links
|
|
93
|
+
* - Markdown is not supported
|
|
94
|
+
*/
|
|
95
|
+
about?: string;
|
|
96
|
+
/**
|
|
97
|
+
* Address of the business. Character limit 256.
|
|
98
|
+
*/
|
|
99
|
+
address?: string;
|
|
100
|
+
/**
|
|
101
|
+
* Description of the business. Character limit 512.
|
|
102
|
+
*/
|
|
103
|
+
description?: string;
|
|
104
|
+
/**
|
|
105
|
+
* The contact email address (in valid email format) of the business. Character limit 128.
|
|
106
|
+
*/
|
|
107
|
+
email?: string;
|
|
108
|
+
/**
|
|
109
|
+
* The messaging service used for the request. Always set it to "whatsapp" if you are using
|
|
110
|
+
* the WhatsApp Business API.
|
|
111
|
+
*/
|
|
112
|
+
messaging_product: string;
|
|
113
|
+
/**
|
|
114
|
+
* Profile picture URL.
|
|
115
|
+
*/
|
|
116
|
+
profile_picture_url?: string;
|
|
117
|
+
/**
|
|
118
|
+
* The URLs associated with the business. For instance, a website, Facebook Page, or Instagram.
|
|
119
|
+
* - You must include the http:// or https:// portion of the URL
|
|
120
|
+
* - There is a maximum of 2 websites with a maximum of 256 characters each
|
|
121
|
+
*/
|
|
122
|
+
websites?: string[];
|
|
123
|
+
/**
|
|
124
|
+
* Business category. This can be either an empty string or one of the predefined business categories.
|
|
125
|
+
* @see BusinessVerticalEnum for all available options
|
|
126
|
+
*/
|
|
127
|
+
vertical?: BusinessVerticalEnum | string;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Response structure for business profile GET requests.
|
|
131
|
+
*/
|
|
132
|
+
interface BusinessProfileResponse {
|
|
133
|
+
data: BusinessProfileData[];
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Request structure for updating business profile.
|
|
137
|
+
*/
|
|
138
|
+
interface UpdateBusinessProfileRequest {
|
|
139
|
+
/**
|
|
140
|
+
* The messaging service used for the request. Always set it to "whatsapp" if you are using
|
|
141
|
+
* the WhatsApp Business API.
|
|
142
|
+
* @required
|
|
143
|
+
*/
|
|
144
|
+
messaging_product: string;
|
|
145
|
+
/**
|
|
146
|
+
* The business's About text. This text appears in the business's profile, beneath its profile image,
|
|
147
|
+
* phone number, and contact buttons.
|
|
148
|
+
* - String cannot be empty
|
|
149
|
+
* - Strings must be between 1 and 139 characters
|
|
150
|
+
* - Rendered emojis are supported however their unicode values are not.
|
|
151
|
+
* Emoji unicode values must be Java- or JavaScript-escape encoded
|
|
152
|
+
* - Hyperlinks can be included but will not render as clickable links
|
|
153
|
+
* - Markdown is not supported
|
|
154
|
+
*/
|
|
155
|
+
about?: string;
|
|
156
|
+
/**
|
|
157
|
+
* Address of the business. Character limit 256.
|
|
158
|
+
*/
|
|
159
|
+
address?: string;
|
|
160
|
+
/**
|
|
161
|
+
* Description of the business. Character limit 512.
|
|
162
|
+
*/
|
|
163
|
+
description?: string;
|
|
164
|
+
/**
|
|
165
|
+
* Business category. This can be either an empty string or one of the predefined business categories.
|
|
166
|
+
* @see BusinessVerticalEnum for all available options
|
|
167
|
+
*/
|
|
168
|
+
vertical?: BusinessVerticalEnum | string;
|
|
169
|
+
/**
|
|
170
|
+
* The contact email address (in valid email format) of the business. Character limit 128.
|
|
171
|
+
*/
|
|
172
|
+
email?: string;
|
|
173
|
+
/**
|
|
174
|
+
* The URLs associated with the business. For instance, a website, Facebook Page, or Instagram.
|
|
175
|
+
* - You must include the http:// or https:// portion of the URL
|
|
176
|
+
* - There is a maximum of 2 websites with a maximum of 256 characters each
|
|
177
|
+
*/
|
|
178
|
+
websites?: string[];
|
|
179
|
+
/**
|
|
180
|
+
* Handle of the profile picture. This handle is generated when you upload the binary file
|
|
181
|
+
* for the profile picture to Meta using the Resumable Upload API.
|
|
182
|
+
*/
|
|
183
|
+
profile_picture_handle?: string;
|
|
184
|
+
}
|
|
185
|
+
declare class BusinessProfileClass extends BaseClass {
|
|
186
|
+
/**
|
|
187
|
+
* Get your business profile.
|
|
188
|
+
* @param fields Specific fields to be returned in the response. If not specified, all fields will be returned.
|
|
189
|
+
*/
|
|
190
|
+
getBusinessProfile(fields?: BusinessProfileFieldsParam): Promise<BusinessProfileResponse>;
|
|
191
|
+
/**
|
|
192
|
+
* Update your business profile.
|
|
193
|
+
* @param updateRequest The request object containing the fields to update.
|
|
194
|
+
*/
|
|
195
|
+
updateBusinessProfile(updateRequest: UpdateBusinessProfileRequest): Promise<ResponseSuccess>;
|
|
196
|
+
/**
|
|
197
|
+
* Create an upload session for profile picture.
|
|
198
|
+
* @param fileLength Length of the file to be uploaded in bytes.
|
|
199
|
+
* @param fileType MIME type of the file (e.g., 'image/jpeg').
|
|
200
|
+
* @param fileName Name of the file.
|
|
201
|
+
*/
|
|
202
|
+
createUploadSession(fileLength: number, fileType: string, fileName: string): Promise<UploadSessionResponse>;
|
|
203
|
+
/**
|
|
204
|
+
* Upload media file to the upload session.
|
|
205
|
+
* @param uploadId The ID of the upload session.
|
|
206
|
+
* @param file The binary data of the file.
|
|
207
|
+
*/
|
|
208
|
+
uploadMedia(uploadId: string, file: Buffer): Promise<UploadBusinessProfileResponse>;
|
|
209
|
+
/**
|
|
210
|
+
* Get the upload handle information.
|
|
211
|
+
* @param uploadId The ID of the upload session.
|
|
212
|
+
*/
|
|
213
|
+
getUploadHandle(uploadId: string): Promise<UploadHandle>;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* API for managing WhatsApp Business Profiles and profile pictures.
|
|
218
|
+
*
|
|
219
|
+
* This API allows you to:
|
|
220
|
+
* - Get business profile information
|
|
221
|
+
* - Update business profile details
|
|
222
|
+
* - Upload profile pictures using a three-step process:
|
|
223
|
+
* 1. Create an upload session
|
|
224
|
+
* 2. Upload the image binary data
|
|
225
|
+
* 3. Get the upload handle to use when updating the profile
|
|
226
|
+
*/
|
|
227
|
+
declare class BusinessProfileApi extends BaseAPI implements BusinessProfileClass {
|
|
228
|
+
private readonly endpoint;
|
|
229
|
+
constructor(config: WabaConfigType, client: RequesterClass);
|
|
230
|
+
/**
|
|
231
|
+
* Get your business profile information.
|
|
232
|
+
*
|
|
233
|
+
* Use this method to retrieve details about your WhatsApp business profile, including
|
|
234
|
+
* about text, address, description, email, profile picture URL, websites, and vertical.
|
|
235
|
+
*
|
|
236
|
+
* @param fields Fields to be returned in the response. If not specified, all fields will be returned.
|
|
237
|
+
* Possible values: about, address, description, email, profile_picture_url, websites, vertical
|
|
238
|
+
* @returns The business profile information.
|
|
239
|
+
*
|
|
240
|
+
* @example
|
|
241
|
+
* // Get all business profile fields
|
|
242
|
+
* const profile = await whatsappClient.businessProfile.getBusinessProfile();
|
|
243
|
+
*
|
|
244
|
+
* // Get specific business profile fields
|
|
245
|
+
* const profile = await whatsappClient.businessProfile.getBusinessProfile('about,address,email');
|
|
246
|
+
*
|
|
247
|
+
* // Using the BusinessProfileFieldsParam type
|
|
248
|
+
* const profile = await whatsappClient.businessProfile.getBusinessProfile(['about', 'address', 'email']);
|
|
249
|
+
*/
|
|
250
|
+
getBusinessProfile(fields?: BusinessProfileFieldsParam): Promise<BusinessProfileResponse>;
|
|
251
|
+
/**
|
|
252
|
+
* Update your business profile.
|
|
253
|
+
*
|
|
254
|
+
* Use this method to update one or more fields of your WhatsApp business profile.
|
|
255
|
+
*
|
|
256
|
+
* @param updateRequest The request object containing the fields to update.
|
|
257
|
+
* - messaging_product: Required. Always set to "whatsapp".
|
|
258
|
+
* - about: Optional. Business's About text (1-139 characters).
|
|
259
|
+
* - address: Optional. Business address (max 256 characters).
|
|
260
|
+
* - description: Optional. Business description (max 512 characters).
|
|
261
|
+
* - vertical: Optional. Business category (use BusinessVerticalEnum for type safety).
|
|
262
|
+
* - email: Optional. Contact email (valid format, max 128 characters).
|
|
263
|
+
* - websites: Optional. Up to 2 URLs (max 256 characters each).
|
|
264
|
+
* - profile_picture_handle: Optional. Handle from upload process.
|
|
265
|
+
* @returns Response indicating success or failure.
|
|
266
|
+
*
|
|
267
|
+
* @example
|
|
268
|
+
* // Update business profile with multiple fields including vertical using enum
|
|
269
|
+
* await whatsappClient.businessProfile.updateBusinessProfile({
|
|
270
|
+
* messaging_product: 'whatsapp',
|
|
271
|
+
* about: 'We provide excellent service',
|
|
272
|
+
* email: 'contact@example.com',
|
|
273
|
+
* websites: ['https://example.com'],
|
|
274
|
+
* vertical: BusinessVerticalEnum.RETAIL
|
|
275
|
+
* });
|
|
276
|
+
*/
|
|
277
|
+
updateBusinessProfile(updateRequest: UpdateBusinessProfileRequest): Promise<ResponseSuccess>;
|
|
278
|
+
/**
|
|
279
|
+
* Create an upload session for a profile picture.
|
|
280
|
+
*
|
|
281
|
+
* This is the first step in the profile picture upload process.
|
|
282
|
+
*
|
|
283
|
+
* @param fileLength Length of the file to be uploaded in bytes.
|
|
284
|
+
* @param fileType MIME type of the file (e.g., 'image/jpeg').
|
|
285
|
+
* @param fileName Name of the file with extension.
|
|
286
|
+
* @returns Response containing the upload session ID needed for the next step.
|
|
287
|
+
*
|
|
288
|
+
* @example
|
|
289
|
+
* // Create upload session for profile picture
|
|
290
|
+
* const session = await whatsappClient.businessProfile.createUploadSession(
|
|
291
|
+
* fileBuffer.length,
|
|
292
|
+
* 'image/jpeg',
|
|
293
|
+
* 'profile.jpg'
|
|
294
|
+
* );
|
|
295
|
+
* const uploadSessionId = session.upload_session_id;
|
|
296
|
+
*/
|
|
297
|
+
createUploadSession(fileLength: number, fileType: string, fileName: string): Promise<UploadSessionResponse>;
|
|
298
|
+
/**
|
|
299
|
+
* Upload media file to the upload session.
|
|
300
|
+
*
|
|
301
|
+
* This is the second step in the profile picture upload process.
|
|
302
|
+
* Upload the binary content of the file to the previously created upload session.
|
|
303
|
+
*
|
|
304
|
+
* @param uploadId The upload session ID from createUploadSession response.
|
|
305
|
+
* @param file The binary data of the file (Buffer).
|
|
306
|
+
* @returns Response indicating success or failure.
|
|
307
|
+
*
|
|
308
|
+
* @example
|
|
309
|
+
* // Upload the actual file content
|
|
310
|
+
* await whatsappClient.businessProfile.uploadMedia(
|
|
311
|
+
* uploadSessionId,
|
|
312
|
+
* fileBuffer
|
|
313
|
+
* );
|
|
314
|
+
*/
|
|
315
|
+
uploadMedia(uploadId: string, file: Buffer): Promise<UploadBusinessProfileResponse>;
|
|
316
|
+
/**
|
|
317
|
+
* Get the upload handle information.
|
|
318
|
+
*
|
|
319
|
+
* This is the third step in the profile picture upload process.
|
|
320
|
+
* After uploading the file, get the handle to use when updating the profile.
|
|
321
|
+
*
|
|
322
|
+
* @param uploadId The upload session ID from createUploadSession response.
|
|
323
|
+
* @returns Response containing the upload handle information.
|
|
324
|
+
*
|
|
325
|
+
* @example
|
|
326
|
+
* // Complete profile picture update process
|
|
327
|
+
* // 1. Create upload session
|
|
328
|
+
* const session = await whatsappClient.businessProfile.createUploadSession(
|
|
329
|
+
* fileBuffer.length, 'image/jpeg', 'profile.jpg'
|
|
330
|
+
* );
|
|
331
|
+
*
|
|
332
|
+
* // 2. Upload the image data
|
|
333
|
+
* await whatsappClient.businessProfile.uploadMedia(
|
|
334
|
+
* session.upload_session_id, fileBuffer
|
|
335
|
+
* );
|
|
336
|
+
*
|
|
337
|
+
* // 3. Get the handle for the uploaded file
|
|
338
|
+
* const handleInfo = await whatsappClient.businessProfile.getUploadHandle(
|
|
339
|
+
* session.upload_session_id
|
|
340
|
+
* );
|
|
341
|
+
*
|
|
342
|
+
* // 4. Update profile with new picture and business information
|
|
343
|
+
* await whatsappClient.businessProfile.updateBusinessProfile({
|
|
344
|
+
* messaging_product: 'whatsapp',
|
|
345
|
+
* profile_picture_handle: handleInfo.handle,
|
|
346
|
+
* vertical: BusinessVerticalEnum.RESTAURANT,
|
|
347
|
+
* about: 'Delicious food served daily'
|
|
348
|
+
* });
|
|
349
|
+
*/
|
|
350
|
+
getUploadHandle(uploadId: string): Promise<UploadHandle>;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
export { BusinessProfileApi as B, type CreateUploadSessionParams as C, type GetUploadHandleParams as G, type UpdateBusinessProfileRequest as U, BusinessProfileClass as a, type BusinessProfileData as b, type BusinessProfileField as c, type BusinessProfileFieldsParam as d, type BusinessProfileResponse 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,22 @@
|
|
|
1
|
+
import { B as BaseAPI } from './base-CdGDdVEl.js';
|
|
2
|
+
import { WabaConfigType } from './types/config.js';
|
|
3
|
+
import { c as ResponseData, e as ResponseSuccess, R as RequesterClass } from './request-vYMaEfk5.js';
|
|
4
|
+
|
|
5
|
+
type EncryptionPublicKeyResponse = ResponseData<{
|
|
6
|
+
business_public_key: string;
|
|
7
|
+
business_public_key_signature_status: 'VALID' | 'MISMATCH';
|
|
8
|
+
}>;
|
|
9
|
+
|
|
10
|
+
interface EncryptionClass {
|
|
11
|
+
getEncryptionPublicKey(): Promise<EncryptionPublicKeyResponse>;
|
|
12
|
+
setEncryptionPublicKey(businessPublicKey: string): Promise<ResponseSuccess>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
declare class EncryptionApi extends BaseAPI implements EncryptionClass {
|
|
16
|
+
private readonly endpoint;
|
|
17
|
+
constructor(config: WabaConfigType, client: RequesterClass);
|
|
18
|
+
getEncryptionPublicKey(): Promise<EncryptionPublicKeyResponse>;
|
|
19
|
+
setEncryptionPublicKey(businessPublicKey: string): Promise<ResponseSuccess>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { EncryptionApi as E, type EncryptionClass as a, type EncryptionPublicKeyResponse as b };
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { B as BaseAPI } from './base-CdGDdVEl.js';
|
|
2
|
+
import { WabaConfigType } from './types/config.js';
|
|
3
|
+
import { R as RequesterClass, e as ResponseSuccess } from './request-vYMaEfk5.js';
|
|
4
|
+
import { e as FlowClass, j as FlowsListResponse, d as FlowCategoryEnum, C as CreateFlowResponse, F as Flow, i as FlowPreviewResponse, c as FlowAssetsResponse, U as UpdateFlowResponse, V as ValidateFlowJsonResponse, h as FlowMigrationResponse } from './common-DDXsNyLF.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* API for managing WhatsApp Flows.
|
|
8
|
+
*
|
|
9
|
+
* This API allows you to:
|
|
10
|
+
* - List flows
|
|
11
|
+
* - Create flows
|
|
12
|
+
* - Get flow details and previews
|
|
13
|
+
* - Update flow metadata and JSON
|
|
14
|
+
* - Delete flows
|
|
15
|
+
* - Publish and deprecate flows
|
|
16
|
+
* - Migrate flows between WABAs
|
|
17
|
+
* - Validate flow JSON
|
|
18
|
+
*/
|
|
19
|
+
declare class FlowApi extends BaseAPI implements FlowClass {
|
|
20
|
+
constructor(config: WabaConfigType, client: RequesterClass);
|
|
21
|
+
/**
|
|
22
|
+
* List Flows
|
|
23
|
+
*
|
|
24
|
+
* @param wabaId - The WABA ID
|
|
25
|
+
* @returns Promise with the list of flows
|
|
26
|
+
*/
|
|
27
|
+
listFlows(wabaId: string): Promise<FlowsListResponse>;
|
|
28
|
+
/**
|
|
29
|
+
* Create Flow
|
|
30
|
+
*
|
|
31
|
+
* @param wabaId - The WABA ID
|
|
32
|
+
* @param data - The flow data including name, categories, endpoint_uri, and optional clone_flow_id
|
|
33
|
+
* @returns Promise with the created flow ID and validation errors if any
|
|
34
|
+
*/
|
|
35
|
+
createFlow(wabaId: string, data: {
|
|
36
|
+
name: string;
|
|
37
|
+
categories?: FlowCategoryEnum[];
|
|
38
|
+
endpoint_uri?: string;
|
|
39
|
+
clone_flow_id?: string;
|
|
40
|
+
flow_json?: string;
|
|
41
|
+
publish?: boolean;
|
|
42
|
+
}): Promise<CreateFlowResponse>;
|
|
43
|
+
/**
|
|
44
|
+
* Get Flow details
|
|
45
|
+
*
|
|
46
|
+
* @param flowId - The flow ID
|
|
47
|
+
* @param fields - Optional fields to return (e.g., 'name,status,preview.invalidate(false)')
|
|
48
|
+
* @param dateFormat - Optional date format
|
|
49
|
+
* @returns Promise with the flow details or preview response
|
|
50
|
+
*/
|
|
51
|
+
getFlow(flowId: string, fields?: string, dateFormat?: string): Promise<Flow | FlowPreviewResponse>;
|
|
52
|
+
/**
|
|
53
|
+
* Get Flow Preview URL
|
|
54
|
+
*
|
|
55
|
+
* @param flowId - The flow ID
|
|
56
|
+
* @param invalidate - Optional. If true, invalidates existing preview and generates a new one. Defaults to false.
|
|
57
|
+
* @returns Promise with the flow preview details
|
|
58
|
+
*/
|
|
59
|
+
getFlowPreview(flowId: string, invalidate?: boolean): Promise<FlowPreviewResponse>;
|
|
60
|
+
/**
|
|
61
|
+
* Update Flow Metadata
|
|
62
|
+
*
|
|
63
|
+
* @param flowId - The flow ID
|
|
64
|
+
* @param data - The flow metadata to update (name, categories, endpoint_uri, application_id)
|
|
65
|
+
* @returns Promise with the success status
|
|
66
|
+
*/
|
|
67
|
+
updateFlowMetadata(flowId: string, data: {
|
|
68
|
+
name?: string;
|
|
69
|
+
categories?: FlowCategoryEnum[];
|
|
70
|
+
endpoint_uri?: string;
|
|
71
|
+
application_id?: string;
|
|
72
|
+
}): Promise<ResponseSuccess>;
|
|
73
|
+
/**
|
|
74
|
+
* Delete Flow (only works if the Flow is in DRAFT status)
|
|
75
|
+
*
|
|
76
|
+
* @param flowId - The flow ID
|
|
77
|
+
* @returns Promise with the success status
|
|
78
|
+
*/
|
|
79
|
+
deleteFlow(flowId: string): Promise<ResponseSuccess>;
|
|
80
|
+
/**
|
|
81
|
+
* List Assets (e.g., get Flow JSON download URL)
|
|
82
|
+
*
|
|
83
|
+
* @param flowId - The flow ID
|
|
84
|
+
* @returns Promise with the list of assets
|
|
85
|
+
*/
|
|
86
|
+
listAssets(flowId: string): Promise<FlowAssetsResponse>;
|
|
87
|
+
/**
|
|
88
|
+
* Update Flow JSON by uploading a file, buffer, JSON object, or Blob.
|
|
89
|
+
*
|
|
90
|
+
* @param flowId - The flow ID
|
|
91
|
+
* @param data - Object containing the file data and optional name.
|
|
92
|
+
* @param data.file - The Flow JSON content as a Buffer, JSON object, or Blob.
|
|
93
|
+
* @param data.name - Optional name for the asset, defaults to 'flow.json'.
|
|
94
|
+
* @returns Promise with the success status and validation errors, if any.
|
|
95
|
+
*/
|
|
96
|
+
updateFlowJson(flowId: string, data: {
|
|
97
|
+
file: Blob | Buffer | object;
|
|
98
|
+
name?: string;
|
|
99
|
+
}): Promise<UpdateFlowResponse>;
|
|
100
|
+
/**
|
|
101
|
+
* Validate Flow JSON by attempting an update without publishing.
|
|
102
|
+
* This is a convenience method; the API doesn't have a dedicated validation endpoint.
|
|
103
|
+
*
|
|
104
|
+
* @param flowId - The ID of the Flow (must exist, can be in DRAFT status).
|
|
105
|
+
* @param flowJsonData - The Flow JSON content as a file path (string), Buffer, JSON object, or Blob.
|
|
106
|
+
* @returns Promise indicating if the JSON is valid and includes validation errors if any.
|
|
107
|
+
*/
|
|
108
|
+
validateFlowJson(flowId: string, flowJsonData: Blob | Buffer | object): Promise<ValidateFlowJsonResponse>;
|
|
109
|
+
/**
|
|
110
|
+
* Publish Flow
|
|
111
|
+
*
|
|
112
|
+
* @param flowId - The flow ID
|
|
113
|
+
* @returns Promise with the success status
|
|
114
|
+
*/
|
|
115
|
+
publishFlow(flowId: string): Promise<ResponseSuccess>;
|
|
116
|
+
/**
|
|
117
|
+
* Deprecate Flow
|
|
118
|
+
*
|
|
119
|
+
* @param flowId - The flow ID
|
|
120
|
+
* @returns Promise with the success status
|
|
121
|
+
*/
|
|
122
|
+
deprecateFlow(flowId: string): Promise<ResponseSuccess>;
|
|
123
|
+
/**
|
|
124
|
+
* Migrate Flows between WABAs
|
|
125
|
+
*
|
|
126
|
+
* @param destinationWabaId - The destination WABA ID
|
|
127
|
+
* @param data - The migration data including source_waba_id and optional source_flow_names
|
|
128
|
+
* @returns Promise with migration results (successes and failures)
|
|
129
|
+
*/
|
|
130
|
+
migrateFlows(destinationWabaId: string, data: {
|
|
131
|
+
source_waba_id: string;
|
|
132
|
+
source_flow_names?: string[];
|
|
133
|
+
}): Promise<FlowMigrationResponse>;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export { FlowApi as F };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { B as BaseAPI } from './base-CdGDdVEl.js';
|
|
2
|
+
import { WabaConfigType } from './types/config.js';
|
|
3
|
+
import { e as ResponseSuccess, R as RequesterClass } from './request-vYMaEfk5.js';
|
|
4
|
+
|
|
5
|
+
type MediaResponse = {
|
|
6
|
+
id: string;
|
|
7
|
+
url: string;
|
|
8
|
+
mime_type: string;
|
|
9
|
+
sha256: string;
|
|
10
|
+
file_size: number;
|
|
11
|
+
messaging_product: 'whatsapp';
|
|
12
|
+
};
|
|
13
|
+
type MediasResponse = {
|
|
14
|
+
data: MediaResponse[];
|
|
15
|
+
paging: {
|
|
16
|
+
cursors: {
|
|
17
|
+
before: string;
|
|
18
|
+
after: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
type UploadMediaResponse = {
|
|
23
|
+
id: string;
|
|
24
|
+
};
|
|
25
|
+
interface MediaClass {
|
|
26
|
+
getMediaById(mediaId: string, phone_number_id?: string): Promise<MediaResponse>;
|
|
27
|
+
uploadMedia(file: File, messagingProduct?: string): Promise<UploadMediaResponse>;
|
|
28
|
+
deleteMedia(mediaId: string, phone_number_id?: string): Promise<ResponseSuccess>;
|
|
29
|
+
downloadMedia(mediaUrl: string): Promise<Blob>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* API for managing WhatsApp Media.
|
|
34
|
+
*
|
|
35
|
+
* This API allows you to:
|
|
36
|
+
* - Get media information by ID
|
|
37
|
+
* - Upload media files
|
|
38
|
+
* - Delete media files
|
|
39
|
+
* - Download media files from URLs
|
|
40
|
+
*/
|
|
41
|
+
declare class MediaApi extends BaseAPI implements MediaClass {
|
|
42
|
+
private readonly endpoint;
|
|
43
|
+
constructor(config: WabaConfigType, client: RequesterClass);
|
|
44
|
+
/**
|
|
45
|
+
* Retrieve media information by media ID.
|
|
46
|
+
*
|
|
47
|
+
* @param mediaId The media ID to retrieve information for
|
|
48
|
+
* @param phone_number_id Optional phone number ID (defaults to configured one)
|
|
49
|
+
* @returns Media information including URL, mime type, file size, etc.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* const mediaInfo = await whatsappClient.media.getMediaById('media_id_123');
|
|
53
|
+
*/
|
|
54
|
+
getMediaById(mediaId: string, phone_number_id?: string): Promise<MediaResponse>;
|
|
55
|
+
/**
|
|
56
|
+
* Upload a media file to WhatsApp.
|
|
57
|
+
*
|
|
58
|
+
* @param file The file to upload
|
|
59
|
+
* @param messagingProduct The messaging product (default: 'whatsapp')
|
|
60
|
+
* @returns Upload response containing the media ID
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* const file = new File([buffer], 'image.jpg', { type: 'image/jpeg' });
|
|
64
|
+
* const result = await whatsappClient.media.uploadMedia(file);
|
|
65
|
+
*/
|
|
66
|
+
uploadMedia(file: File, messagingProduct?: string): Promise<UploadMediaResponse>;
|
|
67
|
+
/**
|
|
68
|
+
* Delete a media file.
|
|
69
|
+
*
|
|
70
|
+
* @param mediaId The media ID to delete
|
|
71
|
+
* @param phone_number_id Optional phone number ID (defaults to configured one)
|
|
72
|
+
* @returns Response indicating success or failure
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* await whatsappClient.media.deleteMedia('media_id_123');
|
|
76
|
+
*/
|
|
77
|
+
deleteMedia(mediaId: string, phone_number_id?: string): Promise<ResponseSuccess>;
|
|
78
|
+
/**
|
|
79
|
+
* Download media from a URL.
|
|
80
|
+
*
|
|
81
|
+
* @param mediaUrl The URL to download media from
|
|
82
|
+
* @returns Blob containing the media data
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* const blob = await whatsappClient.media.downloadMedia('https://...');
|
|
86
|
+
*/
|
|
87
|
+
downloadMedia(mediaUrl: string): Promise<Blob>;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export { MediaApi as M, type UploadMediaResponse as U, type MediaClass as a, type MediaResponse as b, type MediasResponse as c };
|