@ecodrix/erix-api 1.0.1 → 1.0.3
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/cli.js +38 -0
- package/dist/index.d.cts +1871 -0
- package/dist/index.d.ts +902 -42
- package/dist/ts/browser/index.global.js +14 -14
- package/dist/ts/browser/index.global.js.map +1 -1
- package/dist/ts/cjs/index.cjs +1 -1
- package/dist/ts/cjs/index.cjs.map +1 -1
- package/dist/ts/cjs/index.d.cts +902 -42
- package/dist/ts/esm/index.d.ts +902 -42
- package/dist/ts/esm/index.js +1 -1
- package/dist/ts/esm/index.js.map +1 -1
- package/package.json +7 -2
- package/src/cli.ts +318 -0
- package/src/core.ts +20 -0
- package/src/index.ts +17 -1
- package/src/resource.ts +44 -5
- package/src/resources/crm/activities.ts +89 -0
- package/src/resources/crm/analytics.ts +89 -0
- package/src/resources/crm/automationDashboard.ts +24 -0
- package/src/resources/crm/automations.ts +145 -0
- package/src/resources/crm/index.ts +24 -0
- package/src/resources/crm/leads.ts +170 -42
- package/src/resources/crm/payments.ts +10 -0
- package/src/resources/crm/pipelines.ts +117 -0
- package/src/resources/crm/scoring.ts +33 -0
- package/src/resources/crm/sequences.ts +24 -0
- package/src/resources/events.ts +41 -0
- package/src/resources/health.ts +61 -0
- package/src/resources/marketing.ts +104 -0
- package/src/resources/meet.ts +9 -2
- package/src/resources/notifications.ts +30 -0
- package/src/resources/queue.ts +39 -0
- package/src/resources/storage.ts +72 -0
- package/src/resources/whatsapp/broadcasts.ts +31 -0
- package/src/resources/whatsapp/conversations.ts +34 -9
- package/src/resources/whatsapp/index.ts +20 -0
- package/src/resources/whatsapp/messages.ts +24 -0
- package/src/resources/whatsapp/templates.ts +99 -0
package/dist/ts/esm/index.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ declare abstract class APIResource {
|
|
|
16
16
|
constructor(client: AxiosInstance);
|
|
17
17
|
protected post<T>(url: string, data?: any, options?: RequestOptions): Promise<T>;
|
|
18
18
|
protected get<T>(url: string, options?: RequestOptions): Promise<T>;
|
|
19
|
+
protected patch<T>(url: string, data?: any, options?: RequestOptions): Promise<T>;
|
|
20
|
+
protected put<T>(url: string, data?: any, options?: RequestOptions): Promise<T>;
|
|
19
21
|
protected deleteRequest<T>(url: string, options?: RequestOptions): Promise<T>;
|
|
20
22
|
private buildConfig;
|
|
21
23
|
private handleError;
|
|
@@ -132,6 +134,20 @@ declare class Messages extends APIResource {
|
|
|
132
134
|
* ```
|
|
133
135
|
*/
|
|
134
136
|
sendTemplate(params: SendTemplateParams): Promise<unknown>;
|
|
137
|
+
/**
|
|
138
|
+
* Star or unstar a message.
|
|
139
|
+
*
|
|
140
|
+
* @param messageId - The ID of the message.
|
|
141
|
+
* @param isStarred - Boolean indicating whether to star or unstar.
|
|
142
|
+
*/
|
|
143
|
+
star<T = any>(messageId: string, isStarred: boolean): Promise<T>;
|
|
144
|
+
/**
|
|
145
|
+
* React to a message with an emoji.
|
|
146
|
+
*
|
|
147
|
+
* @param messageId - The ID of the message.
|
|
148
|
+
* @param reaction - The emoji (e.g. "👍") to react with, or empty string to remove.
|
|
149
|
+
*/
|
|
150
|
+
react<T = any>(messageId: string, reaction: string): Promise<T>;
|
|
135
151
|
/**
|
|
136
152
|
* Mark all messages in a conversation as read (double-tick).
|
|
137
153
|
*
|
|
@@ -148,28 +164,137 @@ declare class Messages extends APIResource {
|
|
|
148
164
|
interface ListParams {
|
|
149
165
|
limit?: number;
|
|
150
166
|
before?: string;
|
|
167
|
+
after?: string;
|
|
168
|
+
status?: string;
|
|
151
169
|
}
|
|
152
170
|
declare class Conversations extends APIResource {
|
|
153
171
|
/**
|
|
154
172
|
* List conversations for the tenant.
|
|
155
173
|
*/
|
|
156
|
-
list(params?: ListParams): Promise<
|
|
174
|
+
list<T = any>(params?: ListParams): Promise<T>;
|
|
175
|
+
/**
|
|
176
|
+
* Create a new conversation explicitly.
|
|
177
|
+
*
|
|
178
|
+
* @param params - Conversation details.
|
|
179
|
+
*/
|
|
180
|
+
create<T = any>(params: {
|
|
181
|
+
phone: string;
|
|
182
|
+
name?: string;
|
|
183
|
+
}): Promise<T>;
|
|
157
184
|
/**
|
|
158
185
|
* Retrieve details of a specific conversation.
|
|
159
186
|
*/
|
|
160
|
-
retrieve(conversationId: string): Promise<
|
|
187
|
+
retrieve<T = any>(conversationId: string): Promise<T>;
|
|
161
188
|
/**
|
|
162
189
|
* Get messages for a specific conversation.
|
|
163
190
|
*/
|
|
164
|
-
messages(conversationId: string, params?: ListParams): Promise<
|
|
191
|
+
messages<T = any>(conversationId: string, params?: ListParams): Promise<T>;
|
|
165
192
|
/**
|
|
166
193
|
* Link a conversation to a lead.
|
|
167
194
|
*/
|
|
168
|
-
linkLead(conversationId: string, leadId: string): Promise<
|
|
195
|
+
linkLead<T = any>(conversationId: string, leadId: string, leadData?: any): Promise<T>;
|
|
196
|
+
/**
|
|
197
|
+
* Mark a conversation as read (clear unread count).
|
|
198
|
+
*/
|
|
199
|
+
markRead<T = any>(conversationId: string): Promise<T>;
|
|
169
200
|
/**
|
|
170
201
|
* Delete a conversation.
|
|
171
202
|
*/
|
|
172
|
-
delete(conversationId: string): Promise<
|
|
203
|
+
delete(conversationId: string): Promise<unknown>;
|
|
204
|
+
/**
|
|
205
|
+
* Bulk delete conversations.
|
|
206
|
+
*/
|
|
207
|
+
bulkDelete(ids: string[]): Promise<unknown>;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
interface CreateBroadcastParams {
|
|
211
|
+
/** Optional name for the broadcast campaign */
|
|
212
|
+
name?: string;
|
|
213
|
+
/** Name of the Meta template to send */
|
|
214
|
+
templateName: string;
|
|
215
|
+
/** Language code (defaults to en_US) */
|
|
216
|
+
templateLanguage?: string;
|
|
217
|
+
/** List of recipients with their phone numbers and variable overrides */
|
|
218
|
+
recipients: {
|
|
219
|
+
phone: string;
|
|
220
|
+
variables?: string[];
|
|
221
|
+
}[];
|
|
222
|
+
}
|
|
223
|
+
declare class Broadcasts extends APIResource {
|
|
224
|
+
/**
|
|
225
|
+
* List past and active broadcasts.
|
|
226
|
+
*/
|
|
227
|
+
list<T = any>(params?: Record<string, any>): Promise<T>;
|
|
228
|
+
/**
|
|
229
|
+
* Create a new broadcast to send a template message to multiple recipients.
|
|
230
|
+
*/
|
|
231
|
+
create<T = any>(params: CreateBroadcastParams): Promise<T>;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
interface TemplateMapping {
|
|
235
|
+
mappings: any[];
|
|
236
|
+
onEmptyVariable: string;
|
|
237
|
+
}
|
|
238
|
+
declare class Templates extends APIResource {
|
|
239
|
+
/**
|
|
240
|
+
* List all templates from the tenant database.
|
|
241
|
+
*/
|
|
242
|
+
list<T = any>(params?: {
|
|
243
|
+
status?: string;
|
|
244
|
+
mappingStatus?: string;
|
|
245
|
+
channel?: string;
|
|
246
|
+
}): Promise<T>;
|
|
247
|
+
/**
|
|
248
|
+
* Synchronize templates from Meta API.
|
|
249
|
+
*/
|
|
250
|
+
sync<T = any>(): Promise<T>;
|
|
251
|
+
/**
|
|
252
|
+
* Get template details.
|
|
253
|
+
*/
|
|
254
|
+
retrieve<T = any>(templateIdentifier: string): Promise<T>;
|
|
255
|
+
/**
|
|
256
|
+
* Create a new template manually.
|
|
257
|
+
*/
|
|
258
|
+
create<T = any>(payload: any): Promise<T>;
|
|
259
|
+
/**
|
|
260
|
+
* Update an existing template.
|
|
261
|
+
*/
|
|
262
|
+
update<T = any>(templateId: string, payload: any): Promise<T>;
|
|
263
|
+
/**
|
|
264
|
+
* Delete a template.
|
|
265
|
+
*/
|
|
266
|
+
deleteTemplate<T = any>(templateName: string, force?: boolean): Promise<T>;
|
|
267
|
+
/**
|
|
268
|
+
* List curated mapping config options.
|
|
269
|
+
*/
|
|
270
|
+
mappingConfig<T = any>(): Promise<T>;
|
|
271
|
+
/**
|
|
272
|
+
* List CRM collections for variable mapping.
|
|
273
|
+
*/
|
|
274
|
+
collections<T = any>(): Promise<T>;
|
|
275
|
+
/**
|
|
276
|
+
* List CRM fields for a collection.
|
|
277
|
+
*/
|
|
278
|
+
collectionFields<T = any>(collectionName: string): Promise<T>;
|
|
279
|
+
/**
|
|
280
|
+
* Update variable mappings for a template.
|
|
281
|
+
*/
|
|
282
|
+
updateMapping<T = any>(templateName: string, payload: TemplateMapping): Promise<T>;
|
|
283
|
+
/**
|
|
284
|
+
* Validate mapping readiness.
|
|
285
|
+
*/
|
|
286
|
+
validate<T = any>(templateName: string): Promise<T>;
|
|
287
|
+
/**
|
|
288
|
+
* Preview a template resolution.
|
|
289
|
+
*/
|
|
290
|
+
preview<T = any>(templateName: string, context: {
|
|
291
|
+
lead?: any;
|
|
292
|
+
vars?: any;
|
|
293
|
+
}): Promise<T>;
|
|
294
|
+
/**
|
|
295
|
+
* Check automation usage of a template.
|
|
296
|
+
*/
|
|
297
|
+
checkUsage<T = any>(templateName: string): Promise<T>;
|
|
173
298
|
}
|
|
174
299
|
|
|
175
300
|
interface SendTemplatePayload {
|
|
@@ -187,7 +312,13 @@ interface SendTemplatePayload {
|
|
|
187
312
|
declare class WhatsApp extends APIResource {
|
|
188
313
|
messages: Messages;
|
|
189
314
|
conversations: Conversations;
|
|
315
|
+
broadcasts: Broadcasts;
|
|
316
|
+
templates: Templates;
|
|
190
317
|
constructor(client: AxiosInstance);
|
|
318
|
+
/**
|
|
319
|
+
* Upload an asset directly to chat storage.
|
|
320
|
+
*/
|
|
321
|
+
upload<T = any>(file: Blob | Buffer | File | any, filename: string): Promise<T>;
|
|
191
322
|
/**
|
|
192
323
|
* Dispatch a WhatsApp template message directly to a specific phone number.
|
|
193
324
|
* Bypasses the automation queue for immediate high-priority delivery.
|
|
@@ -203,6 +334,14 @@ declare class WhatsApp extends APIResource {
|
|
|
203
334
|
}>;
|
|
204
335
|
}
|
|
205
336
|
|
|
337
|
+
/**
|
|
338
|
+
* Valid statuses for a CRM Lead.
|
|
339
|
+
*/
|
|
340
|
+
type LeadStatus = "new" | "contacted" | "qualified" | "won" | "lost" | "archived";
|
|
341
|
+
/**
|
|
342
|
+
* Common lead acquisition sources. Additional string values are allowed.
|
|
343
|
+
*/
|
|
344
|
+
type LeadSource = "website" | "whatsapp" | "direct" | "referral" | string;
|
|
206
345
|
/**
|
|
207
346
|
* Parameters for creating a new CRM Lead.
|
|
208
347
|
*/
|
|
@@ -217,11 +356,50 @@ interface CreateLeadParams {
|
|
|
217
356
|
phone?: string;
|
|
218
357
|
/**
|
|
219
358
|
* Acquisition channel.
|
|
220
|
-
* @example "website" | "whatsapp" | "direct" | "referral"
|
|
221
359
|
*/
|
|
222
|
-
source?:
|
|
360
|
+
source?: LeadSource;
|
|
223
361
|
/** Arbitrary key-value metadata (UTM params, order IDs, etc.). */
|
|
224
362
|
metadata?: Record<string, any>;
|
|
363
|
+
/** Pipeline ID to assign the lead */
|
|
364
|
+
pipelineId?: string;
|
|
365
|
+
/** Stage ID to assign the lead */
|
|
366
|
+
stageId?: string;
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Options for listing leads.
|
|
370
|
+
*/
|
|
371
|
+
interface ListLeadsParams {
|
|
372
|
+
status?: LeadStatus;
|
|
373
|
+
pipelineId?: string;
|
|
374
|
+
stageId?: string;
|
|
375
|
+
source?: LeadSource;
|
|
376
|
+
assignedTo?: string;
|
|
377
|
+
tags?: string[] | string;
|
|
378
|
+
minScore?: number;
|
|
379
|
+
search?: string;
|
|
380
|
+
startDate?: string;
|
|
381
|
+
endDate?: string;
|
|
382
|
+
appointmentId?: string;
|
|
383
|
+
bookingId?: string;
|
|
384
|
+
orderId?: string;
|
|
385
|
+
meetingId?: string;
|
|
386
|
+
page?: number;
|
|
387
|
+
limit?: number;
|
|
388
|
+
sortBy?: string;
|
|
389
|
+
sortDir?: "asc" | "desc";
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Options for upserting a lead.
|
|
393
|
+
*/
|
|
394
|
+
interface UpsertLeadParams {
|
|
395
|
+
leadData: Partial<CreateLeadParams> & {
|
|
396
|
+
phone: string;
|
|
397
|
+
name?: string;
|
|
398
|
+
};
|
|
399
|
+
moduleInfo?: any;
|
|
400
|
+
trigger?: string;
|
|
401
|
+
pipelineId?: string;
|
|
402
|
+
stageId?: string;
|
|
225
403
|
}
|
|
226
404
|
/**
|
|
227
405
|
* CRM Lead resource — full lifecycle management.
|
|
@@ -243,16 +421,15 @@ declare class Leads extends APIResource {
|
|
|
243
421
|
*
|
|
244
422
|
* @param params - Lead creation parameters. `firstName` is required.
|
|
245
423
|
* @returns The newly created Lead document.
|
|
246
|
-
*
|
|
247
|
-
* @example
|
|
248
|
-
* ```typescript
|
|
249
|
-
* const { data } = await ecod.crm.leads.create({
|
|
250
|
-
* firstName: "Alice",
|
|
251
|
-
* phone: "+919876543210",
|
|
252
|
-
* });
|
|
253
|
-
* ```
|
|
254
424
|
*/
|
|
255
425
|
create<T = any>(params: CreateLeadParams): Promise<T>;
|
|
426
|
+
/**
|
|
427
|
+
* Upsert a lead by phone number. Creates if not exists, updates if exists.
|
|
428
|
+
*
|
|
429
|
+
* @param params - Upsert parameters containing leadData with a phone number.
|
|
430
|
+
* @returns The newly created or updated Lead document.
|
|
431
|
+
*/
|
|
432
|
+
upsert<T = any>(params: UpsertLeadParams): Promise<T>;
|
|
256
433
|
/**
|
|
257
434
|
* Bulk ingest leads efficiently in parallel using automatic chunking.
|
|
258
435
|
* Prevents rate limit exhaustion by executing `chunkSize` requests at a time.
|
|
@@ -262,71 +439,481 @@ declare class Leads extends APIResource {
|
|
|
262
439
|
* @returns Array of created lead results.
|
|
263
440
|
*/
|
|
264
441
|
createMany(leads: CreateLeadParams[], chunkSize?: number): Promise<any[]>;
|
|
442
|
+
/**
|
|
443
|
+
* Bulk upsert (import) leads.
|
|
444
|
+
*
|
|
445
|
+
* @param leads - Array of leads to import.
|
|
446
|
+
*/
|
|
447
|
+
import<T = any>(leads: Partial<CreateLeadParams>[]): Promise<T>;
|
|
265
448
|
/**
|
|
266
449
|
* List leads with optional filtering and pagination.
|
|
267
450
|
*
|
|
268
451
|
* @param params - Filter options (status, source, pipelineId, page, limit, etc.)
|
|
269
452
|
* @returns Paginated list of Lead documents.
|
|
270
|
-
*
|
|
271
|
-
* @example
|
|
272
|
-
* ```typescript
|
|
273
|
-
* const { data } = await ecod.crm.leads.list({ status: "new", limit: 25 });
|
|
274
|
-
* ```
|
|
275
453
|
*/
|
|
276
|
-
list<T = any>(params?:
|
|
454
|
+
list<T = any>(params?: ListLeadsParams): Promise<T>;
|
|
277
455
|
/**
|
|
278
456
|
* Auto-paginating iterator for leads.
|
|
279
457
|
* Seamlessly fetches leads page by page as you iterate.
|
|
280
458
|
*
|
|
281
459
|
* @example
|
|
282
460
|
* ```typescript
|
|
283
|
-
* for await (const lead of ecod.crm.leads.listAutoPaging(
|
|
461
|
+
* for await (const lead of ecod.crm.leads.listAutoPaging<Lead>()) {
|
|
284
462
|
* console.log(lead.firstName);
|
|
285
463
|
* }
|
|
286
464
|
* ```
|
|
287
465
|
*/
|
|
288
|
-
listAutoPaging(params?:
|
|
466
|
+
listAutoPaging<T = any>(params?: ListLeadsParams): AsyncGenerator<T, void, unknown>;
|
|
289
467
|
/**
|
|
290
468
|
* Retrieve a single lead by its unique ID.
|
|
291
469
|
*
|
|
292
470
|
* @param leadId - The MongoDB ObjectId of the lead.
|
|
293
471
|
* @returns The Lead document, or a 404 error if not found.
|
|
472
|
+
*/
|
|
473
|
+
retrieve<T = any>(leadId: string): Promise<T>;
|
|
474
|
+
/**
|
|
475
|
+
* Retrieve a single lead by its phone number.
|
|
294
476
|
*
|
|
295
|
-
* @
|
|
296
|
-
* ```typescript
|
|
297
|
-
* const { data } = await ecod.crm.leads.retrieve("64abc...");
|
|
298
|
-
* ```
|
|
477
|
+
* @param phone - Lead's phone number.
|
|
299
478
|
*/
|
|
300
|
-
|
|
479
|
+
retrieveByPhone<T = any>(phone: string): Promise<T>;
|
|
480
|
+
/**
|
|
481
|
+
* Retrieve a single lead by a reference key and value.
|
|
482
|
+
*
|
|
483
|
+
* @param refKey - Reference key metadata.
|
|
484
|
+
* @param refValue - Reference value.
|
|
485
|
+
*/
|
|
486
|
+
retrieveByRef<T = any>(refKey: string, refValue: string): Promise<T>;
|
|
301
487
|
/**
|
|
302
488
|
* Update the fields of an existing lead.
|
|
303
489
|
*
|
|
304
490
|
* @param leadId - The ID of the lead to update.
|
|
305
491
|
* @param params - Partial lead fields to update.
|
|
306
492
|
* @returns The updated Lead document.
|
|
493
|
+
*/
|
|
494
|
+
update<T = any>(leadId: string, params: Partial<CreateLeadParams>): Promise<T>;
|
|
495
|
+
/**
|
|
496
|
+
* Move a lead to a new stage in a pipeline.
|
|
307
497
|
*
|
|
308
|
-
* @
|
|
309
|
-
*
|
|
310
|
-
* await ecod.crm.leads.update("64abc...", { email: "new@email.com" });
|
|
311
|
-
* ```
|
|
498
|
+
* @param leadId - ID of the lead.
|
|
499
|
+
* @param stageId - Target stage ID.
|
|
312
500
|
*/
|
|
313
|
-
|
|
501
|
+
move<T = any>(leadId: string, stageId: string): Promise<T>;
|
|
314
502
|
/**
|
|
315
|
-
*
|
|
316
|
-
* for audit purposes but is excluded from all standard list views.
|
|
503
|
+
* Convert a lead (mark as won or lost with reason).
|
|
317
504
|
*
|
|
318
|
-
* @param leadId -
|
|
505
|
+
* @param leadId - ID of the lead.
|
|
506
|
+
* @param outcome - "won" | "lost"
|
|
507
|
+
* @param reason - Reason for the outcome.
|
|
508
|
+
*/
|
|
509
|
+
convert<T = any>(leadId: string, outcome: "won" | "lost", reason?: string): Promise<T>;
|
|
510
|
+
/**
|
|
511
|
+
* Update the tags of a lead.
|
|
319
512
|
*
|
|
320
|
-
* @
|
|
321
|
-
*
|
|
322
|
-
|
|
323
|
-
|
|
513
|
+
* @param leadId - ID of the lead.
|
|
514
|
+
* @param options - Tags to add or remove.
|
|
515
|
+
*/
|
|
516
|
+
tags<T = any>(leadId: string, options: {
|
|
517
|
+
add?: string[];
|
|
518
|
+
remove?: string[];
|
|
519
|
+
}): Promise<T>;
|
|
520
|
+
/**
|
|
521
|
+
* Recalculate lead score based on activities and interactions.
|
|
522
|
+
*
|
|
523
|
+
* @param leadId - ID of the lead.
|
|
524
|
+
*/
|
|
525
|
+
recalculateScore<T = any>(leadId: string): Promise<T>;
|
|
526
|
+
/**
|
|
527
|
+
* Update embedded metadata/references of a lead without touching core fields.
|
|
528
|
+
*
|
|
529
|
+
* @param leadId - ID of the lead.
|
|
530
|
+
* @param metadata - Metadata object indicating { refs, extra }
|
|
531
|
+
*/
|
|
532
|
+
updateMetadata<T = any>(leadId: string, metadata: {
|
|
533
|
+
refs?: Record<string, any>;
|
|
534
|
+
extra?: Record<string, any>;
|
|
535
|
+
}): Promise<T>;
|
|
536
|
+
/**
|
|
537
|
+
* Introspect available custom fields configured by the tenant limit.
|
|
538
|
+
*/
|
|
539
|
+
fields<T = any>(): Promise<T>;
|
|
540
|
+
/**
|
|
541
|
+
* Archive (soft-delete) a single lead.
|
|
542
|
+
*
|
|
543
|
+
* @param leadId - The ID of the lead to archive.
|
|
324
544
|
*/
|
|
325
545
|
delete(leadId: string): Promise<unknown>;
|
|
546
|
+
/**
|
|
547
|
+
* Bulk archive multiple leads.
|
|
548
|
+
*
|
|
549
|
+
* @param ids - Array of lead IDs to archive.
|
|
550
|
+
*/
|
|
551
|
+
bulkDelete(ids: string[]): Promise<unknown>;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
interface CreatePipelineParams {
|
|
555
|
+
name: string;
|
|
556
|
+
isDefault?: boolean;
|
|
557
|
+
stages?: any[];
|
|
558
|
+
}
|
|
559
|
+
interface PipelineStageParams {
|
|
560
|
+
name: string;
|
|
561
|
+
color?: string;
|
|
562
|
+
probability?: number;
|
|
563
|
+
}
|
|
564
|
+
declare class Pipelines extends APIResource {
|
|
565
|
+
/**
|
|
566
|
+
* List all pipelines matching the optional query parameters.
|
|
567
|
+
*/
|
|
568
|
+
list<T = any>(params?: Record<string, any>): Promise<T>;
|
|
569
|
+
/**
|
|
570
|
+
* Create a new pipeline.
|
|
571
|
+
*/
|
|
572
|
+
create<T = any>(params: CreatePipelineParams): Promise<T>;
|
|
573
|
+
/**
|
|
574
|
+
* Retrieve a single pipeline.
|
|
575
|
+
*/
|
|
576
|
+
retrieve<T = any>(pipelineId: string): Promise<T>;
|
|
577
|
+
/**
|
|
578
|
+
* Update a pipeline's details.
|
|
579
|
+
*/
|
|
580
|
+
update<T = any>(pipelineId: string, params: {
|
|
581
|
+
name?: string;
|
|
582
|
+
description?: string;
|
|
583
|
+
}): Promise<T>;
|
|
584
|
+
/**
|
|
585
|
+
* Set pipeline as the tenant's default.
|
|
586
|
+
*/
|
|
587
|
+
setDefault<T = any>(pipelineId: string): Promise<T>;
|
|
588
|
+
/**
|
|
589
|
+
* Duplicate a pipeline with a new name.
|
|
590
|
+
*/
|
|
591
|
+
duplicate<T = any>(pipelineId: string, newName: string): Promise<T>;
|
|
592
|
+
/**
|
|
593
|
+
* Archive a pipeline.
|
|
594
|
+
*/
|
|
595
|
+
archive<T = any>(pipelineId: string): Promise<T>;
|
|
596
|
+
/**
|
|
597
|
+
* Delete a pipeline permanently.
|
|
598
|
+
*/
|
|
599
|
+
delete(pipelineId: string): Promise<unknown>;
|
|
600
|
+
/**
|
|
601
|
+
* Retrieve a Kanban-style board representation of the pipeline with leads nested.
|
|
602
|
+
*/
|
|
603
|
+
board<T = any>(pipelineId: string): Promise<T>;
|
|
604
|
+
/**
|
|
605
|
+
* Retrieve a revenue forecast based on stage probabilities for a pipeline.
|
|
606
|
+
*/
|
|
607
|
+
forecast<T = any>(pipelineId: string): Promise<T>;
|
|
608
|
+
/**
|
|
609
|
+
* Add a new stage to the pipeline.
|
|
610
|
+
*/
|
|
611
|
+
addStage<T = any>(pipelineId: string, params: PipelineStageParams): Promise<T>;
|
|
612
|
+
/**
|
|
613
|
+
* Change the order of stages inside the pipeline.
|
|
614
|
+
*/
|
|
615
|
+
reorderStages<T = any>(pipelineId: string, orderArray: string[]): Promise<T>;
|
|
616
|
+
/**
|
|
617
|
+
* Update a specific stage.
|
|
618
|
+
*/
|
|
619
|
+
updateStage<T = any>(stageId: string, params: Partial<PipelineStageParams>): Promise<T>;
|
|
620
|
+
/**
|
|
621
|
+
* Delete a stage. Optionally provide a fallback stageId to move active leads to.
|
|
622
|
+
*/
|
|
623
|
+
deleteStage(stageId: string, moveLeadsToStageId?: string): Promise<unknown>;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
interface LogActivityParams {
|
|
627
|
+
leadId: string;
|
|
628
|
+
type: "note" | "call" | "email" | "meeting" | "whatsapp" | "system";
|
|
629
|
+
title: string;
|
|
630
|
+
body?: string;
|
|
631
|
+
metadata?: Record<string, any>;
|
|
632
|
+
}
|
|
633
|
+
interface LogCallParams {
|
|
634
|
+
durationMinutes: number;
|
|
635
|
+
summary: string;
|
|
636
|
+
outcome: "answered" | "no_answer" | "busy" | "voicemail" | "wrong_number";
|
|
637
|
+
}
|
|
638
|
+
declare class Notes extends APIResource {
|
|
639
|
+
/**
|
|
640
|
+
* List all notes for a specific lead.
|
|
641
|
+
*/
|
|
642
|
+
list<T = any>(leadId: string): Promise<T>;
|
|
643
|
+
/**
|
|
644
|
+
* Add a note to a lead.
|
|
645
|
+
*/
|
|
646
|
+
create<T = any>(leadId: string, params: {
|
|
647
|
+
content: string;
|
|
648
|
+
}): Promise<T>;
|
|
649
|
+
/**
|
|
650
|
+
* Update an existing note.
|
|
651
|
+
*/
|
|
652
|
+
update<T = any>(noteId: string, content: string): Promise<T>;
|
|
653
|
+
/**
|
|
654
|
+
* Pin or unpin a note to the top of the feed.
|
|
655
|
+
*/
|
|
656
|
+
pin<T = any>(noteId: string, isPinned?: boolean): Promise<T>;
|
|
657
|
+
/**
|
|
658
|
+
* Delete a note.
|
|
659
|
+
*/
|
|
660
|
+
delete(noteId: string): Promise<unknown>;
|
|
661
|
+
}
|
|
662
|
+
declare class Activities extends APIResource {
|
|
663
|
+
notes: Notes;
|
|
664
|
+
constructor(client: any);
|
|
665
|
+
/**
|
|
666
|
+
* Retrieve the complete chronological timeline for a lead.
|
|
667
|
+
*/
|
|
668
|
+
timeline<T = any>(leadId: string, params?: {
|
|
669
|
+
page?: number;
|
|
670
|
+
limit?: number;
|
|
671
|
+
}): Promise<T>;
|
|
672
|
+
/**
|
|
673
|
+
* List specific activities (filtered by type).
|
|
674
|
+
*/
|
|
675
|
+
list<T = any>(leadId: string, params?: {
|
|
676
|
+
type?: string;
|
|
677
|
+
page?: number;
|
|
678
|
+
limit?: number;
|
|
679
|
+
}): Promise<T>;
|
|
680
|
+
/**
|
|
681
|
+
* Generic method to log a business activity/event.
|
|
682
|
+
*/
|
|
683
|
+
log<T = any>(params: LogActivityParams): Promise<T>;
|
|
684
|
+
/**
|
|
685
|
+
* Specific method to log communication outcomes.
|
|
686
|
+
*/
|
|
687
|
+
logCall<T = any>(leadId: string, params: LogCallParams): Promise<T>;
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
type AnalyticsRange = "24h" | "7d" | "30d" | "60d" | "90d" | "365d";
|
|
691
|
+
interface AnalyticsParams {
|
|
692
|
+
range?: AnalyticsRange;
|
|
693
|
+
from?: string;
|
|
694
|
+
to?: string;
|
|
695
|
+
pipelineId?: string;
|
|
696
|
+
}
|
|
697
|
+
declare class Analytics extends APIResource {
|
|
698
|
+
/**
|
|
699
|
+
* KPIs: total leads, pipeline value, won revenue, avg score, conversion rate.
|
|
700
|
+
*/
|
|
701
|
+
overview<T = any>(params?: AnalyticsParams): Promise<T>;
|
|
702
|
+
/**
|
|
703
|
+
* Stage-by-stage lead counts and conversion percentages.
|
|
704
|
+
*/
|
|
705
|
+
funnel<T = any>(pipelineId: string): Promise<T>;
|
|
706
|
+
/**
|
|
707
|
+
* Revenue forecast: deal value × stage probability.
|
|
708
|
+
*/
|
|
709
|
+
forecast<T = any>(pipelineId?: string): Promise<T>;
|
|
710
|
+
/**
|
|
711
|
+
* Lead source breakdown: count, conversion rate, total value per source.
|
|
712
|
+
*/
|
|
713
|
+
sources<T = any>(params?: AnalyticsParams): Promise<T>;
|
|
714
|
+
/**
|
|
715
|
+
* Team leaderboard: won deals, revenue, activity count, conversion rate per member.
|
|
716
|
+
*/
|
|
717
|
+
team<T = any>(params?: AnalyticsParams): Promise<T>;
|
|
718
|
+
/**
|
|
719
|
+
* Daily activity counts by type. For activity calendar.
|
|
720
|
+
*/
|
|
721
|
+
heatmap<T = any>(params?: AnalyticsParams): Promise<T>;
|
|
722
|
+
/**
|
|
723
|
+
* Score distribution: how many leads in each score bucket.
|
|
724
|
+
*/
|
|
725
|
+
scores<T = any>(): Promise<T>;
|
|
726
|
+
/**
|
|
727
|
+
* Avg time leads spend in each stage. Helps find bottlenecks.
|
|
728
|
+
*/
|
|
729
|
+
stageTime<T = any>(pipelineId: string): Promise<T>;
|
|
730
|
+
/**
|
|
731
|
+
* Tiered Growth Report matching business sophistication.
|
|
732
|
+
*/
|
|
733
|
+
tiered<T = any>(params?: AnalyticsParams): Promise<T>;
|
|
734
|
+
/**
|
|
735
|
+
* Consolidated analytics including CRM overview and WhatsApp.
|
|
736
|
+
*/
|
|
737
|
+
summary<T = any>(params?: AnalyticsParams): Promise<T>;
|
|
738
|
+
/**
|
|
739
|
+
* WhatsApp volume and delivery analytics.
|
|
740
|
+
*/
|
|
741
|
+
whatsapp<T = any>(params?: AnalyticsParams): Promise<T>;
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
interface AutomationRulePayload {
|
|
745
|
+
name: string;
|
|
746
|
+
trigger: string;
|
|
747
|
+
isActive?: boolean;
|
|
748
|
+
nodes: any[];
|
|
749
|
+
edges: any[];
|
|
750
|
+
}
|
|
751
|
+
declare class Automations extends APIResource {
|
|
752
|
+
/**
|
|
753
|
+
* List all automation rules for the tenant.
|
|
754
|
+
*/
|
|
755
|
+
list<T = any>(): Promise<T>;
|
|
756
|
+
/**
|
|
757
|
+
* Create a new automation rule.
|
|
758
|
+
*/
|
|
759
|
+
create<T = any>(payload: AutomationRulePayload): Promise<T>;
|
|
760
|
+
/**
|
|
761
|
+
* Update an existing automation rule.
|
|
762
|
+
*/
|
|
763
|
+
update<T = any>(ruleId: string, payload: Partial<AutomationRulePayload>): Promise<T>;
|
|
764
|
+
/**
|
|
765
|
+
* Enable or disable an automation rule.
|
|
766
|
+
*/
|
|
767
|
+
toggle<T = any>(ruleId: string): Promise<T>;
|
|
768
|
+
/**
|
|
769
|
+
* Delete an automation rule.
|
|
770
|
+
*/
|
|
771
|
+
deleteRule<T = any>(ruleId: string): Promise<T>;
|
|
772
|
+
/**
|
|
773
|
+
* Bulk delete rules.
|
|
774
|
+
*/
|
|
775
|
+
bulkDelete<T = any>(ruleIds: string[]): Promise<T>;
|
|
776
|
+
/**
|
|
777
|
+
* Dry-run test an automation rule against a specific lead.
|
|
778
|
+
*/
|
|
779
|
+
test<T = any>(ruleId: string, leadId: string): Promise<T>;
|
|
780
|
+
/**
|
|
781
|
+
* Get available event triggers for automations.
|
|
782
|
+
*/
|
|
783
|
+
getAvailableEvents<T = any>(): Promise<T>;
|
|
784
|
+
/**
|
|
785
|
+
* List enrollments for a rule.
|
|
786
|
+
*/
|
|
787
|
+
enrollments<T = any>(ruleId: string, params?: {
|
|
788
|
+
status?: string;
|
|
789
|
+
page?: number;
|
|
790
|
+
limit?: number;
|
|
791
|
+
startDate?: string;
|
|
792
|
+
endDate?: string;
|
|
793
|
+
}): Promise<T>;
|
|
794
|
+
/**
|
|
795
|
+
* Get an enrollment detail.
|
|
796
|
+
*/
|
|
797
|
+
getEnrollment<T = any>(enrollmentId: string): Promise<T>;
|
|
798
|
+
/**
|
|
799
|
+
* Pause an enrollment.
|
|
800
|
+
*/
|
|
801
|
+
pauseEnrollment<T = any>(ruleId: string, enrollmentId: string): Promise<T>;
|
|
802
|
+
/**
|
|
803
|
+
* Resume an enrollment.
|
|
804
|
+
*/
|
|
805
|
+
resumeEnrollment<T = any>(ruleId: string, enrollmentId: string): Promise<T>;
|
|
806
|
+
/**
|
|
807
|
+
* List workflow runs.
|
|
808
|
+
*/
|
|
809
|
+
runs<T = any>(ruleId: string): Promise<T>;
|
|
810
|
+
/**
|
|
811
|
+
* Get run details.
|
|
812
|
+
*/
|
|
813
|
+
getRun<T = any>(runId: string): Promise<T>;
|
|
814
|
+
/**
|
|
815
|
+
* Resume a paused run.
|
|
816
|
+
*/
|
|
817
|
+
resumeRun<T = any>(runId: string): Promise<T>;
|
|
818
|
+
/**
|
|
819
|
+
* Abort a running workflow.
|
|
820
|
+
*/
|
|
821
|
+
abortRun<T = any>(runId: string): Promise<T>;
|
|
822
|
+
/**
|
|
823
|
+
* Emit an external webhook event to unlock a `wait_event` node inside a
|
|
824
|
+
* paused workflow run. Required when integrating third-party tools that
|
|
825
|
+
* need to resume a suspended automation.
|
|
826
|
+
*
|
|
827
|
+
* @param ruleId - The automation rule that contains the wait_event node.
|
|
828
|
+
* @param eventName - The event name that should match the node's condition.
|
|
829
|
+
* @param payload - Arbitrary data forwarded to the node context.
|
|
830
|
+
*/
|
|
831
|
+
webhookEvent<T = any>(ruleId: string, eventName: string, payload?: any): Promise<T>;
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
declare class Sequences extends APIResource {
|
|
835
|
+
/**
|
|
836
|
+
* Manually enroll a lead in a drip sequence (automation rule).
|
|
837
|
+
*/
|
|
838
|
+
enroll<T = any>(payload: {
|
|
839
|
+
leadId: string;
|
|
840
|
+
ruleId: string;
|
|
841
|
+
variables?: Record<string, any>;
|
|
842
|
+
}): Promise<T>;
|
|
843
|
+
/**
|
|
844
|
+
* Unenroll a lead from a running sequence.
|
|
845
|
+
*/
|
|
846
|
+
unenroll<T = any>(enrollmentId: string): Promise<T>;
|
|
847
|
+
/**
|
|
848
|
+
* List active sequence enrollments for a specific lead.
|
|
849
|
+
*/
|
|
850
|
+
listForLead<T = any>(leadId: string): Promise<T>;
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
interface ScoringConfig {
|
|
854
|
+
decayDays: number;
|
|
855
|
+
thresholds: {
|
|
856
|
+
hot: number;
|
|
857
|
+
warm: number;
|
|
858
|
+
};
|
|
859
|
+
rules: any[];
|
|
860
|
+
}
|
|
861
|
+
declare class Scoring extends APIResource {
|
|
862
|
+
/**
|
|
863
|
+
* Retrieve the tenant's global lead scoring configuration.
|
|
864
|
+
*/
|
|
865
|
+
getConfig<T = any>(): Promise<T>;
|
|
866
|
+
/**
|
|
867
|
+
* Update scoring configuration.
|
|
868
|
+
*/
|
|
869
|
+
updateConfig<T = any>(payload: Partial<ScoringConfig>): Promise<T>;
|
|
870
|
+
/**
|
|
871
|
+
* Force recalculate the score for a specific lead.
|
|
872
|
+
*/
|
|
873
|
+
recalculate<T = any>(leadId: string): Promise<T>;
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
declare class Payments extends APIResource {
|
|
877
|
+
/**
|
|
878
|
+
* Record an inbound payment against a lead or appointment.
|
|
879
|
+
*/
|
|
880
|
+
capture<T = any>(payload: {
|
|
881
|
+
leadId: string;
|
|
882
|
+
amount: number;
|
|
883
|
+
currency?: string;
|
|
884
|
+
description?: string;
|
|
885
|
+
appointmentId?: string;
|
|
886
|
+
}): Promise<T>;
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
declare class AutomationDashboard extends APIResource {
|
|
890
|
+
/**
|
|
891
|
+
* Retrieve summary statistics for automation health.
|
|
892
|
+
*/
|
|
893
|
+
stats<T = any>(): Promise<T>;
|
|
894
|
+
/**
|
|
895
|
+
* List recent EventLog entries (automation logs).
|
|
896
|
+
*/
|
|
897
|
+
logs<T = any>(params?: {
|
|
898
|
+
limit?: number;
|
|
899
|
+
status?: string;
|
|
900
|
+
}): Promise<T>;
|
|
901
|
+
/**
|
|
902
|
+
* Re-emit a failed event log to process its automations again.
|
|
903
|
+
*/
|
|
904
|
+
retryFailedEvent<T = any>(logId: string): Promise<T>;
|
|
326
905
|
}
|
|
327
906
|
|
|
328
907
|
declare class CRM {
|
|
329
908
|
leads: Leads;
|
|
909
|
+
pipelines: Pipelines;
|
|
910
|
+
activities: Activities;
|
|
911
|
+
analytics: Analytics;
|
|
912
|
+
automations: Automations;
|
|
913
|
+
sequences: Sequences;
|
|
914
|
+
scoring: Scoring;
|
|
915
|
+
payments: Payments;
|
|
916
|
+
automationDashboard: AutomationDashboard;
|
|
330
917
|
constructor(client: AxiosInstance);
|
|
331
918
|
}
|
|
332
919
|
|
|
@@ -597,7 +1184,15 @@ declare class Meetings extends APIResource {
|
|
|
597
1184
|
* });
|
|
598
1185
|
* ```
|
|
599
1186
|
*/
|
|
600
|
-
update(meetingId: string, data: UpdateMeetingParams): Promise<
|
|
1187
|
+
update<T = any>(meetingId: string, data: UpdateMeetingParams): Promise<T>;
|
|
1188
|
+
/**
|
|
1189
|
+
* Reschedule an existing meeting. Provides explicit method for time modifications.
|
|
1190
|
+
*/
|
|
1191
|
+
reschedule<T = any>(meetingId: string, params: {
|
|
1192
|
+
startTime: Date | string;
|
|
1193
|
+
endTime: Date | string;
|
|
1194
|
+
duration?: number;
|
|
1195
|
+
}): Promise<T>;
|
|
601
1196
|
/**
|
|
602
1197
|
* Cancel a meeting. This sets the meeting status to `"cancelled"`.
|
|
603
1198
|
*
|
|
@@ -722,6 +1317,25 @@ declare class Notifications extends APIResource {
|
|
|
722
1317
|
* ```
|
|
723
1318
|
*/
|
|
724
1319
|
listCallbacks(params?: Omit<LogFilter, "trigger" | "phone">): Promise<unknown>;
|
|
1320
|
+
/**
|
|
1321
|
+
* List active CRM notifications/alerts for the current agent.
|
|
1322
|
+
*/
|
|
1323
|
+
listAlerts<T = any>(params?: {
|
|
1324
|
+
limit?: number;
|
|
1325
|
+
unreadOnly?: boolean;
|
|
1326
|
+
}): Promise<T>;
|
|
1327
|
+
/**
|
|
1328
|
+
* Dismiss a specific notification alert.
|
|
1329
|
+
*/
|
|
1330
|
+
dismissAlert<T = any>(notificationId: string): Promise<T>;
|
|
1331
|
+
/**
|
|
1332
|
+
* Clear (dismiss) all notifications for the current agent.
|
|
1333
|
+
*/
|
|
1334
|
+
clearAllAlerts<T = any>(): Promise<T>;
|
|
1335
|
+
/**
|
|
1336
|
+
* Retry an action from a notification (e.g. failed send).
|
|
1337
|
+
*/
|
|
1338
|
+
retryAction<T = any>(notificationId: string): Promise<T>;
|
|
725
1339
|
}
|
|
726
1340
|
|
|
727
1341
|
/**
|
|
@@ -821,6 +1435,17 @@ interface TriggerPayload {
|
|
|
821
1435
|
delayMinutes?: number;
|
|
822
1436
|
/** Explicit ISO timestamp to trigger the workflow run */
|
|
823
1437
|
runAt?: string;
|
|
1438
|
+
/** Automatically generate a Google Meet appointment if matched actions require it */
|
|
1439
|
+
requiresMeet?: boolean;
|
|
1440
|
+
/** Configuration details for the generated Google Meet appointment */
|
|
1441
|
+
meetConfig?: {
|
|
1442
|
+
summary?: string;
|
|
1443
|
+
description?: string;
|
|
1444
|
+
startTime?: string;
|
|
1445
|
+
duration?: number;
|
|
1446
|
+
timezone?: string;
|
|
1447
|
+
attendees?: string[];
|
|
1448
|
+
};
|
|
824
1449
|
}
|
|
825
1450
|
/**
|
|
826
1451
|
* Response returned when triggering an event.
|
|
@@ -871,6 +1496,30 @@ declare class EventsResource extends APIResource {
|
|
|
871
1496
|
* Emits to the internal EventBus to match with active Workflow Automation Rules.
|
|
872
1497
|
*/
|
|
873
1498
|
trigger(payload: TriggerPayload): Promise<TriggerResponse>;
|
|
1499
|
+
/**
|
|
1500
|
+
* List all custom event definitions.
|
|
1501
|
+
*/
|
|
1502
|
+
listCustomEvents<T = any>(): Promise<T>;
|
|
1503
|
+
/**
|
|
1504
|
+
* Create or upsert a custom event definition.
|
|
1505
|
+
*/
|
|
1506
|
+
createCustomEvent<T = any>(payload: {
|
|
1507
|
+
name: string;
|
|
1508
|
+
displayName: string;
|
|
1509
|
+
description?: string;
|
|
1510
|
+
}): Promise<T>;
|
|
1511
|
+
/**
|
|
1512
|
+
* Delete a custom event definition.
|
|
1513
|
+
*/
|
|
1514
|
+
deleteCustomEvent<T = any>(id: string): Promise<T>;
|
|
1515
|
+
/**
|
|
1516
|
+
* Manually emit a custom event to trigger workflows based on its definition.
|
|
1517
|
+
*/
|
|
1518
|
+
emit<T = any>(payload: {
|
|
1519
|
+
eventName: string;
|
|
1520
|
+
leadId: string;
|
|
1521
|
+
data?: any;
|
|
1522
|
+
}): Promise<T>;
|
|
874
1523
|
}
|
|
875
1524
|
|
|
876
1525
|
/**
|
|
@@ -967,6 +1616,209 @@ declare class Webhooks {
|
|
|
967
1616
|
constructEvent(payload: string | Buffer, signature: string | string[] | undefined, secret: string): Promise<any>;
|
|
968
1617
|
}
|
|
969
1618
|
|
|
1619
|
+
declare class Folders extends APIResource {
|
|
1620
|
+
/**
|
|
1621
|
+
* Create a new folder.
|
|
1622
|
+
*/
|
|
1623
|
+
create<T = any>(name: string): Promise<T>;
|
|
1624
|
+
/**
|
|
1625
|
+
* Delete a folder and its contents.
|
|
1626
|
+
*/
|
|
1627
|
+
delete<T = any>(folderPath: string): Promise<T>;
|
|
1628
|
+
}
|
|
1629
|
+
declare class Files extends APIResource {
|
|
1630
|
+
/**
|
|
1631
|
+
* List files in a folder.
|
|
1632
|
+
*/
|
|
1633
|
+
list<T = any>(folder: string, params?: {
|
|
1634
|
+
year?: string;
|
|
1635
|
+
month?: string;
|
|
1636
|
+
}): Promise<T>;
|
|
1637
|
+
/**
|
|
1638
|
+
* Get a presigned upload URL for direct-to-cloud browser uploads.
|
|
1639
|
+
*/
|
|
1640
|
+
getUploadUrl<T = any>(params: {
|
|
1641
|
+
folder: string;
|
|
1642
|
+
filename: string;
|
|
1643
|
+
contentType: string;
|
|
1644
|
+
}): Promise<T>;
|
|
1645
|
+
/**
|
|
1646
|
+
* Notify backend after a successful direct browser upload.
|
|
1647
|
+
*/
|
|
1648
|
+
confirmUpload<T = any>(params: {
|
|
1649
|
+
key: string;
|
|
1650
|
+
sizeBytes: number;
|
|
1651
|
+
}): Promise<T>;
|
|
1652
|
+
/**
|
|
1653
|
+
* Get a presigned download URL for an R2 key.
|
|
1654
|
+
*/
|
|
1655
|
+
getDownloadUrl<T = any>(key: string): Promise<T>;
|
|
1656
|
+
/**
|
|
1657
|
+
* Delete a file by key.
|
|
1658
|
+
*/
|
|
1659
|
+
delete(key: string): Promise<unknown>;
|
|
1660
|
+
}
|
|
1661
|
+
declare class Storage extends APIResource {
|
|
1662
|
+
folders: Folders;
|
|
1663
|
+
files: Files;
|
|
1664
|
+
constructor(client: any);
|
|
1665
|
+
/**
|
|
1666
|
+
* Get tenant storage usage and quota limitations.
|
|
1667
|
+
*/
|
|
1668
|
+
usage<T = any>(): Promise<T>;
|
|
1669
|
+
}
|
|
1670
|
+
|
|
1671
|
+
interface SendCampaignParams {
|
|
1672
|
+
recipients: string[];
|
|
1673
|
+
subject: string;
|
|
1674
|
+
html: string;
|
|
1675
|
+
}
|
|
1676
|
+
declare class Emails extends APIResource {
|
|
1677
|
+
/**
|
|
1678
|
+
* Dispatch a bulk email campaign.
|
|
1679
|
+
*/
|
|
1680
|
+
sendCampaign<T = any>(params: SendCampaignParams): Promise<T>;
|
|
1681
|
+
/**
|
|
1682
|
+
* Send a test verification email (used to verify SMTP functionality).
|
|
1683
|
+
*/
|
|
1684
|
+
sendTest<T = any>(to: string): Promise<T>;
|
|
1685
|
+
}
|
|
1686
|
+
declare class Campaigns extends APIResource {
|
|
1687
|
+
/**
|
|
1688
|
+
* List email and SMS marketing campaigns.
|
|
1689
|
+
*/
|
|
1690
|
+
list<T = any>(params?: {
|
|
1691
|
+
status?: string;
|
|
1692
|
+
limit?: number;
|
|
1693
|
+
}): Promise<T>;
|
|
1694
|
+
/**
|
|
1695
|
+
* Create a new campaign.
|
|
1696
|
+
*/
|
|
1697
|
+
create<T = any>(payload: {
|
|
1698
|
+
name: string;
|
|
1699
|
+
type: string;
|
|
1700
|
+
subject?: string;
|
|
1701
|
+
html?: string;
|
|
1702
|
+
templateId?: string;
|
|
1703
|
+
recipients?: string[];
|
|
1704
|
+
}): Promise<T>;
|
|
1705
|
+
/**
|
|
1706
|
+
* Retrieve campaign details.
|
|
1707
|
+
*/
|
|
1708
|
+
retrieve<T = any>(campaignId: string): Promise<T>;
|
|
1709
|
+
/**
|
|
1710
|
+
* Update a campaign.
|
|
1711
|
+
*/
|
|
1712
|
+
update<T = any>(campaignId: string, payload: any): Promise<T>;
|
|
1713
|
+
/**
|
|
1714
|
+
* Delete a campaign.
|
|
1715
|
+
*/
|
|
1716
|
+
delete<T = any>(campaignId: string): Promise<T>;
|
|
1717
|
+
/**
|
|
1718
|
+
* Send or schedule a campaign.
|
|
1719
|
+
*/
|
|
1720
|
+
send<T = any>(campaignId: string, payload?: {
|
|
1721
|
+
scheduledAt?: string;
|
|
1722
|
+
}): Promise<T>;
|
|
1723
|
+
/**
|
|
1724
|
+
* Get campaign stats (opens, clicks, bounces).
|
|
1725
|
+
*/
|
|
1726
|
+
stats<T = any>(campaignId: string): Promise<T>;
|
|
1727
|
+
}
|
|
1728
|
+
declare class WhatsAppMarketing extends APIResource {
|
|
1729
|
+
/**
|
|
1730
|
+
* Dispatch a template-based WhatsApp message with CRM-integrated variable resolution.
|
|
1731
|
+
*
|
|
1732
|
+
* Unlike direct WhatsApp sending, this endpoint automatically pulls data from the CRM
|
|
1733
|
+
* based on the provided variables mapping.
|
|
1734
|
+
*/
|
|
1735
|
+
sendTemplate<T = any>(params: {
|
|
1736
|
+
phone: string;
|
|
1737
|
+
templateName: string;
|
|
1738
|
+
languageCode?: string;
|
|
1739
|
+
variables?: Record<string, string>;
|
|
1740
|
+
resolvedVariables?: Record<string, string>;
|
|
1741
|
+
}): Promise<T>;
|
|
1742
|
+
}
|
|
1743
|
+
declare class Marketing extends APIResource {
|
|
1744
|
+
emails: Emails;
|
|
1745
|
+
campaigns: Campaigns;
|
|
1746
|
+
whatsapp: WhatsAppMarketing;
|
|
1747
|
+
constructor(client: any);
|
|
1748
|
+
}
|
|
1749
|
+
|
|
1750
|
+
interface SystemHealth {
|
|
1751
|
+
status: string;
|
|
1752
|
+
version: string;
|
|
1753
|
+
env: string;
|
|
1754
|
+
uptime: number;
|
|
1755
|
+
db: string;
|
|
1756
|
+
queueDepth: number;
|
|
1757
|
+
timestamp: string;
|
|
1758
|
+
}
|
|
1759
|
+
interface ClientHealth {
|
|
1760
|
+
clientCode: string;
|
|
1761
|
+
services: {
|
|
1762
|
+
whatsapp: "connected" | "not_configured";
|
|
1763
|
+
email: "configured" | "not_configured";
|
|
1764
|
+
googleMeet: "configured" | "not_configured";
|
|
1765
|
+
};
|
|
1766
|
+
activeAutomations: number;
|
|
1767
|
+
queueDepth: number;
|
|
1768
|
+
timestamp: string;
|
|
1769
|
+
}
|
|
1770
|
+
interface JobStatus {
|
|
1771
|
+
jobId: string;
|
|
1772
|
+
status: string;
|
|
1773
|
+
attempts: number;
|
|
1774
|
+
maxAttempts: number;
|
|
1775
|
+
lastError: any;
|
|
1776
|
+
runAt: string;
|
|
1777
|
+
completedAt: string | null;
|
|
1778
|
+
failedAt: string | null;
|
|
1779
|
+
createdAt: string;
|
|
1780
|
+
}
|
|
1781
|
+
declare class Health extends APIResource {
|
|
1782
|
+
/**
|
|
1783
|
+
* Global platform health check.
|
|
1784
|
+
*/
|
|
1785
|
+
system(): Promise<SystemHealth>;
|
|
1786
|
+
/**
|
|
1787
|
+
* Tenant-specific health check. Identifies configured services.
|
|
1788
|
+
*/
|
|
1789
|
+
clientHealth(): Promise<ClientHealth>;
|
|
1790
|
+
/**
|
|
1791
|
+
* Job execution status lookup.
|
|
1792
|
+
*/
|
|
1793
|
+
jobStatus(jobId: string): Promise<JobStatus>;
|
|
1794
|
+
}
|
|
1795
|
+
|
|
1796
|
+
interface JobStats {
|
|
1797
|
+
waiting: number;
|
|
1798
|
+
active: number;
|
|
1799
|
+
completed: number;
|
|
1800
|
+
failed: number;
|
|
1801
|
+
delayed: number;
|
|
1802
|
+
}
|
|
1803
|
+
declare class Queue extends APIResource {
|
|
1804
|
+
/**
|
|
1805
|
+
* List all failed jobs.
|
|
1806
|
+
*/
|
|
1807
|
+
listFailed<T = any>(): Promise<T>;
|
|
1808
|
+
/**
|
|
1809
|
+
* Get queue health statistics.
|
|
1810
|
+
*/
|
|
1811
|
+
getStats<T = JobStats>(): Promise<T>;
|
|
1812
|
+
/**
|
|
1813
|
+
* Retry a failed job.
|
|
1814
|
+
*/
|
|
1815
|
+
retryJob<T = any>(jobId: string): Promise<T>;
|
|
1816
|
+
/**
|
|
1817
|
+
* Remove a job from the queue.
|
|
1818
|
+
*/
|
|
1819
|
+
deleteJob<T = any>(jobId: string): Promise<T>;
|
|
1820
|
+
}
|
|
1821
|
+
|
|
970
1822
|
/**
|
|
971
1823
|
* Configuration options for the Ecodrix client.
|
|
972
1824
|
*/
|
|
@@ -1035,6 +1887,14 @@ declare class Ecodrix {
|
|
|
1035
1887
|
readonly events: EventsResource;
|
|
1036
1888
|
/** Cryptographic webhook signature verification. */
|
|
1037
1889
|
readonly webhooks: Webhooks;
|
|
1890
|
+
/** Tenant Cloud Storage mapping. */
|
|
1891
|
+
readonly storage: Storage;
|
|
1892
|
+
/** Email and SMS Marketing Campaigns. */
|
|
1893
|
+
readonly marketing: Marketing;
|
|
1894
|
+
/** Platform and tenant health diagnostics. */
|
|
1895
|
+
readonly health: Health;
|
|
1896
|
+
/** Background job queue management. */
|
|
1897
|
+
readonly queue: Queue;
|
|
1038
1898
|
constructor(options: EcodrixOptions);
|
|
1039
1899
|
private setupSocket;
|
|
1040
1900
|
/**
|
|
@@ -1093,4 +1953,4 @@ declare class Ecodrix {
|
|
|
1093
1953
|
request<T = any>(method: Method, path: string, data?: any, params?: any): Promise<T>;
|
|
1094
1954
|
}
|
|
1095
1955
|
|
|
1096
|
-
export { APIError, type AssignEventPayload, AuthenticationError, type CampaignResult, Conversations, type CreateLeadParams, type CreateMeetingParams, Ecodrix, EcodrixError, type EcodrixOptions, EmailResource, type EventDefinition, EventsResource, Leads, type ListParams, type LogFilter, MediaResource, Meetings, Messages, Notifications, RateLimitError, type SendCampaignPayload, type SendMessageParams, type SendTemplateParams, type SendTemplatePayload, type TriggerPayload, type TriggerResponse, type UpdateMeetingParams, type UploadOptions, WebhookSignatureError, Webhooks, WhatsApp, Ecodrix as default };
|
|
1956
|
+
export { APIError, Activities, Analytics, type AnalyticsParams, type AnalyticsRange, type AssignEventPayload, AuthenticationError, AutomationDashboard, type AutomationRulePayload, Automations, Broadcasts, CRM, type CampaignResult, Campaigns, type ClientHealth, Conversations, type CreateBroadcastParams, type CreateLeadParams, type CreateMeetingParams, type CreatePipelineParams, Ecodrix, EcodrixError, type EcodrixOptions, EmailResource, Emails, type EventDefinition, EventsResource, Files, Folders, Health, type JobStats, type JobStatus, type LeadSource, type LeadStatus, Leads, type ListLeadsParams, type ListParams, type LogActivityParams, type LogCallParams, type LogFilter, Marketing, MediaResource, Meetings, Messages, Notes, Notifications, Payments, type PipelineStageParams, Pipelines, Queue, RateLimitError, Scoring, type ScoringConfig, type SendCampaignParams, type SendCampaignPayload, type SendMessageParams, type SendTemplateParams, type SendTemplatePayload, Sequences, Storage, type SystemHealth, type TemplateMapping, Templates, type TriggerPayload, type TriggerResponse, type UpdateMeetingParams, type UploadOptions, type UpsertLeadParams, WebhookSignatureError, Webhooks, WhatsApp, WhatsAppMarketing, Ecodrix as default };
|