meta-cloud-api 1.1.5 → 1.1.6
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/dist/api/flow/types/common.d.ts +406 -0
- package/dist/api/flow/types/common.d.ts.map +1 -0
- package/dist/api/flow/types/common.js +51 -0
- package/dist/api/flow/types/common.js.map +1 -0
- package/dist/api/flow/types/index.d.ts +1 -0
- package/dist/api/flow/types/index.js +1 -0
- package/dist/api/media/types/common.d.ts +32 -0
- package/dist/api/media/types/common.d.ts.map +1 -0
- package/dist/api/media/types/index.d.ts +1 -0
- package/dist/api/messages/types/common.d.ts +99 -0
- package/dist/api/messages/types/common.d.ts.map +1 -0
- package/dist/api/messages/types/contact.d.ts +54 -0
- package/dist/api/messages/types/contact.d.ts.map +1 -0
- package/dist/api/messages/types/index.d.ts +8 -0
- package/dist/api/messages/types/interactive.d.ts +182 -0
- package/dist/api/messages/types/interactive.d.ts.map +1 -0
- package/dist/api/messages/types/location.d.ts +16 -0
- package/dist/api/messages/types/location.d.ts.map +1 -0
- package/dist/api/messages/types/media.d.ts +55 -0
- package/dist/api/messages/types/media.d.ts.map +1 -0
- package/dist/api/messages/types/reaction.d.ts +17 -0
- package/dist/api/messages/types/reaction.d.ts.map +1 -0
- package/dist/api/messages/types/template.d.ts +72 -0
- package/dist/api/messages/types/template.d.ts.map +1 -0
- package/dist/api/messages/types/text.d.ts +17 -0
- package/dist/api/messages/types/text.d.ts.map +1 -0
- package/dist/api/phone/types/common.d.ts +83 -0
- package/dist/api/phone/types/common.d.ts.map +1 -0
- package/dist/api/phone/types/index.d.ts +1 -0
- package/dist/api/profile/types/common.d.ts +149 -0
- package/dist/api/profile/types/common.d.ts.map +1 -0
- package/dist/api/profile/types/index.d.ts +2 -0
- package/dist/api/profile/types/upload.d.ts +73 -0
- package/dist/api/profile/types/upload.d.ts.map +1 -0
- package/dist/api/qrCode/types/common.d.ts +28 -0
- package/dist/api/qrCode/types/common.d.ts.map +1 -0
- package/dist/api/qrCode/types/index.d.ts +1 -0
- package/dist/api/template/types/common.d.ts +155 -0
- package/dist/api/template/types/common.d.ts.map +1 -0
- package/dist/api/template/types/factory.d.ts +202 -0
- package/dist/api/template/types/factory.d.ts.map +1 -0
- package/dist/api/template/types/index.d.ts +2 -0
- package/dist/api/waba/types/common.d.ts +122 -0
- package/dist/api/waba/types/common.d.ts.map +1 -0
- package/dist/api/waba/types/common.js +44 -0
- package/dist/api/waba/types/common.js.map +1 -0
- package/dist/api/waba/types/index.d.ts +1 -0
- package/dist/api/waba/types/index.js +1 -0
- package/dist/client.d.ts +25 -0
- package/dist/client.js +6 -0
- package/dist/core/webhook/types.d.ts +737 -0
- package/dist/core/webhook/types.d.ts.map +1 -0
- package/dist/enums.d.ts +1 -1
- package/dist/index.d.ts +2587 -2587
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/types/base.d.ts.map +1 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/enums.d.ts +668 -0
- package/dist/types/enums.d.ts.map +1 -0
- package/dist/types/enums.js +681 -0
- package/dist/types/enums.js.map +1 -0
- package/dist/types/httpsClient.d.ts.map +1 -0
- package/dist/types/index.d.ts +24 -0
- package/dist/types/index.js +5 -0
- package/dist/types/logger.d.ts.map +1 -0
- package/dist/{request.d.ts → types/request.d.ts} +1 -1
- package/dist/types/request.d.ts.map +1 -0
- package/dist/utils/isMetaError.d.ts +23 -0
- package/dist/utils/isMetaError.d.ts.map +1 -0
- package/package.json +7 -1
- package/dist/base.d.ts.map +0 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/httpsClient.d.ts.map +0 -1
- package/dist/logger.d.ts.map +0 -1
- package/dist/request.d.ts.map +0 -1
- /package/dist/{base.d.ts → types/base.d.ts} +0 -0
- /package/dist/{config.d.ts → types/config.d.ts} +0 -0
- /package/dist/{httpsClient.d.ts → types/httpsClient.d.ts} +0 -0
- /package/dist/{logger.d.ts → types/logger.d.ts} +0 -0
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
import { ResponseSuccess } from "../../../types/request.js";
|
|
2
|
+
import { IncomingHttpHeaders, IncomingMessage } from "http";
|
|
3
|
+
|
|
4
|
+
//#region src/api/flow/types/common.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Enum for Flow Status
|
|
8
|
+
*/
|
|
9
|
+
declare enum FlowStatusEnum {
|
|
10
|
+
Draft = "DRAFT",
|
|
11
|
+
Published = "PUBLISHED",
|
|
12
|
+
Throttled = "THROTTLED",
|
|
13
|
+
Blocked = "BLOCKED",
|
|
14
|
+
Deprecated = "DEPRECATED",
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Enum for Flow Categories
|
|
18
|
+
*/
|
|
19
|
+
declare enum FlowCategoryEnum {
|
|
20
|
+
SignUp = "SIGN_UP",
|
|
21
|
+
SignIn = "SIGN_IN",
|
|
22
|
+
AppointmentBooking = "APPOINTMENT_BOOKING",
|
|
23
|
+
LeadGeneration = "LEAD_GENERATION",
|
|
24
|
+
ContactUs = "CONTACT_US",
|
|
25
|
+
CustomerSupport = "CUSTOMER_SUPPORT",
|
|
26
|
+
Survey = "SURVEY",
|
|
27
|
+
Other = "OTHER",
|
|
28
|
+
}
|
|
29
|
+
declare enum FlowActionEnum {
|
|
30
|
+
INIT = "INIT",
|
|
31
|
+
BACK = "BACK",
|
|
32
|
+
DATA_EXCHANGE = "data_exchange",
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Enum for Flow Types in webhook handlers
|
|
36
|
+
* Used to register handlers for specific flow events
|
|
37
|
+
*/
|
|
38
|
+
declare enum FlowTypeEnum {
|
|
39
|
+
/** Health check/ping requests */
|
|
40
|
+
Ping = "ping",
|
|
41
|
+
/** Data exchange requests */
|
|
42
|
+
Change = "data_exchange",
|
|
43
|
+
/** Error notification requests */
|
|
44
|
+
Error = "error",
|
|
45
|
+
/** Match all flow action types */
|
|
46
|
+
All = "*",
|
|
47
|
+
}
|
|
48
|
+
type FlowType = (typeof FlowTypeEnum)[keyof typeof FlowTypeEnum];
|
|
49
|
+
/**
|
|
50
|
+
* Flow Validation Error Pointer
|
|
51
|
+
*/
|
|
52
|
+
interface FlowValidationErrorPointer {
|
|
53
|
+
line_start: number;
|
|
54
|
+
line_end: number;
|
|
55
|
+
column_start: number;
|
|
56
|
+
column_end: number;
|
|
57
|
+
path: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Flow Validation Error
|
|
61
|
+
*/
|
|
62
|
+
interface FlowValidationError {
|
|
63
|
+
error: string;
|
|
64
|
+
error_type: string;
|
|
65
|
+
message: string;
|
|
66
|
+
line_start: number;
|
|
67
|
+
line_end: number;
|
|
68
|
+
column_start: number;
|
|
69
|
+
column_end: number;
|
|
70
|
+
pointers: FlowValidationErrorPointer[];
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Flow Item
|
|
74
|
+
*/
|
|
75
|
+
interface Flow {
|
|
76
|
+
id: string;
|
|
77
|
+
name: string;
|
|
78
|
+
status: FlowStatusEnum;
|
|
79
|
+
categories: FlowCategoryEnum[];
|
|
80
|
+
validation_errors: FlowValidationError[];
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Pagination Cursors
|
|
84
|
+
*/
|
|
85
|
+
interface PaginationCursors {
|
|
86
|
+
before: string;
|
|
87
|
+
after: string;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Pagination Object
|
|
91
|
+
*/
|
|
92
|
+
interface Pagination {
|
|
93
|
+
cursors: PaginationCursors;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Flows List Response
|
|
97
|
+
*/
|
|
98
|
+
interface FlowsListResponse {
|
|
99
|
+
data: Flow[];
|
|
100
|
+
paging: Pagination;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Flow Asset
|
|
104
|
+
*/
|
|
105
|
+
interface FlowAsset {
|
|
106
|
+
name: string;
|
|
107
|
+
asset_type: string;
|
|
108
|
+
download_url: string;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Flow Assets Response
|
|
112
|
+
*/
|
|
113
|
+
interface FlowAssetsResponse {
|
|
114
|
+
data: FlowAsset[];
|
|
115
|
+
paging: Pagination;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Flow Preview
|
|
119
|
+
*/
|
|
120
|
+
interface FlowPreview {
|
|
121
|
+
preview_url: string;
|
|
122
|
+
expires_at: string;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Flow Preview Response
|
|
126
|
+
*/
|
|
127
|
+
interface FlowPreviewResponse {
|
|
128
|
+
preview: FlowPreview;
|
|
129
|
+
id: string;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Flow Migration Result
|
|
133
|
+
*/
|
|
134
|
+
interface FlowMigrationResult {
|
|
135
|
+
source_name: string;
|
|
136
|
+
source_id: string;
|
|
137
|
+
migrated_id: string;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Flow Migration Failure
|
|
141
|
+
*/
|
|
142
|
+
interface FlowMigrationFailure {
|
|
143
|
+
source_name: string;
|
|
144
|
+
error_code: string;
|
|
145
|
+
error_message: string;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Create Flow Response
|
|
149
|
+
*/
|
|
150
|
+
interface CreateFlowResponse {
|
|
151
|
+
id: string;
|
|
152
|
+
success: boolean;
|
|
153
|
+
validation_errors?: FlowValidationError[];
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Update Flow Response
|
|
157
|
+
*/
|
|
158
|
+
interface UpdateFlowResponse {
|
|
159
|
+
success: boolean;
|
|
160
|
+
validation_errors?: FlowValidationError[];
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Flow Migration Response
|
|
164
|
+
*/
|
|
165
|
+
interface FlowMigrationResponse {
|
|
166
|
+
migrated_flows: FlowMigrationResult[];
|
|
167
|
+
failed_flows: FlowMigrationFailure[];
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Validate Flow JSON Response
|
|
171
|
+
*/
|
|
172
|
+
interface ValidateFlowJsonResponse {
|
|
173
|
+
valid: boolean;
|
|
174
|
+
success: boolean;
|
|
175
|
+
validation_errors?: FlowValidationError[];
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* WhatsApp Flow Endpoint - Encrypted Request Payload
|
|
179
|
+
* Represents the raw encrypted data received from WhatsApp
|
|
180
|
+
*/
|
|
181
|
+
interface FlowEncryptedRequestPayload {
|
|
182
|
+
encrypted_aes_key: string;
|
|
183
|
+
encrypted_flow_data: string;
|
|
184
|
+
initial_vector: string;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* WhatsApp Flow Endpoint - Decrypted Request Response
|
|
188
|
+
* Represents the successfully decrypted data and encryption keys
|
|
189
|
+
*/
|
|
190
|
+
interface FlowDecryptedRequestResponse {
|
|
191
|
+
decryptedBody: any;
|
|
192
|
+
aesKeyBuffer: Buffer;
|
|
193
|
+
initialVectorBuffer: Buffer;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* WhatsApp Flow Endpoint - HTTP Request with Body
|
|
197
|
+
* Represents an HTTP request with the encrypted payload
|
|
198
|
+
*/
|
|
199
|
+
interface FlowHttpRequest extends IncomingMessage {
|
|
200
|
+
body: FlowEncryptedRequestPayload;
|
|
201
|
+
headers: IncomingHttpHeaders;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* WhatsApp Flow Endpoint - Health Check Request
|
|
205
|
+
* Represents the structure of a health check request
|
|
206
|
+
*/
|
|
207
|
+
interface FlowHealthCheckRequest {
|
|
208
|
+
action: 'ping';
|
|
209
|
+
version: '3.0';
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* WhatsApp Flow Endpoint - Health Check Response
|
|
213
|
+
* The expected response structure for health check requests
|
|
214
|
+
*/
|
|
215
|
+
interface FlowHealthCheckResponse {
|
|
216
|
+
data: {
|
|
217
|
+
status: 'active';
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* WhatsApp Flow Endpoint - Data Exchange Request
|
|
222
|
+
* Represents the structure of a data exchange request
|
|
223
|
+
*/
|
|
224
|
+
interface FlowDataExchangeRequest {
|
|
225
|
+
version: '3.0';
|
|
226
|
+
action: FlowActionEnum;
|
|
227
|
+
screen: string;
|
|
228
|
+
flow_token: string;
|
|
229
|
+
data?: Record<string, any> & {
|
|
230
|
+
error_message?: string;
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* WhatsApp Flow Endpoint - Data Exchange Response
|
|
235
|
+
* The expected response structure for data exchange requests
|
|
236
|
+
*/
|
|
237
|
+
interface FlowDataExchangeResponse {
|
|
238
|
+
screen?: string;
|
|
239
|
+
data?: Record<string, any | {
|
|
240
|
+
error_message?: string;
|
|
241
|
+
}>;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* WhatsApp Flow Endpoint - Success Screen Response
|
|
245
|
+
* The expected response structure for success screen requests
|
|
246
|
+
*/
|
|
247
|
+
interface FlowSuccessScreenResponse {
|
|
248
|
+
screen: 'SUCCESS';
|
|
249
|
+
data: {
|
|
250
|
+
extension_message_response?: {
|
|
251
|
+
params?: {
|
|
252
|
+
flow_token: string;
|
|
253
|
+
[key: string]: string;
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* WhatsApp Flow Endpoint - Error Notification Request
|
|
260
|
+
* Represents the structure of an error notification request
|
|
261
|
+
*/
|
|
262
|
+
interface FlowErrorNotificationRequest {
|
|
263
|
+
version: '3.0';
|
|
264
|
+
action: Exclude<FlowActionEnum, FlowActionEnum.BACK>;
|
|
265
|
+
screen: string;
|
|
266
|
+
flow_token: string;
|
|
267
|
+
data: {
|
|
268
|
+
error: string;
|
|
269
|
+
error_message: string;
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* WhatsApp Flow Endpoint - Error Notification Response
|
|
274
|
+
* The expected response structure for error notification requests
|
|
275
|
+
*/
|
|
276
|
+
interface FlowErrorNotificationResponse {
|
|
277
|
+
acknowledged: boolean;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* WhatsApp Flow Endpoint - Comprehensive Request Object
|
|
281
|
+
* A combined type that includes all possible fields from different request types
|
|
282
|
+
* with all fields being optional for flexibility
|
|
283
|
+
*/
|
|
284
|
+
interface FlowEndpointRequest {
|
|
285
|
+
version?: '3.0';
|
|
286
|
+
action?: 'ping' | FlowActionEnum;
|
|
287
|
+
screen?: string;
|
|
288
|
+
flow_token?: string;
|
|
289
|
+
data?: Record<string, any> & {
|
|
290
|
+
error_key?: string;
|
|
291
|
+
error_message?: string;
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* WhatsApp Flow Endpoint - Response
|
|
296
|
+
* Union type for all possible response types from a Flow endpoint
|
|
297
|
+
*/
|
|
298
|
+
type FlowEndpointResponse = FlowHealthCheckResponse | FlowDataExchangeResponse | FlowErrorNotificationResponse | FlowSuccessScreenResponse;
|
|
299
|
+
interface FlowClass {
|
|
300
|
+
/**
|
|
301
|
+
* List Flows
|
|
302
|
+
*
|
|
303
|
+
* @param wabaId - The WABA ID
|
|
304
|
+
* @returns Promise with the list of flows
|
|
305
|
+
*/
|
|
306
|
+
listFlows(wabaId: string): Promise<FlowsListResponse>;
|
|
307
|
+
/**
|
|
308
|
+
* Create Flow
|
|
309
|
+
*
|
|
310
|
+
* @param wabaId - The WABA ID
|
|
311
|
+
* @param data - The flow data including name, categories, endpoint_uri, and optional clone_flow_id
|
|
312
|
+
* @returns Promise with the created flow ID
|
|
313
|
+
*/
|
|
314
|
+
createFlow(wabaId: string, data: {
|
|
315
|
+
name: string;
|
|
316
|
+
categories?: FlowCategoryEnum[];
|
|
317
|
+
endpoint_uri?: string;
|
|
318
|
+
clone_flow_id?: string;
|
|
319
|
+
flow_json?: string;
|
|
320
|
+
publish?: boolean;
|
|
321
|
+
}): Promise<CreateFlowResponse>;
|
|
322
|
+
/**
|
|
323
|
+
* Get Flow
|
|
324
|
+
*
|
|
325
|
+
* @param flowId - The flow ID
|
|
326
|
+
* @param fields - Optional fields to return
|
|
327
|
+
* @param dateFormat - Optional date format
|
|
328
|
+
* @returns Promise with the flow details
|
|
329
|
+
*/
|
|
330
|
+
getFlow(flowId: string, fields?: string, dateFormat?: string): Promise<Flow | FlowPreviewResponse>;
|
|
331
|
+
/**
|
|
332
|
+
* Update Flow Metadata
|
|
333
|
+
*
|
|
334
|
+
* @param flowId - The flow ID
|
|
335
|
+
* @param data - The flow metadata to update
|
|
336
|
+
* @returns Promise with the success status
|
|
337
|
+
*/
|
|
338
|
+
updateFlowMetadata(flowId: string, data: {
|
|
339
|
+
name?: string;
|
|
340
|
+
categories?: FlowCategoryEnum[];
|
|
341
|
+
endpoint_uri?: string;
|
|
342
|
+
application_id?: string;
|
|
343
|
+
}): Promise<ResponseSuccess>;
|
|
344
|
+
/**
|
|
345
|
+
* Delete Flow
|
|
346
|
+
*
|
|
347
|
+
* @param flowId - The flow ID
|
|
348
|
+
* @returns Promise with the success status
|
|
349
|
+
*/
|
|
350
|
+
deleteFlow(flowId: string): Promise<ResponseSuccess>;
|
|
351
|
+
/**
|
|
352
|
+
* List Assets (Get Flow JSON URL)
|
|
353
|
+
*
|
|
354
|
+
* @param flowId - The flow ID
|
|
355
|
+
* @returns Promise with the list of assets
|
|
356
|
+
*/
|
|
357
|
+
listAssets(flowId: string): Promise<FlowAssetsResponse>;
|
|
358
|
+
/**
|
|
359
|
+
* Update Flow JSON
|
|
360
|
+
*
|
|
361
|
+
* @param flowId - The flow ID
|
|
362
|
+
* @param data - The asset data including asset_type, file, and name
|
|
363
|
+
* @returns Promise with the success status and validation errors
|
|
364
|
+
*/
|
|
365
|
+
updateFlowJson(flowId: string, data: {
|
|
366
|
+
file: Blob | Buffer | object;
|
|
367
|
+
name?: string;
|
|
368
|
+
}): Promise<UpdateFlowResponse>;
|
|
369
|
+
/**
|
|
370
|
+
* Validate Flow JSON by attempting an update without publishing.
|
|
371
|
+
* This is a convenience method; the API doesn't have a dedicated validation endpoint.
|
|
372
|
+
*
|
|
373
|
+
* @param flowId - The ID of the Flow (must exist, can be in DRAFT status).
|
|
374
|
+
* @param flowJsonData - The Flow JSON content as a Buffer, JSON object, or Blob.
|
|
375
|
+
* @returns Promise indicating if the JSON is valid and includes validation errors if any.
|
|
376
|
+
*/
|
|
377
|
+
validateFlowJson(flowId: string, flowJsonData: Blob | Buffer | object): Promise<ValidateFlowJsonResponse>;
|
|
378
|
+
/**
|
|
379
|
+
* Publish Flow
|
|
380
|
+
*
|
|
381
|
+
* @param flowId - The flow ID
|
|
382
|
+
* @returns Promise with the success status
|
|
383
|
+
*/
|
|
384
|
+
publishFlow(flowId: string): Promise<ResponseSuccess>;
|
|
385
|
+
/**
|
|
386
|
+
* Deprecate Flow
|
|
387
|
+
*
|
|
388
|
+
* @param flowId - The flow ID
|
|
389
|
+
* @returns Promise with the success status
|
|
390
|
+
*/
|
|
391
|
+
deprecateFlow(flowId: string): Promise<ResponseSuccess>;
|
|
392
|
+
/**
|
|
393
|
+
* Migrate Flows
|
|
394
|
+
*
|
|
395
|
+
* @param wabaId - The destination WABA ID
|
|
396
|
+
* @param data - The migration data including source_waba_id and optional source_flow_names
|
|
397
|
+
* @returns Promise with migration results
|
|
398
|
+
*/
|
|
399
|
+
migrateFlows(wabaId: string, data: {
|
|
400
|
+
source_waba_id: string;
|
|
401
|
+
source_flow_names?: string[];
|
|
402
|
+
}): Promise<FlowMigrationResponse>;
|
|
403
|
+
}
|
|
404
|
+
//#endregion
|
|
405
|
+
export { CreateFlowResponse, Flow, FlowActionEnum, FlowAsset, FlowAssetsResponse, 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, Pagination, PaginationCursors, UpdateFlowResponse, ValidateFlowJsonResponse };
|
|
406
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","names":[],"sources":["../../../../src/api/flow/types/common.ts"],"sourcesContent":[],"mappings":";;;;;;;AAMA;AAWY,aAXA,cAAA;EAsBA,KAAA,GAAA,OAAA;EAUA,SAAA,GAAA,WAAY;EAWZ,SAAA,GAAQ,WAAA;EAAA,OAAA,GAAA,SAAA;YAAW,GAAA,YAAA;;;AAK/B;AAWA;AAciB,aA9DL,gBAAA;EA8DS,MAAA,GAAA,SAAA;QAGT,GAAA,SAAA;oBACI,GAAA,qBAAA;gBACO,GAAA,iBAAA;EAAmB,SAAA,GAAA,YAAA;EAMzB,eAAA,GAAA,kBAAiB;EAQjB,MAAA,GAAA,QAAU;EAOV,KAAA,GAAA,OAAA;;AACP,aA9EE,cAAA;MA+EA,GAAA,MAAA;EAAU,IAAA,GAAA,MAAA;EAML,aAAS,GAAA,eAAA;AAS1B;;;;;AAQiB,aA5FL,YAAA;EAoGK;EAQA,IAAA,GAAA,MAAA;EASA;EASA,MAAA,GAAA,eAAkB;EASlB;EAQA,KAAA,GAAA,OAAA;EAAqB;KAClB,GAAA,GAAA;;AACkB,KAtI1B,QAAA,GAsI0B,CAAA,OAtIP,YAsIO,CAAA,CAAA,MAAA,OAtIoB,YAsIpB,CAAA;AAMtC;AAUA;AAUA;AAA6C,UA3J5B,0BAAA,CA2J4B;Y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QAC/B;WACG;;;;;;UAOI,sBAAA;;;;;;;;UASA,uBAAA;;;;;;;;;UAUA,uBAAA;;UAEL;;;SAGD;;;;;;;;UAOM,wBAAA;;SAEN;;;;;;;;UAOM,yBAAA;;;;;;;;;;;;;;;UAgBA,4BAAA;;UAEL,QAAQ,gBAAgB,cAAA,CAAe;;;;;;;;;;;;UAalC,6BAAA;;;;;;;;UASA,mBAAA;;oBAGK;;;SAKX;;;;;;;;;KAUC,oBAAA,GACN,0BACA,2BACA,gCACA;UAEW,SAAA;;;;;;;6BAOc,QAAQ;;;;;;;;;;iBAad;;;;;MAMlB,QAAQ;;;;;;;;;iEAUoD,QAAQ,OAAO;;;;;;;;;;iBAazD;;;MAIlB,QAAQ;;;;;;;8BAQiB,QAAQ;;;;;;;8BAQR,QAAQ;;;;;;;;;UAYtB,OAAO;;MAGlB,QAAQ;;;;;;;;;iDAUoC,OAAO,kBAAkB,QAAQ;;;;;;;+BAQnD,QAAQ;;;;;;;iCAQN,QAAQ;;;;;;;;;;;MAepC,QAAQ"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
//#region src/api/flow/types/common.ts
|
|
2
|
+
/**
|
|
3
|
+
* Enum for Flow Status
|
|
4
|
+
*/
|
|
5
|
+
let FlowStatusEnum = /* @__PURE__ */ function(FlowStatusEnum$1) {
|
|
6
|
+
FlowStatusEnum$1["Draft"] = "DRAFT";
|
|
7
|
+
FlowStatusEnum$1["Published"] = "PUBLISHED";
|
|
8
|
+
FlowStatusEnum$1["Throttled"] = "THROTTLED";
|
|
9
|
+
FlowStatusEnum$1["Blocked"] = "BLOCKED";
|
|
10
|
+
FlowStatusEnum$1["Deprecated"] = "DEPRECATED";
|
|
11
|
+
return FlowStatusEnum$1;
|
|
12
|
+
}({});
|
|
13
|
+
/**
|
|
14
|
+
* Enum for Flow Categories
|
|
15
|
+
*/
|
|
16
|
+
let FlowCategoryEnum = /* @__PURE__ */ function(FlowCategoryEnum$1) {
|
|
17
|
+
FlowCategoryEnum$1["SignUp"] = "SIGN_UP";
|
|
18
|
+
FlowCategoryEnum$1["SignIn"] = "SIGN_IN";
|
|
19
|
+
FlowCategoryEnum$1["AppointmentBooking"] = "APPOINTMENT_BOOKING";
|
|
20
|
+
FlowCategoryEnum$1["LeadGeneration"] = "LEAD_GENERATION";
|
|
21
|
+
FlowCategoryEnum$1["ContactUs"] = "CONTACT_US";
|
|
22
|
+
FlowCategoryEnum$1["CustomerSupport"] = "CUSTOMER_SUPPORT";
|
|
23
|
+
FlowCategoryEnum$1["Survey"] = "SURVEY";
|
|
24
|
+
FlowCategoryEnum$1["Other"] = "OTHER";
|
|
25
|
+
return FlowCategoryEnum$1;
|
|
26
|
+
}({});
|
|
27
|
+
let FlowActionEnum = /* @__PURE__ */ function(FlowActionEnum$1) {
|
|
28
|
+
FlowActionEnum$1["INIT"] = "INIT";
|
|
29
|
+
FlowActionEnum$1["BACK"] = "BACK";
|
|
30
|
+
FlowActionEnum$1["DATA_EXCHANGE"] = "data_exchange";
|
|
31
|
+
return FlowActionEnum$1;
|
|
32
|
+
}({});
|
|
33
|
+
/**
|
|
34
|
+
* Enum for Flow Types in webhook handlers
|
|
35
|
+
* Used to register handlers for specific flow events
|
|
36
|
+
*/
|
|
37
|
+
let FlowTypeEnum = /* @__PURE__ */ function(FlowTypeEnum$1) {
|
|
38
|
+
/** Health check/ping requests */
|
|
39
|
+
FlowTypeEnum$1["Ping"] = "ping";
|
|
40
|
+
/** Data exchange requests */
|
|
41
|
+
FlowTypeEnum$1["Change"] = "data_exchange";
|
|
42
|
+
/** Error notification requests */
|
|
43
|
+
FlowTypeEnum$1["Error"] = "error";
|
|
44
|
+
/** Match all flow action types */
|
|
45
|
+
FlowTypeEnum$1["All"] = "*";
|
|
46
|
+
return FlowTypeEnum$1;
|
|
47
|
+
}({});
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
export { FlowActionEnum, FlowCategoryEnum, FlowStatusEnum, FlowTypeEnum };
|
|
51
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","names":[],"sources":["../../../../src/api/flow/types/common.ts"],"sourcesContent":["import { ResponseSuccess } from '../../../types';\nimport { IncomingHttpHeaders, IncomingMessage } from 'http';\n\n/**\n * Enum for Flow Status\n */\nexport enum FlowStatusEnum {\n Draft = 'DRAFT',\n Published = 'PUBLISHED',\n Throttled = 'THROTTLED',\n Blocked = 'BLOCKED',\n Deprecated = 'DEPRECATED',\n}\n\n/**\n * Enum for Flow Categories\n */\nexport enum FlowCategoryEnum {\n SignUp = 'SIGN_UP',\n SignIn = 'SIGN_IN',\n AppointmentBooking = 'APPOINTMENT_BOOKING',\n LeadGeneration = 'LEAD_GENERATION',\n ContactUs = 'CONTACT_US',\n CustomerSupport = 'CUSTOMER_SUPPORT',\n Survey = 'SURVEY',\n Other = 'OTHER',\n}\n\nexport enum FlowActionEnum {\n INIT = 'INIT',\n BACK = 'BACK',\n DATA_EXCHANGE = 'data_exchange',\n}\n\n/**\n * Enum for Flow Types in webhook handlers\n * Used to register handlers for specific flow events\n */\nexport enum FlowTypeEnum {\n /** Health check/ping requests */\n Ping = 'ping',\n /** Data exchange requests */\n Change = 'data_exchange',\n /** Error notification requests */\n Error = 'error',\n /** Match all flow action types */\n All = '*',\n}\n\nexport type FlowType = (typeof FlowTypeEnum)[keyof typeof FlowTypeEnum];\n\n/**\n * Flow Validation Error Pointer\n */\nexport interface FlowValidationErrorPointer {\n line_start: number;\n line_end: number;\n column_start: number;\n column_end: number;\n path: string;\n}\n\n/**\n * Flow Validation Error\n */\nexport interface FlowValidationError {\n error: string;\n error_type: string;\n message: string;\n line_start: number;\n line_end: number;\n column_start: number;\n column_end: number;\n pointers: FlowValidationErrorPointer[];\n}\n\n/**\n * Flow Item\n */\nexport interface Flow {\n id: string;\n name: string;\n status: FlowStatusEnum;\n categories: FlowCategoryEnum[];\n validation_errors: FlowValidationError[];\n}\n\n/**\n * Pagination Cursors\n */\nexport interface PaginationCursors {\n before: string;\n after: string;\n}\n\n/**\n * Pagination Object\n */\nexport interface Pagination {\n cursors: PaginationCursors;\n}\n\n/**\n * Flows List Response\n */\nexport interface FlowsListResponse {\n data: Flow[];\n paging: Pagination;\n}\n\n/**\n * Flow Asset\n */\nexport interface FlowAsset {\n name: string;\n asset_type: string;\n download_url: string;\n}\n\n/**\n * Flow Assets Response\n */\nexport interface FlowAssetsResponse {\n data: FlowAsset[];\n paging: Pagination;\n}\n\n/**\n * Flow Preview\n */\nexport interface FlowPreview {\n preview_url: string;\n expires_at: string;\n}\n\n/**\n * Flow Preview Response\n */\nexport interface FlowPreviewResponse {\n preview: FlowPreview;\n id: string;\n}\n\n/**\n * Flow Migration Result\n */\nexport interface FlowMigrationResult {\n source_name: string;\n source_id: string;\n migrated_id: string;\n}\n\n/**\n * Flow Migration Failure\n */\nexport interface FlowMigrationFailure {\n source_name: string;\n error_code: string;\n error_message: string;\n}\n\n/**\n * Create Flow Response\n */\nexport interface CreateFlowResponse {\n id: string;\n success: boolean;\n validation_errors?: FlowValidationError[];\n}\n\n/**\n * Update Flow Response\n */\nexport interface UpdateFlowResponse {\n success: boolean;\n validation_errors?: FlowValidationError[];\n}\n\n/**\n * Flow Migration Response\n */\nexport interface FlowMigrationResponse {\n migrated_flows: FlowMigrationResult[];\n failed_flows: FlowMigrationFailure[];\n}\n\n/**\n * Validate Flow JSON Response\n */\nexport interface ValidateFlowJsonResponse {\n valid: boolean;\n success: boolean;\n validation_errors?: FlowValidationError[];\n}\n\n/**\n * WhatsApp Flow Endpoint - Encrypted Request Payload\n * Represents the raw encrypted data received from WhatsApp\n */\nexport interface FlowEncryptedRequestPayload {\n encrypted_aes_key: string;\n encrypted_flow_data: string;\n initial_vector: string;\n}\n\n/**\n * WhatsApp Flow Endpoint - Decrypted Request Response\n * Represents the successfully decrypted data and encryption keys\n */\nexport interface FlowDecryptedRequestResponse {\n decryptedBody: any;\n aesKeyBuffer: Buffer;\n initialVectorBuffer: Buffer;\n}\n\n/**\n * WhatsApp Flow Endpoint - HTTP Request with Body\n * Represents an HTTP request with the encrypted payload\n */\nexport interface FlowHttpRequest extends IncomingMessage {\n body: FlowEncryptedRequestPayload;\n headers: IncomingHttpHeaders;\n}\n\n/**\n * WhatsApp Flow Endpoint - Health Check Request\n * Represents the structure of a health check request\n */\nexport interface FlowHealthCheckRequest {\n action: 'ping';\n version: '3.0';\n}\n\n/**\n * WhatsApp Flow Endpoint - Health Check Response\n * The expected response structure for health check requests\n */\nexport interface FlowHealthCheckResponse {\n data: {\n status: 'active';\n };\n}\n\n/**\n * WhatsApp Flow Endpoint - Data Exchange Request\n * Represents the structure of a data exchange request\n */\nexport interface FlowDataExchangeRequest {\n version: '3.0';\n action: FlowActionEnum;\n screen: string;\n flow_token: string;\n data?: Record<string, any> & { error_message?: string };\n}\n\n/**\n * WhatsApp Flow Endpoint - Data Exchange Response\n * The expected response structure for data exchange requests\n */\nexport interface FlowDataExchangeResponse {\n screen?: string;\n data?: Record<string, any | { error_message?: string }>;\n}\n\n/**\n * WhatsApp Flow Endpoint - Success Screen Response\n * The expected response structure for success screen requests\n */\nexport interface FlowSuccessScreenResponse {\n screen: 'SUCCESS';\n data: {\n extension_message_response?: {\n params?: {\n flow_token: string;\n [key: string]: string;\n };\n };\n };\n}\n\n/**\n * WhatsApp Flow Endpoint - Error Notification Request\n * Represents the structure of an error notification request\n */\nexport interface FlowErrorNotificationRequest {\n version: '3.0';\n action: Exclude<FlowActionEnum, FlowActionEnum.BACK>;\n screen: string;\n flow_token: string;\n data: {\n error: string;\n error_message: string;\n };\n}\n\n/**\n * WhatsApp Flow Endpoint - Error Notification Response\n * The expected response structure for error notification requests\n */\nexport interface FlowErrorNotificationResponse {\n acknowledged: boolean;\n}\n\n/**\n * WhatsApp Flow Endpoint - Comprehensive Request Object\n * A combined type that includes all possible fields from different request types\n * with all fields being optional for flexibility\n */\nexport interface FlowEndpointRequest {\n // Common fields\n version?: '3.0';\n action?: 'ping' | FlowActionEnum;\n\n screen?: string;\n flow_token?: string;\n\n data?: Record<string, any> & {\n error_key?: string;\n error_message?: string;\n };\n}\n\n/**\n * WhatsApp Flow Endpoint - Response\n * Union type for all possible response types from a Flow endpoint\n */\nexport type FlowEndpointResponse =\n | FlowHealthCheckResponse\n | FlowDataExchangeResponse\n | FlowErrorNotificationResponse\n | FlowSuccessScreenResponse;\n\nexport interface FlowClass {\n /**\n * List Flows\n *\n * @param wabaId - The WABA ID\n * @returns Promise with the list of flows\n */\n listFlows(wabaId: string): Promise<FlowsListResponse>;\n\n /**\n * Create Flow\n *\n * @param wabaId - The WABA ID\n * @param data - The flow data including name, categories, endpoint_uri, and optional clone_flow_id\n * @returns Promise with the created flow ID\n */\n createFlow(\n wabaId: string,\n data: {\n name: string;\n categories?: FlowCategoryEnum[];\n endpoint_uri?: string;\n clone_flow_id?: string;\n flow_json?: string;\n publish?: boolean;\n },\n ): Promise<CreateFlowResponse>;\n\n /**\n * Get Flow\n *\n * @param flowId - The flow ID\n * @param fields - Optional fields to return\n * @param dateFormat - Optional date format\n * @returns Promise with the flow details\n */\n getFlow(flowId: string, fields?: string, dateFormat?: string): Promise<Flow | FlowPreviewResponse>;\n\n /**\n * Update Flow Metadata\n *\n * @param flowId - The flow ID\n * @param data - The flow metadata to update\n * @returns Promise with the success status\n */\n updateFlowMetadata(\n flowId: string,\n data: {\n name?: string;\n categories?: FlowCategoryEnum[];\n endpoint_uri?: string;\n application_id?: string;\n },\n ): Promise<ResponseSuccess>;\n\n /**\n * Delete Flow\n *\n * @param flowId - The flow ID\n * @returns Promise with the success status\n */\n deleteFlow(flowId: string): Promise<ResponseSuccess>;\n\n /**\n * List Assets (Get Flow JSON URL)\n *\n * @param flowId - The flow ID\n * @returns Promise with the list of assets\n */\n listAssets(flowId: string): Promise<FlowAssetsResponse>;\n\n /**\n * Update Flow JSON\n *\n * @param flowId - The flow ID\n * @param data - The asset data including asset_type, file, and name\n * @returns Promise with the success status and validation errors\n */\n updateFlowJson(\n flowId: string,\n data: {\n file: Blob | Buffer | object;\n name?: string;\n },\n ): Promise<UpdateFlowResponse>;\n\n /**\n * Validate Flow JSON by attempting an update without publishing.\n * This is a convenience method; the API doesn't have a dedicated validation endpoint.\n *\n * @param flowId - The ID of the Flow (must exist, can be in DRAFT status).\n * @param flowJsonData - The Flow JSON content as a Buffer, JSON object, or Blob.\n * @returns Promise indicating if the JSON is valid and includes validation errors if any.\n */\n validateFlowJson(flowId: string, flowJsonData: Blob | Buffer | object): Promise<ValidateFlowJsonResponse>;\n\n /**\n * Publish Flow\n *\n * @param flowId - The flow ID\n * @returns Promise with the success status\n */\n publishFlow(flowId: string): Promise<ResponseSuccess>;\n\n /**\n * Deprecate Flow\n *\n * @param flowId - The flow ID\n * @returns Promise with the success status\n */\n deprecateFlow(flowId: string): Promise<ResponseSuccess>;\n\n /**\n * Migrate Flows\n *\n * @param wabaId - The destination WABA ID\n * @param data - The migration data including source_waba_id and optional source_flow_names\n * @returns Promise with migration results\n */\n migrateFlows(\n wabaId: string,\n data: {\n source_waba_id: string;\n source_flow_names?: string[];\n },\n ): Promise<FlowMigrationResponse>;\n}\n"],"mappings":";;;;AAMA,IAAY,4DAAL;AACH;AACA;AACA;AACA;AACA;;;;;;AAMJ,IAAY,gEAAL;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGJ,IAAY,4DAAL;AACH;AACA;AACA;;;;;;;AAOJ,IAAY,wDAAL;;AAEH;;AAEA;;AAEA;;AAEA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { CreateFlowResponse, Flow, FlowActionEnum, FlowAsset, FlowAssetsResponse, 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, Pagination, PaginationCursors, UpdateFlowResponse, ValidateFlowJsonResponse } from "./common.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { FlowActionEnum, FlowCategoryEnum, FlowStatusEnum, FlowTypeEnum } from "./common.js";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ResponseSuccess } from "../../../types/request.js";
|
|
2
|
+
|
|
3
|
+
//#region src/api/media/types/common.d.ts
|
|
4
|
+
type MediaResponse = {
|
|
5
|
+
id: string;
|
|
6
|
+
url: string;
|
|
7
|
+
mime_type: string;
|
|
8
|
+
sha256: string;
|
|
9
|
+
file_size: number;
|
|
10
|
+
messaging_product: 'whatsapp';
|
|
11
|
+
};
|
|
12
|
+
type MediasResponse = {
|
|
13
|
+
data: MediaResponse[];
|
|
14
|
+
paging: {
|
|
15
|
+
cursors: {
|
|
16
|
+
before: string;
|
|
17
|
+
after: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
type UploadMediaResponse = {
|
|
22
|
+
id: string;
|
|
23
|
+
};
|
|
24
|
+
interface MediaClass {
|
|
25
|
+
getMediaById(mediaId: string, phone_number_id?: string): Promise<MediaResponse>;
|
|
26
|
+
uploadMedia(file: File, messagingProduct?: string): Promise<UploadMediaResponse>;
|
|
27
|
+
deleteMedia(mediaId: string, phone_number_id?: string): Promise<ResponseSuccess>;
|
|
28
|
+
downloadMedia(mediaUrl: string): Promise<Blob>;
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { MediaClass, MediaResponse, MediasResponse, UploadMediaResponse };
|
|
32
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","names":[],"sources":["../../../../src/api/media/types/common.ts"],"sourcesContent":[],"mappings":";;;KAEY,aAAA;;EAAA,GAAA,EAAA,MAAA;EASA,SAAA,EAAA,MAAc;EAUd,MAAA,EAAA,MAAA;EAIK,SAAA,EAAA,MAAU;EAAA,iBAAA,EAAA,UAAA;;AACkC,KAfjD,cAAA,GAeiD;MACvC,EAfZ,aAeY,EAAA;QAA0C,EAAA;IAAR,OAAA,EAAA;MACY,MAAA,EAAA,MAAA;MAAR,KAAA,EAAA,MAAA;IACf,CAAA;;CAAD;KARhC,mBAAA;;;UAIK,UAAA;2DAC4C,QAAQ;oBAC/C,kCAAkC,QAAQ;0DACJ,QAAQ;mCAC/B,QAAQ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { MediaClass, MediaResponse, MediasResponse, UploadMediaResponse } from "./common.js";
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { ComponentTypesEnum, InteractiveTypesEnum, MessageTypesEnum } from "../../../types/enums.js";
|
|
2
|
+
import { GeneralRequestBody } from "../../../types/request.js";
|
|
3
|
+
import { BaseClass } from "../../../types/base.js";
|
|
4
|
+
import { TextMessageParams } from "./text.js";
|
|
5
|
+
import { MessageTemplateObject } from "./template.js";
|
|
6
|
+
import { AudioMediaObject, DocumentMediaObject, ImageMediaObject, StickerMediaObject, VideoMediaObject } from "./media.js";
|
|
7
|
+
import { ContactObject } from "./contact.js";
|
|
8
|
+
import { LocationObject } from "./location.js";
|
|
9
|
+
import { InteractiveObject } from "./interactive.js";
|
|
10
|
+
import { ReactionParams } from "./reaction.js";
|
|
11
|
+
|
|
12
|
+
//#region src/api/messages/types/common.d.ts
|
|
13
|
+
type GeneralMessageBody = GeneralRequestBody & {
|
|
14
|
+
/**
|
|
15
|
+
* The Meta messaging product name.
|
|
16
|
+
* @default 'whatsapp'
|
|
17
|
+
*/
|
|
18
|
+
messaging_product: 'whatsapp';
|
|
19
|
+
};
|
|
20
|
+
type StatusObject = {
|
|
21
|
+
status: 'read';
|
|
22
|
+
message_id: string;
|
|
23
|
+
typing_indicator?: TypingIndicatorObject;
|
|
24
|
+
};
|
|
25
|
+
type TypingIndicatorObject = {
|
|
26
|
+
type: 'text';
|
|
27
|
+
};
|
|
28
|
+
type StatusRequestBody = GeneralMessageBody & StatusObject;
|
|
29
|
+
type ConTextObject = {
|
|
30
|
+
message_id: string;
|
|
31
|
+
};
|
|
32
|
+
type MessageRequestBody<T extends MessageTypesEnum> = GeneralMessageBody & {
|
|
33
|
+
recipient_type?: string;
|
|
34
|
+
to: string;
|
|
35
|
+
context?: ConTextObject;
|
|
36
|
+
type?: T;
|
|
37
|
+
};
|
|
38
|
+
interface MessageRequestParams<T> {
|
|
39
|
+
body: T;
|
|
40
|
+
to: string;
|
|
41
|
+
replyMessageId?: string;
|
|
42
|
+
}
|
|
43
|
+
interface StatusParams {
|
|
44
|
+
status: string;
|
|
45
|
+
messageId: string;
|
|
46
|
+
typingIndicator?: {
|
|
47
|
+
type: string;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
type MessagesResponse = GeneralMessageBody & {
|
|
51
|
+
contacts: [{
|
|
52
|
+
input: string;
|
|
53
|
+
wa_id: string;
|
|
54
|
+
}];
|
|
55
|
+
messages: [{
|
|
56
|
+
id: string;
|
|
57
|
+
}];
|
|
58
|
+
};
|
|
59
|
+
declare class MessagesClass extends BaseClass {
|
|
60
|
+
text(params: TextMessageParams): Promise<MessagesResponse>;
|
|
61
|
+
template(params: MessageRequestParams<MessageTemplateObject<ComponentTypesEnum>>): Promise<MessagesResponse>;
|
|
62
|
+
audio(params: MessageRequestParams<AudioMediaObject>): Promise<MessagesResponse>;
|
|
63
|
+
document(params: MessageRequestParams<DocumentMediaObject>): Promise<MessagesResponse>;
|
|
64
|
+
image(params: MessageRequestParams<ImageMediaObject>): Promise<MessagesResponse>;
|
|
65
|
+
video(params: MessageRequestParams<VideoMediaObject>): Promise<MessagesResponse>;
|
|
66
|
+
sticker(params: MessageRequestParams<StickerMediaObject>): Promise<MessagesResponse>;
|
|
67
|
+
contacts(params: MessageRequestParams<[ContactObject]>): Promise<MessagesResponse>;
|
|
68
|
+
location(params: MessageRequestParams<LocationObject>): Promise<MessagesResponse>;
|
|
69
|
+
interactive(params: MessageRequestParams<InteractiveObject>): Promise<MessagesResponse>;
|
|
70
|
+
interactiveList(params: MessageRequestParams<InteractiveObject & {
|
|
71
|
+
type: InteractiveTypesEnum.List;
|
|
72
|
+
}>): Promise<MessagesResponse>;
|
|
73
|
+
interactiveCtaUrl(params: MessageRequestParams<InteractiveObject & {
|
|
74
|
+
type: InteractiveTypesEnum.CtaUrl;
|
|
75
|
+
}>): Promise<MessagesResponse>;
|
|
76
|
+
interactiveLocationRequest(params: MessageRequestParams<InteractiveObject & {
|
|
77
|
+
type: InteractiveTypesEnum.LocationRequest;
|
|
78
|
+
}>): Promise<MessagesResponse>;
|
|
79
|
+
interactiveAddressMessage(params: MessageRequestParams<InteractiveObject & {
|
|
80
|
+
type: InteractiveTypesEnum.AddressMessage;
|
|
81
|
+
}>): Promise<MessagesResponse>;
|
|
82
|
+
interactiveReplyButtons(params: MessageRequestParams<InteractiveObject & {
|
|
83
|
+
type: InteractiveTypesEnum.Button;
|
|
84
|
+
}>): Promise<MessagesResponse>;
|
|
85
|
+
interactiveFlow(params: MessageRequestParams<InteractiveObject & {
|
|
86
|
+
type: InteractiveTypesEnum.Flow;
|
|
87
|
+
}>): Promise<MessagesResponse>;
|
|
88
|
+
reaction(params: ReactionParams): Promise<MessagesResponse>;
|
|
89
|
+
markAsRead(params: {
|
|
90
|
+
messageId: string;
|
|
91
|
+
}): Promise<MessagesResponse>;
|
|
92
|
+
showTypingIndicator(params: {
|
|
93
|
+
messageId: string;
|
|
94
|
+
}): Promise<MessagesResponse>;
|
|
95
|
+
status(params: StatusParams): Promise<MessagesResponse>;
|
|
96
|
+
}
|
|
97
|
+
//#endregion
|
|
98
|
+
export { GeneralMessageBody, MessageRequestBody, MessageRequestParams, MessagesClass, MessagesResponse, StatusParams };
|
|
99
|
+
//# sourceMappingURL=common.d.ts.map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