@ecodrix/erix-api 1.1.3 → 1.1.5
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 +1 -1
- package/dist/index.d.ts +664 -85
- package/dist/ts/browser/index.global.js +1 -1
- 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 +664 -85
- package/dist/ts/esm/index.d.ts +664 -85
- package/dist/ts/esm/index.js +1 -1
- package/dist/ts/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/src/resources/crm/activities.ts +40 -4
- package/src/resources/crm/analytics.ts +27 -4
- package/src/resources/crm/automationDashboard.ts +21 -3
- package/src/resources/crm/automations.ts +28 -3
- package/src/resources/crm/leads.ts +36 -2
- package/src/resources/crm/payments.ts +12 -1
- package/src/resources/crm/pipelines.ts +46 -4
- package/src/resources/crm/scoring.ts +15 -2
- package/src/resources/crm/sequences.ts +26 -4
- package/src/resources/email.ts +17 -3
- package/src/resources/events.ts +24 -4
- package/src/resources/health.ts +23 -3
- package/src/resources/marketing.ts +79 -8
- package/src/resources/notifications.ts +27 -7
- package/src/resources/queue.ts +28 -3
- package/src/resources/storage.ts +36 -4
- package/src/resources/whatsapp/broadcasts.ts +65 -2
- package/src/resources/whatsapp/conversations.ts +80 -12
- package/src/resources/whatsapp/messages.ts +18 -18
- package/src/resources/whatsapp/templates.ts +92 -18
package/dist/ts/esm/index.d.ts
CHANGED
|
@@ -38,10 +38,25 @@ interface LogCallParams {
|
|
|
38
38
|
declare class Notes extends APIResource {
|
|
39
39
|
/**
|
|
40
40
|
* List all notes for a specific lead.
|
|
41
|
+
*
|
|
42
|
+
* @param leadId - The unique ID of the lead.
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* const notes = await erixClient.crm.activities.notes.list("lead_123");
|
|
46
|
+
* ```
|
|
41
47
|
*/
|
|
42
48
|
list<T = any>(leadId: string): Promise<T>;
|
|
43
49
|
/**
|
|
44
|
-
* Add a note to a lead.
|
|
50
|
+
* Add a new descriptive note to a lead's profile.
|
|
51
|
+
*
|
|
52
|
+
* @param leadId - The unique ID of the lead.
|
|
53
|
+
* @param params - The note content.
|
|
54
|
+
* @example
|
|
55
|
+
* ```typescript
|
|
56
|
+
* await erixClient.crm.activities.notes.create("lead_123", {
|
|
57
|
+
* content: "Customer is interested in the enterprise plan."
|
|
58
|
+
* });
|
|
59
|
+
* ```
|
|
45
60
|
*/
|
|
46
61
|
create<T = any>(leadId: string, params: {
|
|
47
62
|
content: string;
|
|
@@ -63,7 +78,14 @@ declare class Activities extends APIResource {
|
|
|
63
78
|
notes: Notes;
|
|
64
79
|
constructor(client: any);
|
|
65
80
|
/**
|
|
66
|
-
* Retrieve the complete chronological timeline for a lead.
|
|
81
|
+
* Retrieve the complete chronological timeline of all activities for a lead.
|
|
82
|
+
*
|
|
83
|
+
* @param leadId - The unique ID of the lead.
|
|
84
|
+
* @param params - Optional pagination parameters.
|
|
85
|
+
* @example
|
|
86
|
+
* ```typescript
|
|
87
|
+
* const timeline = await erixClient.crm.activities.timeline("lead_123", { limit: 10 });
|
|
88
|
+
* ```
|
|
67
89
|
*/
|
|
68
90
|
timeline<T = any>(leadId: string, params?: {
|
|
69
91
|
page?: number;
|
|
@@ -78,7 +100,18 @@ declare class Activities extends APIResource {
|
|
|
78
100
|
limit?: number;
|
|
79
101
|
}): Promise<T>;
|
|
80
102
|
/**
|
|
81
|
-
* Generic method to log a business activity/event.
|
|
103
|
+
* Generic method to log a business activity/event (e.g., system events, manual tasks).
|
|
104
|
+
*
|
|
105
|
+
* @param params - Activity details (leadId, type, title, body).
|
|
106
|
+
* @example
|
|
107
|
+
* ```typescript
|
|
108
|
+
* await erixClient.crm.activities.log({
|
|
109
|
+
* leadId: "lead_123",
|
|
110
|
+
* type: "system",
|
|
111
|
+
* title: "Meeting Scheduled",
|
|
112
|
+
* body: "Initial consultation booked for Friday."
|
|
113
|
+
* });
|
|
114
|
+
* ```
|
|
82
115
|
*/
|
|
83
116
|
log<T = any>(params: LogActivityParams): Promise<T>;
|
|
84
117
|
/**
|
|
@@ -96,11 +129,26 @@ interface AnalyticsParams {
|
|
|
96
129
|
}
|
|
97
130
|
declare class Analytics extends APIResource {
|
|
98
131
|
/**
|
|
99
|
-
*
|
|
132
|
+
* Retrieve high-level CRM performance KPIs.
|
|
133
|
+
* Includes total leads, pipeline value, won revenue, and conversion rates.
|
|
134
|
+
*
|
|
135
|
+
* @param params - Optional filters (time range, pipelineId).
|
|
136
|
+
* @returns KPI summary object.
|
|
137
|
+
* @example
|
|
138
|
+
* ```typescript
|
|
139
|
+
* const stats = await erixClient.crm.analytics.overview({ range: "30d" });
|
|
140
|
+
* ```
|
|
100
141
|
*/
|
|
101
142
|
overview<T = any>(params?: AnalyticsParams): Promise<T>;
|
|
102
143
|
/**
|
|
103
|
-
*
|
|
144
|
+
* Get stage-by-stage lead counts and conversion percentages for a pipeline.
|
|
145
|
+
* Useful for identifying funnel bottlenecks.
|
|
146
|
+
*
|
|
147
|
+
* @param pipelineId - The unique ID of the pipeline to analyze.
|
|
148
|
+
* @example
|
|
149
|
+
* ```typescript
|
|
150
|
+
* const funnel = await erixClient.crm.analytics.funnel("pipe_123");
|
|
151
|
+
* ```
|
|
104
152
|
*/
|
|
105
153
|
funnel<T = any>(pipelineId: string): Promise<T>;
|
|
106
154
|
/**
|
|
@@ -136,25 +184,49 @@ declare class Analytics extends APIResource {
|
|
|
136
184
|
*/
|
|
137
185
|
summary<T = any>(params?: AnalyticsParams): Promise<T>;
|
|
138
186
|
/**
|
|
139
|
-
* WhatsApp volume and delivery analytics.
|
|
187
|
+
* Retrieve WhatsApp messaging volume and delivery performance analytics.
|
|
188
|
+
*
|
|
189
|
+
* @param params - Optional filters (time range).
|
|
190
|
+
* @example
|
|
191
|
+
* ```typescript
|
|
192
|
+
* const waStats = await erixClient.crm.analytics.whatsapp({ range: "7d" });
|
|
193
|
+
* ```
|
|
140
194
|
*/
|
|
141
195
|
whatsapp<T = any>(params?: AnalyticsParams): Promise<T>;
|
|
142
196
|
}
|
|
143
197
|
|
|
144
198
|
declare class AutomationDashboard extends APIResource {
|
|
145
199
|
/**
|
|
146
|
-
* Retrieve summary statistics for automation health.
|
|
200
|
+
* Retrieve summary statistics for automation health (total, success, failed).
|
|
201
|
+
*
|
|
202
|
+
* @returns Stats object.
|
|
203
|
+
* @example
|
|
204
|
+
* ```typescript
|
|
205
|
+
* const stats = await erixClient.crm.automationDashboard.stats();
|
|
206
|
+
* ```
|
|
147
207
|
*/
|
|
148
208
|
stats<T = any>(): Promise<T>;
|
|
149
209
|
/**
|
|
150
|
-
* List recent EventLog entries
|
|
210
|
+
* List recent EventLog entries representing automation executions.
|
|
211
|
+
*
|
|
212
|
+
* @param params - Optional filters (limit, status).
|
|
213
|
+
* @example
|
|
214
|
+
* ```typescript
|
|
215
|
+
* const logs = await erixClient.crm.automationDashboard.logs({ status: "failed" });
|
|
216
|
+
* ```
|
|
151
217
|
*/
|
|
152
218
|
logs<T = any>(params?: {
|
|
153
219
|
limit?: number;
|
|
154
220
|
status?: string;
|
|
155
221
|
}): Promise<T>;
|
|
156
222
|
/**
|
|
157
|
-
* Re-emit a failed event log to
|
|
223
|
+
* Re-emit a failed event log to re-trigger its associated automation rules.
|
|
224
|
+
*
|
|
225
|
+
* @param logId - The unique ID of the failed event log.
|
|
226
|
+
* @example
|
|
227
|
+
* ```typescript
|
|
228
|
+
* await erixClient.crm.automationDashboard.retryFailedEvent("log_123");
|
|
229
|
+
* ```
|
|
158
230
|
*/
|
|
159
231
|
retryFailedEvent<T = any>(logId: string): Promise<T>;
|
|
160
232
|
}
|
|
@@ -168,11 +240,29 @@ interface AutomationRulePayload {
|
|
|
168
240
|
}
|
|
169
241
|
declare class Automations extends APIResource {
|
|
170
242
|
/**
|
|
171
|
-
* List all automation rules for the tenant.
|
|
243
|
+
* List all automation rules (workflows) configured for the tenant.
|
|
244
|
+
*
|
|
245
|
+
* @returns Array of automation rule objects.
|
|
246
|
+
* @example
|
|
247
|
+
* ```typescript
|
|
248
|
+
* const rules = await erixClient.crm.automations.list();
|
|
249
|
+
* ```
|
|
172
250
|
*/
|
|
173
251
|
list<T = any>(): Promise<T>;
|
|
174
252
|
/**
|
|
175
|
-
* Create a new automation rule.
|
|
253
|
+
* Create a new automation rule with triggers and workflow nodes.
|
|
254
|
+
*
|
|
255
|
+
* @param payload - The automation rule definition (trigger, nodes, edges).
|
|
256
|
+
* @returns The created automation rule.
|
|
257
|
+
* @example
|
|
258
|
+
* ```typescript
|
|
259
|
+
* await erixClient.crm.automations.create({
|
|
260
|
+
* name: "Welcome Email Workflow",
|
|
261
|
+
* trigger: "contact_created",
|
|
262
|
+
* nodes: [...],
|
|
263
|
+
* edges: [...]
|
|
264
|
+
* });
|
|
265
|
+
* ```
|
|
176
266
|
*/
|
|
177
267
|
create<T = any>(payload: AutomationRulePayload): Promise<T>;
|
|
178
268
|
/**
|
|
@@ -192,7 +282,14 @@ declare class Automations extends APIResource {
|
|
|
192
282
|
*/
|
|
193
283
|
bulkDelete<T = any>(ruleIds: string[]): Promise<T>;
|
|
194
284
|
/**
|
|
195
|
-
* Dry-run test an automation rule against a specific lead.
|
|
285
|
+
* Dry-run test an automation rule against a specific lead to verify logic.
|
|
286
|
+
*
|
|
287
|
+
* @param ruleId - The ID of the rule to test.
|
|
288
|
+
* @param leadId - The ID of the lead to run the test against.
|
|
289
|
+
* @example
|
|
290
|
+
* ```typescript
|
|
291
|
+
* await erixClient.crm.automations.test("rule_123", "lead_456");
|
|
292
|
+
* ```
|
|
196
293
|
*/
|
|
197
294
|
test<T = any>(ruleId: string, leadId: string): Promise<T>;
|
|
198
295
|
/**
|
|
@@ -336,13 +433,28 @@ declare class Leads extends APIResource {
|
|
|
336
433
|
*
|
|
337
434
|
* @param params - Lead creation parameters. `firstName` is required.
|
|
338
435
|
* @returns The newly created Lead document.
|
|
436
|
+
* @example
|
|
437
|
+
* ```typescript
|
|
438
|
+
* const lead = await erixClient.crm.leads.create({
|
|
439
|
+
* firstName: "Alice",
|
|
440
|
+
* phone: "+919876543210",
|
|
441
|
+
* source: "website"
|
|
442
|
+
* });
|
|
443
|
+
* ```
|
|
339
444
|
*/
|
|
340
445
|
create<T = any>(params: CreateLeadParams): Promise<T>;
|
|
341
446
|
/**
|
|
342
|
-
* Upsert a lead by phone number.
|
|
447
|
+
* Upsert a lead by phone number. If a lead with the same phone exists,
|
|
448
|
+
* it will be updated; otherwise, a new lead is created.
|
|
343
449
|
*
|
|
344
450
|
* @param params - Upsert parameters containing leadData with a phone number.
|
|
345
451
|
* @returns The newly created or updated Lead document.
|
|
452
|
+
* @example
|
|
453
|
+
* ```typescript
|
|
454
|
+
* await erixClient.crm.leads.upsert({
|
|
455
|
+
* leadData: { phone: "+919876543210", firstName: "Alice" }
|
|
456
|
+
* });
|
|
457
|
+
* ```
|
|
346
458
|
*/
|
|
347
459
|
upsert<T = any>(params: UpsertLeadParams): Promise<T>;
|
|
348
460
|
/**
|
|
@@ -361,10 +473,18 @@ declare class Leads extends APIResource {
|
|
|
361
473
|
*/
|
|
362
474
|
import<T = any>(leads: Partial<CreateLeadParams>[]): Promise<T>;
|
|
363
475
|
/**
|
|
364
|
-
* List leads with optional filtering and pagination.
|
|
476
|
+
* List CRM leads with optional filtering and pagination.
|
|
365
477
|
*
|
|
366
478
|
* @param params - Filter options (status, source, pipelineId, page, limit, etc.)
|
|
367
479
|
* @returns Paginated list of Lead documents.
|
|
480
|
+
* @example
|
|
481
|
+
* ```typescript
|
|
482
|
+
* const leads = await erixClient.crm.leads.list({
|
|
483
|
+
* status: "new",
|
|
484
|
+
* source: "website",
|
|
485
|
+
* limit: 20
|
|
486
|
+
* });
|
|
487
|
+
* ```
|
|
368
488
|
*/
|
|
369
489
|
list<T = any>(params?: ListLeadsParams): Promise<T>;
|
|
370
490
|
/**
|
|
@@ -384,6 +504,10 @@ declare class Leads extends APIResource {
|
|
|
384
504
|
*
|
|
385
505
|
* @param leadId - The MongoDB ObjectId of the lead.
|
|
386
506
|
* @returns The Lead document, or a 404 error if not found.
|
|
507
|
+
* @example
|
|
508
|
+
* ```typescript
|
|
509
|
+
* const lead = await erixClient.crm.leads.retrieve("64abc...");
|
|
510
|
+
* ```
|
|
387
511
|
*/
|
|
388
512
|
retrieve<T = any>(leadId: string): Promise<T>;
|
|
389
513
|
/**
|
|
@@ -405,6 +529,13 @@ declare class Leads extends APIResource {
|
|
|
405
529
|
* @param leadId - The ID of the lead to update.
|
|
406
530
|
* @param params - Partial lead fields to update.
|
|
407
531
|
* @returns The updated Lead document.
|
|
532
|
+
* @example
|
|
533
|
+
* ```typescript
|
|
534
|
+
* await erixClient.crm.leads.update("64abc...", {
|
|
535
|
+
* lastName: "Smith",
|
|
536
|
+
* status: "qualified"
|
|
537
|
+
* });
|
|
538
|
+
* ```
|
|
408
539
|
*/
|
|
409
540
|
update<T = any>(leadId: string, params: Partial<CreateLeadParams>): Promise<T>;
|
|
410
541
|
/**
|
|
@@ -495,7 +626,18 @@ declare class Leads extends APIResource {
|
|
|
495
626
|
|
|
496
627
|
declare class Payments extends APIResource {
|
|
497
628
|
/**
|
|
498
|
-
* Record an inbound payment against a lead or appointment.
|
|
629
|
+
* Record an inbound payment/transaction against a lead or specific appointment.
|
|
630
|
+
*
|
|
631
|
+
* @param payload - Payment details (leadId, amount, currency, description).
|
|
632
|
+
* @example
|
|
633
|
+
* ```typescript
|
|
634
|
+
* await erixClient.crm.payments.capture({
|
|
635
|
+
* leadId: "lead_123",
|
|
636
|
+
* amount: 5000,
|
|
637
|
+
* currency: "INR",
|
|
638
|
+
* description: "Consultation Fee"
|
|
639
|
+
* });
|
|
640
|
+
* ```
|
|
499
641
|
*/
|
|
500
642
|
capture<T = any>(payload: {
|
|
501
643
|
leadId: string;
|
|
@@ -518,18 +660,40 @@ interface PipelineStageParams {
|
|
|
518
660
|
}
|
|
519
661
|
declare class Pipelines extends APIResource {
|
|
520
662
|
/**
|
|
521
|
-
* List all pipelines and their stages.
|
|
663
|
+
* List all CRM pipelines and their configured stages.
|
|
664
|
+
*
|
|
665
|
+
* @returns Array of pipeline objects with nested stages.
|
|
666
|
+
* @example
|
|
667
|
+
* ```typescript
|
|
668
|
+
* const pipelines = await erixClient.crm.pipelines.list();
|
|
669
|
+
* ```
|
|
522
670
|
*/
|
|
523
671
|
list<T = any>(): Promise<T>;
|
|
524
672
|
/**
|
|
525
|
-
* Create a new pipeline.
|
|
673
|
+
* Create a new CRM sales or support pipeline.
|
|
674
|
+
*
|
|
675
|
+
* @param payload - Pipeline details (name and array of stage names).
|
|
676
|
+
* @returns The created pipeline record.
|
|
677
|
+
* @example
|
|
678
|
+
* ```typescript
|
|
679
|
+
* await erixClient.crm.pipelines.create({
|
|
680
|
+
* name: "Sales Pipeline",
|
|
681
|
+
* stages: ["Lead", "Contacted", "Proposal", "Negotiation", "Closed"]
|
|
682
|
+
* });
|
|
683
|
+
* ```
|
|
526
684
|
*/
|
|
527
685
|
create<T = any>(payload: {
|
|
528
686
|
name: string;
|
|
529
687
|
stages: string[];
|
|
530
688
|
}): Promise<T>;
|
|
531
689
|
/**
|
|
532
|
-
* Retrieve a single pipeline by ID.
|
|
690
|
+
* Retrieve a single pipeline configuration by ID.
|
|
691
|
+
*
|
|
692
|
+
* @param pipelineId - The unique ID of the pipeline.
|
|
693
|
+
* @example
|
|
694
|
+
* ```typescript
|
|
695
|
+
* const pipeline = await erixClient.crm.pipelines.retrieve("pipe_123");
|
|
696
|
+
* ```
|
|
533
697
|
*/
|
|
534
698
|
retrieve<T = any>(pipelineId: string): Promise<T>;
|
|
535
699
|
/**
|
|
@@ -557,6 +721,12 @@ declare class Pipelines extends APIResource {
|
|
|
557
721
|
delete(pipelineId: string): Promise<unknown>;
|
|
558
722
|
/**
|
|
559
723
|
* Retrieve a Kanban-style board representation of the pipeline with leads nested.
|
|
724
|
+
*
|
|
725
|
+
* @param pipelineId - The unique ID of the pipeline.
|
|
726
|
+
* @example
|
|
727
|
+
* ```typescript
|
|
728
|
+
* const board = await erixClient.crm.pipelines.board("pipe_123");
|
|
729
|
+
* ```
|
|
560
730
|
*/
|
|
561
731
|
board<T = any>(pipelineId: string): Promise<T>;
|
|
562
732
|
/**
|
|
@@ -565,6 +735,17 @@ declare class Pipelines extends APIResource {
|
|
|
565
735
|
forecast<T = any>(pipelineId: string): Promise<T>;
|
|
566
736
|
/**
|
|
567
737
|
* Add a new stage to the pipeline.
|
|
738
|
+
*
|
|
739
|
+
* @param pipelineId - The unique ID of the pipeline.
|
|
740
|
+
* @param params - Stage details (name, color, probability).
|
|
741
|
+
* @example
|
|
742
|
+
* ```typescript
|
|
743
|
+
* await erixClient.crm.pipelines.addStage("pipe_123", {
|
|
744
|
+
* name: "Decision Maker Bought In",
|
|
745
|
+
* color: "#FF5733",
|
|
746
|
+
* probability: 80
|
|
747
|
+
* });
|
|
748
|
+
* ```
|
|
568
749
|
*/
|
|
569
750
|
addStage<T = any>(pipelineId: string, params: PipelineStageParams): Promise<T>;
|
|
570
751
|
/**
|
|
@@ -576,7 +757,10 @@ declare class Pipelines extends APIResource {
|
|
|
576
757
|
*/
|
|
577
758
|
updateStage<T = any>(stageId: string, params: Partial<PipelineStageParams>): Promise<T>;
|
|
578
759
|
/**
|
|
579
|
-
* Delete a stage
|
|
760
|
+
* Delete a stage permanently.
|
|
761
|
+
*
|
|
762
|
+
* @param stageId - The unique ID of the stage to delete.
|
|
763
|
+
* @param moveLeadsToStageId - Optional fallback stageId to move active leads to before deletion.
|
|
580
764
|
*/
|
|
581
765
|
deleteStage(stageId: string, moveLeadsToStageId?: string): Promise<unknown>;
|
|
582
766
|
}
|
|
@@ -591,7 +775,13 @@ interface ScoringConfig {
|
|
|
591
775
|
}
|
|
592
776
|
declare class Scoring extends APIResource {
|
|
593
777
|
/**
|
|
594
|
-
* Retrieve the tenant's global lead scoring configuration.
|
|
778
|
+
* Retrieve the tenant's global lead scoring configuration (rules, decay, thresholds).
|
|
779
|
+
*
|
|
780
|
+
* @returns The scoring configuration object.
|
|
781
|
+
* @example
|
|
782
|
+
* ```typescript
|
|
783
|
+
* const config = await erixClient.crm.scoring.getConfig();
|
|
784
|
+
* ```
|
|
595
785
|
*/
|
|
596
786
|
getConfig<T = any>(): Promise<T>;
|
|
597
787
|
/**
|
|
@@ -599,14 +789,31 @@ declare class Scoring extends APIResource {
|
|
|
599
789
|
*/
|
|
600
790
|
updateConfig<T = any>(payload: Partial<ScoringConfig>): Promise<T>;
|
|
601
791
|
/**
|
|
602
|
-
* Force
|
|
792
|
+
* Force an immediate score recalculation for a specific lead.
|
|
793
|
+
* Useful when profile data changes significantly.
|
|
794
|
+
*
|
|
795
|
+
* @param leadId - The unique ID of the lead.
|
|
796
|
+
* @example
|
|
797
|
+
* ```typescript
|
|
798
|
+
* await erixClient.crm.scoring.recalculate("lead_123");
|
|
799
|
+
* ```
|
|
603
800
|
*/
|
|
604
801
|
recalculate<T = any>(leadId: string): Promise<T>;
|
|
605
802
|
}
|
|
606
803
|
|
|
607
804
|
declare class Sequences extends APIResource {
|
|
608
805
|
/**
|
|
609
|
-
* Manually enroll a lead
|
|
806
|
+
* Manually enroll a lead into a specific automation drip sequence (Workflow).
|
|
807
|
+
*
|
|
808
|
+
* @param payload - Enrollment details (leadId, ruleId, and custom variables).
|
|
809
|
+
* @example
|
|
810
|
+
* ```typescript
|
|
811
|
+
* await erixClient.crm.sequences.enroll({
|
|
812
|
+
* leadId: "lead_123",
|
|
813
|
+
* ruleId: "rule_456",
|
|
814
|
+
* variables: { start_date: "2026-05-01" }
|
|
815
|
+
* });
|
|
816
|
+
* ```
|
|
610
817
|
*/
|
|
611
818
|
enroll<T = any>(payload: {
|
|
612
819
|
leadId: string;
|
|
@@ -614,11 +821,24 @@ declare class Sequences extends APIResource {
|
|
|
614
821
|
variables?: Record<string, any>;
|
|
615
822
|
}): Promise<T>;
|
|
616
823
|
/**
|
|
617
|
-
* Unenroll a lead from a running sequence.
|
|
824
|
+
* Unenroll a lead from a currently running automation sequence.
|
|
825
|
+
*
|
|
826
|
+
* @param enrollmentId - The unique ID of the sequence enrollment.
|
|
827
|
+
* @example
|
|
828
|
+
* ```typescript
|
|
829
|
+
* await erixClient.crm.sequences.unenroll("enroll_123");
|
|
830
|
+
* ```
|
|
618
831
|
*/
|
|
619
832
|
unenroll<T = any>(enrollmentId: string): Promise<unknown>;
|
|
620
833
|
/**
|
|
621
|
-
* List active sequence enrollments for a specific lead.
|
|
834
|
+
* List all active and completed sequence enrollments for a specific lead.
|
|
835
|
+
*
|
|
836
|
+
* @param leadId - The unique ID of the lead.
|
|
837
|
+
* @returns Array of enrollment records.
|
|
838
|
+
* @example
|
|
839
|
+
* ```typescript
|
|
840
|
+
* const enrollments = await erixClient.crm.sequences.listForLead("lead_123");
|
|
841
|
+
* ```
|
|
622
842
|
*/
|
|
623
843
|
listForLead<T = any>(leadId: string): Promise<T>;
|
|
624
844
|
}
|
|
@@ -660,14 +880,26 @@ declare class EmailResource extends APIResource {
|
|
|
660
880
|
* Send an HTML email campaign to a list of recipients.
|
|
661
881
|
*
|
|
662
882
|
* @param payload - The campaign details (recipients, subject, html).
|
|
663
|
-
* @returns The dispatch result.
|
|
883
|
+
* @returns The dispatch result indicating success or failure.
|
|
884
|
+
* @example
|
|
885
|
+
* ```typescript
|
|
886
|
+
* await erixClient.email.sendEmailCampaign({
|
|
887
|
+
* recipients: ["user1@example.com", "user2@example.com"],
|
|
888
|
+
* subject: "Monthly Newsletter",
|
|
889
|
+
* html: "<h1>Hello!</h1><p>Check out our latest updates...</p>"
|
|
890
|
+
* });
|
|
891
|
+
* ```
|
|
664
892
|
*/
|
|
665
893
|
sendEmailCampaign(payload: SendCampaignPayload): Promise<CampaignResult>;
|
|
666
894
|
/**
|
|
667
|
-
* Send a system
|
|
895
|
+
* Send a system test email to validate your current SMTP configuration.
|
|
668
896
|
*
|
|
669
897
|
* @param to - The recipient's email address.
|
|
670
898
|
* @returns The dispatch result.
|
|
899
|
+
* @example
|
|
900
|
+
* ```typescript
|
|
901
|
+
* await erixClient.email.sendTestEmail("admin@company.com");
|
|
902
|
+
* ```
|
|
671
903
|
*/
|
|
672
904
|
sendTestEmail(to: string): Promise<CampaignResult>;
|
|
673
905
|
}
|
|
@@ -761,7 +993,13 @@ interface TriggerResponse {
|
|
|
761
993
|
}
|
|
762
994
|
declare class EventsResource extends APIResource {
|
|
763
995
|
/**
|
|
764
|
-
*
|
|
996
|
+
* List all available event definitions (both system and custom) that can trigger automations.
|
|
997
|
+
*
|
|
998
|
+
* @returns Array of event definitions.
|
|
999
|
+
* @example
|
|
1000
|
+
* ```typescript
|
|
1001
|
+
* const events = await erixClient.events.list();
|
|
1002
|
+
* ```
|
|
765
1003
|
*/
|
|
766
1004
|
list(): Promise<{
|
|
767
1005
|
success: boolean;
|
|
@@ -790,8 +1028,20 @@ declare class EventsResource extends APIResource {
|
|
|
790
1028
|
message: string;
|
|
791
1029
|
}>;
|
|
792
1030
|
/**
|
|
793
|
-
* Programmatically
|
|
794
|
-
*
|
|
1031
|
+
* Programmatically trigger an automation workflow by firing a specific event.
|
|
1032
|
+
* This matches the event against active Automation Rules and executes linked actions.
|
|
1033
|
+
*
|
|
1034
|
+
* @param payload - The trigger details (event name, lead phone/email, variables).
|
|
1035
|
+
* @returns Trigger response with diagnostic info (eventLogId, matched rules).
|
|
1036
|
+
* @example
|
|
1037
|
+
* ```typescript
|
|
1038
|
+
* await erixClient.events.trigger({
|
|
1039
|
+
* trigger: "webinar_joined",
|
|
1040
|
+
* phone: "+919876543210",
|
|
1041
|
+
* variables: { webinar_name: "AI Masterclass" },
|
|
1042
|
+
* createLeadIfMissing: true
|
|
1043
|
+
* });
|
|
1044
|
+
* ```
|
|
795
1045
|
*/
|
|
796
1046
|
trigger(payload: TriggerPayload): Promise<TriggerResponse>;
|
|
797
1047
|
/**
|
|
@@ -853,7 +1103,15 @@ interface JobStatus {
|
|
|
853
1103
|
}
|
|
854
1104
|
declare class Health extends APIResource {
|
|
855
1105
|
/**
|
|
856
|
-
*
|
|
1106
|
+
* Perform a global platform health check.
|
|
1107
|
+
* Verify that the API, database, and background workers are operational.
|
|
1108
|
+
*
|
|
1109
|
+
* @returns System health summary (status, version, uptime).
|
|
1110
|
+
* @example
|
|
1111
|
+
* ```typescript
|
|
1112
|
+
* const health = await erixClient.health.system();
|
|
1113
|
+
* console.log(`API Status: ${health.status}`);
|
|
1114
|
+
* ```
|
|
857
1115
|
*/
|
|
858
1116
|
system(): Promise<SystemHealth>;
|
|
859
1117
|
/**
|
|
@@ -861,7 +1119,17 @@ declare class Health extends APIResource {
|
|
|
861
1119
|
*/
|
|
862
1120
|
clientHealth(): Promise<ClientHealth>;
|
|
863
1121
|
/**
|
|
864
|
-
*
|
|
1122
|
+
* Lookup the execution status of a background job.
|
|
1123
|
+
*
|
|
1124
|
+
* @param jobId - The unique ID of the background job.
|
|
1125
|
+
* @returns Job status report (attempts, error trace, completion time).
|
|
1126
|
+
* @example
|
|
1127
|
+
* ```typescript
|
|
1128
|
+
* const status = await erixClient.health.jobStatus("job_123");
|
|
1129
|
+
* if (status.status === "completed") {
|
|
1130
|
+
* console.log("Job finished successfully!");
|
|
1131
|
+
* }
|
|
1132
|
+
* ```
|
|
865
1133
|
*/
|
|
866
1134
|
jobStatus(jobId: string): Promise<JobStatus>;
|
|
867
1135
|
}
|
|
@@ -873,7 +1141,18 @@ interface SendCampaignParams {
|
|
|
873
1141
|
}
|
|
874
1142
|
declare class Emails extends APIResource {
|
|
875
1143
|
/**
|
|
876
|
-
* Dispatch a bulk email campaign.
|
|
1144
|
+
* Dispatch a bulk email campaign to a list of recipients.
|
|
1145
|
+
*
|
|
1146
|
+
* @param params - The campaign details (recipients, subject, html).
|
|
1147
|
+
* @returns The dispatch result.
|
|
1148
|
+
* @example
|
|
1149
|
+
* ```typescript
|
|
1150
|
+
* await erixClient.marketing.emails.sendCampaign({
|
|
1151
|
+
* recipients: ["user@example.com"],
|
|
1152
|
+
* subject: "Special Offer",
|
|
1153
|
+
* html: "<p>Check out our deal!</p>"
|
|
1154
|
+
* });
|
|
1155
|
+
* ```
|
|
877
1156
|
*/
|
|
878
1157
|
sendCampaign<T = any>(params: SendCampaignParams): Promise<T>;
|
|
879
1158
|
/**
|
|
@@ -883,14 +1162,33 @@ declare class Emails extends APIResource {
|
|
|
883
1162
|
}
|
|
884
1163
|
declare class Campaigns extends APIResource {
|
|
885
1164
|
/**
|
|
886
|
-
* List email and SMS marketing campaigns.
|
|
1165
|
+
* List all email and SMS marketing campaigns with optional status filtering.
|
|
1166
|
+
*
|
|
1167
|
+
* @param params - Optional filters (status, limit).
|
|
1168
|
+
* @returns Paginated list of campaign objects.
|
|
1169
|
+
* @example
|
|
1170
|
+
* ```typescript
|
|
1171
|
+
* const campaigns = await erixClient.marketing.campaigns.list({ status: "sent" });
|
|
1172
|
+
* ```
|
|
887
1173
|
*/
|
|
888
1174
|
list<T = any>(params?: {
|
|
889
1175
|
status?: string;
|
|
890
1176
|
limit?: number;
|
|
891
1177
|
}): Promise<T>;
|
|
892
1178
|
/**
|
|
893
|
-
* Create a new campaign.
|
|
1179
|
+
* Create a new marketing campaign (Email or SMS).
|
|
1180
|
+
*
|
|
1181
|
+
* @param payload - Campaign details (name, type, content).
|
|
1182
|
+
* @returns The created campaign record.
|
|
1183
|
+
* @example
|
|
1184
|
+
* ```typescript
|
|
1185
|
+
* await erixClient.marketing.campaigns.create({
|
|
1186
|
+
* name: "Spring Sale",
|
|
1187
|
+
* type: "email",
|
|
1188
|
+
* subject: "Our Spring Sale is Here!",
|
|
1189
|
+
* html: "<h1>BIG DEALS!</h1>"
|
|
1190
|
+
* });
|
|
1191
|
+
* ```
|
|
894
1192
|
*/
|
|
895
1193
|
create<T = any>(payload: {
|
|
896
1194
|
name: string;
|
|
@@ -901,7 +1199,13 @@ declare class Campaigns extends APIResource {
|
|
|
901
1199
|
recipients?: string[];
|
|
902
1200
|
}): Promise<T>;
|
|
903
1201
|
/**
|
|
904
|
-
* Retrieve
|
|
1202
|
+
* Retrieve full details for a specific marketing campaign.
|
|
1203
|
+
*
|
|
1204
|
+
* @param campaignId - The unique ID of the campaign.
|
|
1205
|
+
* @example
|
|
1206
|
+
* ```typescript
|
|
1207
|
+
* const campaign = await erixClient.marketing.campaigns.retrieve("camp_123");
|
|
1208
|
+
* ```
|
|
905
1209
|
*/
|
|
906
1210
|
retrieve<T = any>(campaignId: string): Promise<T>;
|
|
907
1211
|
/**
|
|
@@ -913,13 +1217,35 @@ declare class Campaigns extends APIResource {
|
|
|
913
1217
|
*/
|
|
914
1218
|
delete<T = any>(campaignId: string): Promise<T>;
|
|
915
1219
|
/**
|
|
916
|
-
* Send or schedule a
|
|
1220
|
+
* Send a campaign immediately or schedule it for a later date.
|
|
1221
|
+
*
|
|
1222
|
+
* @param campaignId - The ID of the campaign to dispatch.
|
|
1223
|
+
* @param payload - Optional scheduling information (ISO timestamp).
|
|
1224
|
+
* @example
|
|
1225
|
+
* ```typescript
|
|
1226
|
+
* // Send immediately
|
|
1227
|
+
* await erixClient.marketing.campaigns.send("camp_123");
|
|
1228
|
+
*
|
|
1229
|
+
* // Schedule for tomorrow
|
|
1230
|
+
* await erixClient.marketing.campaigns.send("camp_123", {
|
|
1231
|
+
* scheduledAt: "2026-04-10T09:00:00Z"
|
|
1232
|
+
* });
|
|
1233
|
+
* ```
|
|
917
1234
|
*/
|
|
918
1235
|
send<T = any>(campaignId: string, payload?: {
|
|
919
1236
|
scheduledAt?: string;
|
|
920
1237
|
}): Promise<T>;
|
|
921
1238
|
/**
|
|
922
|
-
* Get
|
|
1239
|
+
* Get detailed delivery and engagement statistics for a campaign.
|
|
1240
|
+
* Includes opens, clicks, bounces, and delivery failures.
|
|
1241
|
+
*
|
|
1242
|
+
* @param campaignId - The ID of the campaign.
|
|
1243
|
+
* @returns Stats summary object.
|
|
1244
|
+
* @example
|
|
1245
|
+
* ```typescript
|
|
1246
|
+
* const report = await erixClient.marketing.campaigns.stats("camp_123");
|
|
1247
|
+
* console.log(`Open Rate: ${report.openRate}%`);
|
|
1248
|
+
* ```
|
|
923
1249
|
*/
|
|
924
1250
|
stats<T = any>(campaignId: string): Promise<T>;
|
|
925
1251
|
}
|
|
@@ -927,8 +1253,18 @@ declare class WhatsAppMarketing extends APIResource {
|
|
|
927
1253
|
/**
|
|
928
1254
|
* Dispatch a template-based WhatsApp message with CRM-integrated variable resolution.
|
|
929
1255
|
*
|
|
930
|
-
* Unlike direct WhatsApp sending, this endpoint automatically pulls data from the CRM
|
|
1256
|
+
* Unlike direct WhatsApp sending, this endpoint documentation automatically pulls data from the CRM
|
|
931
1257
|
* based on the provided variables mapping.
|
|
1258
|
+
*
|
|
1259
|
+
* @param params - Template details and recipient phone.
|
|
1260
|
+
* @example
|
|
1261
|
+
* ```typescript
|
|
1262
|
+
* await erixClient.marketing.whatsapp.sendTemplate({
|
|
1263
|
+
* phone: "+919876543210",
|
|
1264
|
+
* templateName: "order_update",
|
|
1265
|
+
* variables: { "1": "Order #123" }
|
|
1266
|
+
* });
|
|
1267
|
+
* ```
|
|
932
1268
|
*/
|
|
933
1269
|
sendTemplate<T = any>(params: {
|
|
934
1270
|
phone: string;
|
|
@@ -1346,26 +1682,46 @@ declare class Notifications extends APIResource {
|
|
|
1346
1682
|
*/
|
|
1347
1683
|
listCallbacks(params?: Omit<LogFilter, "trigger" | "phone">): Promise<unknown>;
|
|
1348
1684
|
/**
|
|
1349
|
-
* List unread CRM notifications
|
|
1350
|
-
*
|
|
1685
|
+
* List unread CRM notifications and alerts (e.g., lead assignments, system alerts).
|
|
1686
|
+
*
|
|
1687
|
+
* @param params - Optional filters (limit, unreadOnly).
|
|
1688
|
+
* @returns Paginated list of notification objects.
|
|
1689
|
+
* @example
|
|
1690
|
+
* ```typescript
|
|
1691
|
+
* const alerts = await erixClient.notifications.listAlerts({ unreadOnly: true });
|
|
1692
|
+
* ```
|
|
1351
1693
|
*/
|
|
1352
1694
|
listAlerts<T = any>(params?: {
|
|
1353
1695
|
limit?: number;
|
|
1354
1696
|
unreadOnly?: boolean;
|
|
1355
1697
|
}): Promise<T>;
|
|
1356
1698
|
/**
|
|
1357
|
-
* Dismiss a specific notification alert.
|
|
1358
|
-
*
|
|
1699
|
+
* Dismiss/mark a specific notification alert as read.
|
|
1700
|
+
*
|
|
1701
|
+
* @param notificationId - The unique ID of the notification.
|
|
1702
|
+
* @example
|
|
1703
|
+
* ```typescript
|
|
1704
|
+
* await erixClient.notifications.dismissAlert("alert_123");
|
|
1705
|
+
* ```
|
|
1359
1706
|
*/
|
|
1360
1707
|
dismissAlert<T = any>(notificationId: string): Promise<T>;
|
|
1361
1708
|
/**
|
|
1362
|
-
* Clear
|
|
1363
|
-
*
|
|
1709
|
+
* Clear all notifications for the current tenant immediately.
|
|
1710
|
+
*
|
|
1711
|
+
* @example
|
|
1712
|
+
* ```typescript
|
|
1713
|
+
* await erixClient.notifications.clearAllAlerts();
|
|
1714
|
+
* ```
|
|
1364
1715
|
*/
|
|
1365
1716
|
clearAllAlerts<T = any>(): Promise<T>;
|
|
1366
1717
|
/**
|
|
1367
1718
|
* Retry an action from a notification (e.g. failed automation send).
|
|
1368
|
-
*
|
|
1719
|
+
*
|
|
1720
|
+
* @param notificationId - The unique ID of the notification.
|
|
1721
|
+
* @example
|
|
1722
|
+
* ```typescript
|
|
1723
|
+
* await erixClient.notifications.retryAction("alert_123");
|
|
1724
|
+
* ```
|
|
1369
1725
|
*/
|
|
1370
1726
|
retryAction<T = any>(notificationId: string): Promise<T>;
|
|
1371
1727
|
}
|
|
@@ -1379,26 +1735,57 @@ interface JobStats {
|
|
|
1379
1735
|
}
|
|
1380
1736
|
declare class Queue extends APIResource {
|
|
1381
1737
|
/**
|
|
1382
|
-
* List all failed
|
|
1738
|
+
* List all background jobs that have failed execution.
|
|
1739
|
+
*
|
|
1740
|
+
* @returns Array of failed job objects.
|
|
1741
|
+
* @example
|
|
1742
|
+
* ```typescript
|
|
1743
|
+
* const failed = await erixClient.queue.listFailed();
|
|
1744
|
+
* ```
|
|
1383
1745
|
*/
|
|
1384
1746
|
listFailed<T = any>(): Promise<T>;
|
|
1385
1747
|
/**
|
|
1386
|
-
* Get
|
|
1748
|
+
* Get real-time health statistics for the background job queue (waiting, active, failed).
|
|
1749
|
+
*
|
|
1750
|
+
* @returns Queue statistics summary.
|
|
1751
|
+
* @example
|
|
1752
|
+
* ```typescript
|
|
1753
|
+
* const stats = await erixClient.queue.getStats();
|
|
1754
|
+
* console.log(`Active Jobs: ${stats.active}`);
|
|
1755
|
+
* ```
|
|
1387
1756
|
*/
|
|
1388
1757
|
getStats<T = JobStats>(): Promise<T>;
|
|
1389
1758
|
/**
|
|
1390
|
-
*
|
|
1759
|
+
* Manually retry a failed background job.
|
|
1760
|
+
*
|
|
1761
|
+
* @param jobId - The unique ID of the failed job.
|
|
1762
|
+
* @example
|
|
1763
|
+
* ```typescript
|
|
1764
|
+
* await erixClient.queue.retryJob("job_123");
|
|
1765
|
+
* ```
|
|
1391
1766
|
*/
|
|
1392
1767
|
retryJob<T = any>(jobId: string): Promise<T>;
|
|
1393
1768
|
/**
|
|
1394
1769
|
* Remove a job from the queue.
|
|
1770
|
+
*
|
|
1771
|
+
* @param jobId - The unique ID of the job to delete.
|
|
1772
|
+
* @example
|
|
1773
|
+
* ```typescript
|
|
1774
|
+
* await erixClient.queue.deleteJob("job_123");
|
|
1775
|
+
* ```
|
|
1395
1776
|
*/
|
|
1396
1777
|
deleteJob<T = any>(jobId: string): Promise<T>;
|
|
1397
1778
|
}
|
|
1398
1779
|
|
|
1399
1780
|
declare class Folders extends APIResource {
|
|
1400
1781
|
/**
|
|
1401
|
-
* Create a new folder.
|
|
1782
|
+
* Create a new folder in the tenant's cloud storage.
|
|
1783
|
+
*
|
|
1784
|
+
* @param name - The name of the folder to create.
|
|
1785
|
+
* @example
|
|
1786
|
+
* ```typescript
|
|
1787
|
+
* await erixClient.storage.folders.create("Invoices");
|
|
1788
|
+
* ```
|
|
1402
1789
|
*/
|
|
1403
1790
|
create<T = any>(name: string): Promise<T>;
|
|
1404
1791
|
/**
|
|
@@ -1408,7 +1795,14 @@ declare class Folders extends APIResource {
|
|
|
1408
1795
|
}
|
|
1409
1796
|
declare class Files extends APIResource {
|
|
1410
1797
|
/**
|
|
1411
|
-
* List files
|
|
1798
|
+
* List files within a specific folder.
|
|
1799
|
+
*
|
|
1800
|
+
* @param folder - The folder name or path.
|
|
1801
|
+
* @param params - Optional year/month filters for organized storage.
|
|
1802
|
+
* @example
|
|
1803
|
+
* ```typescript
|
|
1804
|
+
* const files = await erixClient.storage.files.list("Invoices", { year: "2026" });
|
|
1805
|
+
* ```
|
|
1412
1806
|
*/
|
|
1413
1807
|
list<T = any>(folder: string, params?: {
|
|
1414
1808
|
year?: string;
|
|
@@ -1416,6 +1810,18 @@ declare class Files extends APIResource {
|
|
|
1416
1810
|
}): Promise<T>;
|
|
1417
1811
|
/**
|
|
1418
1812
|
* Get a presigned upload URL for direct-to-cloud browser uploads.
|
|
1813
|
+
* This allows the client to upload files directly to R2/S3 without hitting the backend.
|
|
1814
|
+
*
|
|
1815
|
+
* @param params - Upload parameters (folder, filename, contentType).
|
|
1816
|
+
* @example
|
|
1817
|
+
* ```typescript
|
|
1818
|
+
* const { data } = await erixClient.storage.files.getUploadUrl({
|
|
1819
|
+
* folder: "Invoices",
|
|
1820
|
+
* filename: "inv_1.pdf",
|
|
1821
|
+
* contentType: "application/pdf"
|
|
1822
|
+
* });
|
|
1823
|
+
* // Now use data.url with a PUT request
|
|
1824
|
+
* ```
|
|
1419
1825
|
*/
|
|
1420
1826
|
getUploadUrl<T = any>(params: {
|
|
1421
1827
|
folder: string;
|
|
@@ -1557,13 +1963,70 @@ interface CreateBroadcastParams {
|
|
|
1557
1963
|
}
|
|
1558
1964
|
declare class Broadcasts extends APIResource {
|
|
1559
1965
|
/**
|
|
1560
|
-
* List past and active
|
|
1966
|
+
* List past and active WhatsApp broadcast campaigns.
|
|
1967
|
+
*
|
|
1968
|
+
* @param params - Optional filter parameters (page, limit, status).
|
|
1969
|
+
* @returns Paginated list of broadcast records.
|
|
1970
|
+
* @example
|
|
1971
|
+
* ```typescript
|
|
1972
|
+
* const broadcasts = await erixClient.whatsapp.broadcasts.list({ limit: 10 });
|
|
1973
|
+
* ```
|
|
1561
1974
|
*/
|
|
1562
1975
|
list<T = any>(params?: Record<string, any>): Promise<T>;
|
|
1563
1976
|
/**
|
|
1564
|
-
*
|
|
1977
|
+
* Retrieve full details and real-time stats for a specific broadcast campaign.
|
|
1978
|
+
*
|
|
1979
|
+
* @param id - The unique identifier of the broadcast.
|
|
1980
|
+
* @returns The broadcast record including sent/failed counts.
|
|
1981
|
+
* @example
|
|
1982
|
+
* ```typescript
|
|
1983
|
+
* const stats = await erixClient.whatsapp.broadcasts.retrieve("bc_123");
|
|
1984
|
+
* console.log(`Success Rate: ${(stats.sentCount / stats.totalRecipients) * 100}%`);
|
|
1985
|
+
* ```
|
|
1986
|
+
*/
|
|
1987
|
+
retrieve<T = any>(id: string): Promise<T>;
|
|
1988
|
+
/**
|
|
1989
|
+
* Create a new broadcast campaign to send template messages to multiple recipients.
|
|
1990
|
+
*
|
|
1991
|
+
* @param params - Broadcast configuration (name, templateName, recipients).
|
|
1992
|
+
* @returns The newly created broadcast record.
|
|
1993
|
+
* @example
|
|
1994
|
+
* ```typescript
|
|
1995
|
+
* await erixClient.whatsapp.broadcasts.create({
|
|
1996
|
+
* name: "Spring Sale",
|
|
1997
|
+
* templateName: "promo_code",
|
|
1998
|
+
* recipients: [
|
|
1999
|
+
* { phone: "+919876543210", variables: ["SAVE10"] }
|
|
2000
|
+
* ]
|
|
2001
|
+
* });
|
|
2002
|
+
* ```
|
|
1565
2003
|
*/
|
|
1566
2004
|
create<T = any>(params: CreateBroadcastParams): Promise<T>;
|
|
2005
|
+
/**
|
|
2006
|
+
* Update broadcast metadata, such as its name or administrative status.
|
|
2007
|
+
*
|
|
2008
|
+
* @param id - The unique ID of the broadcast.
|
|
2009
|
+
* @param data - The fields to update (name, status).
|
|
2010
|
+
* @example
|
|
2011
|
+
* ```typescript
|
|
2012
|
+
* await erixClient.whatsapp.broadcasts.update("bc_123", { name: "Revised Spring Sale" });
|
|
2013
|
+
* ```
|
|
2014
|
+
*/
|
|
2015
|
+
update<T = any>(id: string, data: {
|
|
2016
|
+
name?: string;
|
|
2017
|
+
status?: string;
|
|
2018
|
+
}): Promise<T>;
|
|
2019
|
+
/**
|
|
2020
|
+
* Delete a broadcast campaign record.
|
|
2021
|
+
* Note: This does not cancel messages already in flight but removes the record from the dashboard.
|
|
2022
|
+
*
|
|
2023
|
+
* @param id - The unique ID of the broadcast.
|
|
2024
|
+
* @example
|
|
2025
|
+
* ```typescript
|
|
2026
|
+
* await erixClient.whatsapp.broadcasts.delete("bc_123");
|
|
2027
|
+
* ```
|
|
2028
|
+
*/
|
|
2029
|
+
delete<T = any>(id: string): Promise<T>;
|
|
1567
2030
|
}
|
|
1568
2031
|
|
|
1569
2032
|
interface ListParams {
|
|
@@ -1575,12 +2038,28 @@ interface ListParams {
|
|
|
1575
2038
|
declare class Conversations extends APIResource {
|
|
1576
2039
|
/**
|
|
1577
2040
|
* List conversations for the tenant.
|
|
2041
|
+
* @deprecated Use `list` method from `ErixClient` instead.
|
|
2042
|
+
* @param params - List parameters.
|
|
2043
|
+
* @returns List of conversations.
|
|
2044
|
+
* @example
|
|
2045
|
+
* ```typescript
|
|
2046
|
+
* import { ErixClient } from "erix-react";
|
|
2047
|
+
* const erixClient = new ErixClient({ apiKey: "YOUR_API_KEY" });
|
|
2048
|
+
* const conversations = await erixClient.whatsapp.conversations.list();
|
|
2049
|
+
* ```
|
|
1578
2050
|
*/
|
|
1579
2051
|
list<T = any>(params?: ListParams): Promise<T>;
|
|
1580
2052
|
/**
|
|
1581
2053
|
* Create a new conversation explicitly.
|
|
1582
2054
|
*
|
|
1583
2055
|
* @param params - Conversation details.
|
|
2056
|
+
* @example
|
|
2057
|
+
* ```typescript
|
|
2058
|
+
* const conversation = await erixClient.whatsapp.conversations.create({
|
|
2059
|
+
* phone: "+919876543210",
|
|
2060
|
+
* name: "John Doe"
|
|
2061
|
+
* });
|
|
2062
|
+
* ```
|
|
1584
2063
|
*/
|
|
1585
2064
|
create<T = any>(params: {
|
|
1586
2065
|
phone: string;
|
|
@@ -1588,28 +2067,67 @@ declare class Conversations extends APIResource {
|
|
|
1588
2067
|
}): Promise<T>;
|
|
1589
2068
|
/**
|
|
1590
2069
|
* Retrieve details of a specific conversation.
|
|
2070
|
+
*
|
|
2071
|
+
* @param conversationId - The unique ID of the conversation.
|
|
2072
|
+
* @example
|
|
2073
|
+
* ```typescript
|
|
2074
|
+
* const conversation = await erixClient.whatsapp.conversations.retrieve("conv_123");
|
|
2075
|
+
* ```
|
|
1591
2076
|
*/
|
|
1592
2077
|
retrieve<T = any>(conversationId: string): Promise<T>;
|
|
1593
2078
|
/**
|
|
1594
2079
|
* Get messages for a specific conversation.
|
|
2080
|
+
*
|
|
2081
|
+
* @param conversationId - The unique ID of the conversation.
|
|
2082
|
+
* @param params - Pagination and filter parameters.
|
|
2083
|
+
* @example
|
|
2084
|
+
* ```typescript
|
|
2085
|
+
* const messages = await erixClient.whatsapp.conversations.messages("conv_123", { limit: 50 });
|
|
2086
|
+
* ```
|
|
1595
2087
|
*/
|
|
1596
2088
|
messages<T = any>(conversationId: string, params?: ListParams): Promise<T>;
|
|
1597
2089
|
/**
|
|
1598
|
-
* Link a conversation to a lead.
|
|
2090
|
+
* Link a conversation to a lead in the CRM.
|
|
2091
|
+
*
|
|
2092
|
+
* @param conversationId - The unique ID of the conversation.
|
|
2093
|
+
* @param leadId - The unique ID of the lead to link.
|
|
2094
|
+
* @param leadData - Optional additional lead metadata.
|
|
2095
|
+
* @example
|
|
2096
|
+
* ```typescript
|
|
2097
|
+
* await erixClient.whatsapp.conversations.linkLead("conv_123", "lead_456");
|
|
2098
|
+
* ```
|
|
1599
2099
|
*/
|
|
1600
2100
|
linkLead<T = any>(conversationId: string, leadId: string, leadData?: any): Promise<T>;
|
|
1601
2101
|
/**
|
|
1602
2102
|
* Mark a conversation as read (clear unread count).
|
|
2103
|
+
*
|
|
2104
|
+
* @param conversationId - The unique ID of the conversation.
|
|
2105
|
+
* @example
|
|
2106
|
+
* ```typescript
|
|
2107
|
+
* await erixClient.whatsapp.conversations.markRead("conv_123");
|
|
2108
|
+
* ```
|
|
1603
2109
|
*/
|
|
1604
2110
|
markRead<T = any>(conversationId: string): Promise<T>;
|
|
1605
2111
|
/**
|
|
1606
2112
|
* Delete a conversation.
|
|
2113
|
+
*
|
|
2114
|
+
* @param conversationId - The unique ID of the conversation.
|
|
2115
|
+
* @example
|
|
2116
|
+
* ```typescript
|
|
2117
|
+
* await erixClient.whatsapp.conversations.delete("conv_123");
|
|
2118
|
+
* ```
|
|
1607
2119
|
*/
|
|
1608
2120
|
delete(conversationId: string): Promise<unknown>;
|
|
1609
2121
|
/**
|
|
1610
2122
|
* Bulk delete conversations.
|
|
2123
|
+
*
|
|
2124
|
+
* @param ids - Array of conversation IDs to delete.
|
|
2125
|
+
* @example
|
|
2126
|
+
* ```typescript
|
|
2127
|
+
* await erixClient.whatsapp.conversations.bulkDelete(["conv_1", "conv_2"]);
|
|
2128
|
+
* ```
|
|
1611
2129
|
*/
|
|
1612
|
-
bulkDelete(ids: string[]): Promise<
|
|
2130
|
+
bulkDelete<T = any>(ids: string[]): Promise<T>;
|
|
1613
2131
|
}
|
|
1614
2132
|
|
|
1615
2133
|
/**
|
|
@@ -1700,26 +2218,26 @@ declare class Messages extends APIResource {
|
|
|
1700
2218
|
* Send a free-text or media message to a WhatsApp number.
|
|
1701
2219
|
*
|
|
1702
2220
|
* For text-only messages, supply `text`. For media, supply `mediaUrl`
|
|
1703
|
-
* and `mediaType`. Both can be combined.
|
|
2221
|
+
* and `mediaType`. Both can be combined in a single message.
|
|
1704
2222
|
*
|
|
1705
|
-
* @param params - Message parameters.
|
|
1706
|
-
* @returns The created message record.
|
|
2223
|
+
* @param params - Message parameters including recipient, text, and media.
|
|
2224
|
+
* @returns The created message record from the database.
|
|
1707
2225
|
*
|
|
1708
|
-
* @example
|
|
2226
|
+
* @example Send a simple text message
|
|
1709
2227
|
* ```typescript
|
|
1710
|
-
* await
|
|
2228
|
+
* await erixClient.whatsapp.messages.send({
|
|
1711
2229
|
* to: "+919876543210",
|
|
1712
|
-
* text: "Hello!",
|
|
2230
|
+
* text: "Hello from Ecodrix!",
|
|
1713
2231
|
* });
|
|
1714
2232
|
* ```
|
|
1715
2233
|
*
|
|
1716
|
-
* @example
|
|
2234
|
+
* @example Send an image with a caption
|
|
1717
2235
|
* ```typescript
|
|
1718
|
-
* await
|
|
2236
|
+
* await erixClient.whatsapp.messages.send({
|
|
1719
2237
|
* to: "+919876543210",
|
|
1720
|
-
*
|
|
1721
|
-
*
|
|
1722
|
-
*
|
|
2238
|
+
* text: "Check out this flyer",
|
|
2239
|
+
* mediaUrl: "https://example.com/flyer.jpg",
|
|
2240
|
+
* mediaType: "image",
|
|
1723
2241
|
* });
|
|
1724
2242
|
* ```
|
|
1725
2243
|
*/
|
|
@@ -1727,20 +2245,20 @@ declare class Messages extends APIResource {
|
|
|
1727
2245
|
/**
|
|
1728
2246
|
* Send a pre-approved WhatsApp Business template message.
|
|
1729
2247
|
*
|
|
1730
|
-
* Templates must be approved in Meta Business Manager before
|
|
1731
|
-
* Variable placeholders
|
|
1732
|
-
*
|
|
2248
|
+
* Templates must be approved in Meta Business Manager before they can be sent.
|
|
2249
|
+
* Variable placeholders (e.g., {{1}}, {{2}}) are replaced with values from the
|
|
2250
|
+
* `variables` array in order.
|
|
1733
2251
|
*
|
|
1734
|
-
* @param params - Template message
|
|
2252
|
+
* @param params - Template message configuration (name, language, variables).
|
|
1735
2253
|
* @returns The created message record.
|
|
1736
2254
|
*
|
|
1737
2255
|
* @example
|
|
1738
2256
|
* ```typescript
|
|
1739
|
-
* await
|
|
2257
|
+
* await erixClient.whatsapp.messages.sendTemplate({
|
|
1740
2258
|
* to: "+919876543210",
|
|
1741
|
-
* templateName: "
|
|
2259
|
+
* templateName: "welcome_user",
|
|
1742
2260
|
* language: "en_US",
|
|
1743
|
-
* variables: ["Alice",
|
|
2261
|
+
* variables: ["Alice"], // Replaces {{1}} in template
|
|
1744
2262
|
* });
|
|
1745
2263
|
* ```
|
|
1746
2264
|
*/
|
|
@@ -1802,7 +2320,14 @@ interface TemplateMapping {
|
|
|
1802
2320
|
}
|
|
1803
2321
|
declare class Templates extends APIResource {
|
|
1804
2322
|
/**
|
|
1805
|
-
* List all templates
|
|
2323
|
+
* List all WhatsApp message templates in the tenant database.
|
|
2324
|
+
*
|
|
2325
|
+
* @param params - Optional filter parameters (status, mappingStatus, channel).
|
|
2326
|
+
* @returns List of message templates.
|
|
2327
|
+
* @example
|
|
2328
|
+
* ```typescript
|
|
2329
|
+
* const templates = await erixClient.whatsapp.templates.list({ status: "APPROVED" });
|
|
2330
|
+
* ```
|
|
1806
2331
|
*/
|
|
1807
2332
|
list<T = any>(params?: {
|
|
1808
2333
|
status?: string;
|
|
@@ -1810,54 +2335,108 @@ declare class Templates extends APIResource {
|
|
|
1810
2335
|
channel?: string;
|
|
1811
2336
|
}): Promise<T>;
|
|
1812
2337
|
/**
|
|
1813
|
-
* Synchronize templates from Meta API.
|
|
2338
|
+
* Synchronize templates from the Meta WhatsApp Business API.
|
|
2339
|
+
* This updates the local database with the latest template status and content from Meta.
|
|
2340
|
+
*
|
|
2341
|
+
* @returns Success status of the sync operation.
|
|
2342
|
+
* @example
|
|
2343
|
+
* ```typescript
|
|
2344
|
+
* await erixClient.whatsapp.templates.sync();
|
|
2345
|
+
* ```
|
|
1814
2346
|
*/
|
|
1815
2347
|
sync<T = any>(): Promise<T>;
|
|
1816
2348
|
/**
|
|
1817
|
-
*
|
|
2349
|
+
* Retrieve details of a specific WhatsApp template.
|
|
2350
|
+
*
|
|
2351
|
+
* @param templateIdentifier - The name or ID of the template.
|
|
2352
|
+
* @returns Detailed template object including components and status.
|
|
2353
|
+
* @example
|
|
2354
|
+
* ```typescript
|
|
2355
|
+
* const template = await erixClient.whatsapp.templates.retrieve("welcome_message");
|
|
2356
|
+
* ```
|
|
1818
2357
|
*/
|
|
1819
2358
|
retrieve<T = any>(templateIdentifier: string): Promise<T>;
|
|
1820
2359
|
/**
|
|
1821
|
-
* Create a new template manually.
|
|
2360
|
+
* Create a new WhatsApp template manually (Draft).
|
|
2361
|
+
*
|
|
2362
|
+
* @param payload - Template configuration (name, category, language, components).
|
|
2363
|
+
* @example
|
|
2364
|
+
* ```typescript
|
|
2365
|
+
* await erixClient.whatsapp.templates.create({
|
|
2366
|
+
* name: "new_promotion",
|
|
2367
|
+
* category: "MARKETING",
|
|
2368
|
+
* language: "en_US",
|
|
2369
|
+
* components: [...]
|
|
2370
|
+
* });
|
|
2371
|
+
* ```
|
|
1822
2372
|
*/
|
|
1823
2373
|
create<T = any>(payload: any): Promise<T>;
|
|
1824
2374
|
/**
|
|
1825
|
-
* Update an existing template.
|
|
2375
|
+
* Update an existing WhatsApp template.
|
|
2376
|
+
*
|
|
2377
|
+
* @param templateId - The unique ID of the template.
|
|
2378
|
+
* @param payload - Updated template configuration.
|
|
1826
2379
|
*/
|
|
1827
2380
|
update<T = any>(templateId: string, payload: any): Promise<T>;
|
|
1828
2381
|
/**
|
|
1829
|
-
* Delete a template.
|
|
2382
|
+
* Delete a WhatsApp template from both the local database and Meta (if specified).
|
|
2383
|
+
*
|
|
2384
|
+
* @param templateName - The name of the template to delete.
|
|
2385
|
+
* @param force - If true, attempts to delete from Meta API as well.
|
|
2386
|
+
* @example
|
|
2387
|
+
* ```typescript
|
|
2388
|
+
* await erixClient.whatsapp.templates.deleteTemplate("old_template", true);
|
|
2389
|
+
* ```
|
|
1830
2390
|
*/
|
|
1831
2391
|
deleteTemplate<T = any>(templateName: string, force?: boolean): Promise<T>;
|
|
1832
2392
|
/**
|
|
1833
|
-
* List
|
|
2393
|
+
* List available configuration options for variable mapping.
|
|
2394
|
+
*
|
|
2395
|
+
* @example
|
|
2396
|
+
* ```typescript
|
|
2397
|
+
* const config = await erixClient.whatsapp.templates.mappingConfig();
|
|
2398
|
+
* ```
|
|
1834
2399
|
*/
|
|
1835
2400
|
mappingConfig<T = any>(): Promise<T>;
|
|
1836
2401
|
/**
|
|
1837
|
-
* List CRM collections for variable mapping.
|
|
2402
|
+
* List CRM collections available for variable mapping (Leads, Deals, etc.).
|
|
1838
2403
|
*/
|
|
1839
2404
|
collections<T = any>(): Promise<T>;
|
|
1840
2405
|
/**
|
|
1841
|
-
* List
|
|
2406
|
+
* List fields for a specific CRM collection to be used in mapping.
|
|
2407
|
+
*
|
|
2408
|
+
* @param collectionName - The name of the CRM collection.
|
|
1842
2409
|
*/
|
|
1843
2410
|
collectionFields<T = any>(collectionName: string): Promise<T>;
|
|
1844
2411
|
/**
|
|
1845
|
-
* Update variable mappings for a template.
|
|
2412
|
+
* Update variable mappings for a template to automate personalization.
|
|
2413
|
+
*
|
|
2414
|
+
* @param templateName - Name of the template.
|
|
2415
|
+
* @param payload - Mapping definitions.
|
|
1846
2416
|
*/
|
|
1847
2417
|
updateMapping<T = any>(templateName: string, payload: TemplateMapping): Promise<T>;
|
|
1848
2418
|
/**
|
|
1849
|
-
* Validate
|
|
2419
|
+
* Validate if a template is ready for automated sending based on its mappings.
|
|
1850
2420
|
*/
|
|
1851
2421
|
validate<T = any>(templateName: string): Promise<T>;
|
|
1852
2422
|
/**
|
|
1853
|
-
* Preview a template resolution.
|
|
2423
|
+
* Preview a template resolution with sample data.
|
|
2424
|
+
*
|
|
2425
|
+
* @param templateName - Name of the template.
|
|
2426
|
+
* @param context - Lead data or variable overrides for preview.
|
|
2427
|
+
* @example
|
|
2428
|
+
* ```typescript
|
|
2429
|
+
* const preview = await erixClient.whatsapp.templates.preview("welcome", {
|
|
2430
|
+
* lead: { firstName: "Alice" }
|
|
2431
|
+
* });
|
|
2432
|
+
* ```
|
|
1854
2433
|
*/
|
|
1855
2434
|
preview<T = any>(templateName: string, context: {
|
|
1856
2435
|
lead?: any;
|
|
1857
2436
|
vars?: any;
|
|
1858
2437
|
}): Promise<T>;
|
|
1859
2438
|
/**
|
|
1860
|
-
* Check
|
|
2439
|
+
* Check which automations or sequences are currently using this template.
|
|
1861
2440
|
*/
|
|
1862
2441
|
checkUsage<T = any>(templateName: string): Promise<T>;
|
|
1863
2442
|
}
|