@ecodrix/erix-api 1.1.4 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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,65 +129,136 @@ interface AnalyticsParams {
96
129
  }
97
130
  declare class Analytics extends APIResource {
98
131
  /**
99
- * KPIs: total leads, pipeline value, won revenue, avg score, conversion rate.
132
+ * Retrieve high-level CRM performance KPIs.
133
+ * Includes total leads, pipeline value, won revenue, and conversion rates.
134
+ *
135
+ * @param params - Optional filters including time range (24h, 7d, 30d, etc.) and custom date bounds.
136
+ * @returns {Promise<any>} KPI summary object containing core business metrics.
137
+ * @example
138
+ * ```typescript
139
+ * const stats = await erixClient.crm.analytics.overview({ range: "30d" });
140
+ * console.log(stats.avgScore);
141
+ * ```
100
142
  */
101
143
  overview<T = any>(params?: AnalyticsParams): Promise<T>;
102
144
  /**
103
- * Stage-by-stage lead counts and conversion percentages.
145
+ * Get stage-by-stage lead counts and conversion percentages for a pipeline.
146
+ * Useful for identifying funnel bottlenecks and drop-off points.
147
+ *
148
+ * @param pipelineId - The unique ID of the pipeline to analyze.
149
+ * @returns {Promise<any>} Array of funnel stages with count and conversion data.
150
+ * @example
151
+ * ```typescript
152
+ * const funnel = await erixClient.crm.analytics.funnel("pipe_123");
153
+ * ```
104
154
  */
105
155
  funnel<T = any>(pipelineId: string): Promise<T>;
106
156
  /**
107
- * Revenue forecast: deal value × stage probability.
157
+ * Revenue forecast: Calculates expected revenue based on deal value × stage probability.
158
+ * Helps in sales planning and goal setting.
159
+ *
160
+ * @param pipelineId - Optional pipeline ID to filter the forecast.
161
+ * @returns {Promise<any>} Forecast data including weighted expected revenue.
162
+ * @example
163
+ * ```typescript
164
+ * const prognosis = await erixClient.crm.analytics.forecast("pipe_123");
165
+ * ```
108
166
  */
109
167
  forecast<T = any>(pipelineId?: string): Promise<T>;
110
168
  /**
111
- * Lead source breakdown: count, conversion rate, total value per source.
169
+ * Lead source breakdown: count, conversion rate, and total value per source.
170
+ *
171
+ * @param params - Time range filters.
172
+ * @returns {Promise<any>} Breakdown of how different marketing channels are performing.
112
173
  */
113
174
  sources<T = any>(params?: AnalyticsParams): Promise<T>;
114
175
  /**
115
- * Team leaderboard: won deals, revenue, activity count, conversion rate per member.
176
+ * Team leaderboard: Evaluates agent performance across won deals, revenue, and activity.
177
+ *
178
+ * @param params - Time range filters.
179
+ * @returns {Promise<any>} Ranked list of team members by performance.
116
180
  */
117
181
  team<T = any>(params?: AnalyticsParams): Promise<T>;
118
182
  /**
119
- * Daily activity counts by type. For activity calendar.
183
+ * Activity heatmap: Daily activity counts by type.
184
+ * Ideal for visualizing engagement patterns on a calendar view.
185
+ *
186
+ * @param params - Time range filters.
187
+ * @returns {Promise<any>} Time-series data of team activities.
120
188
  */
121
189
  heatmap<T = any>(params?: AnalyticsParams): Promise<T>;
122
190
  /**
123
- * Score distribution: how many leads in each score bucket.
191
+ * Score distribution: Groups leads into buckets based on their calculated score (0-100).
192
+ *
193
+ * @returns {Promise<any>} Volume of leads in different readiness tiers.
124
194
  */
125
195
  scores<T = any>(): Promise<T>;
126
196
  /**
127
- * Avg time leads spend in each stage. Helps find bottlenecks.
197
+ * Avg time in stage: Measures the velocity of leads through the sales pipeline.
198
+ *
199
+ * @param pipelineId - Target pipeline ID.
200
+ * @returns {Promise<any>} Velocity metrics per stage.
128
201
  */
129
202
  stageTime<T = any>(pipelineId: string): Promise<T>;
130
203
  /**
131
- * Tiered Growth Report matching business sophistication.
204
+ * Tiered Growth Report matching business sophistication (Pulse, Growth, Weapon).
205
+ * Provides deep tactical and strategic insights.
206
+ *
207
+ * @param params - Filtering and range parameters.
132
208
  */
133
209
  tiered<T = any>(params?: AnalyticsParams): Promise<T>;
134
210
  /**
135
- * Consolidated analytics including CRM overview and WhatsApp.
211
+ * Consolidated analytics including CRM overview and WhatsApp messaging metrics.
212
+ *
213
+ * @param params - Time range filters.
136
214
  */
137
215
  summary<T = any>(params?: AnalyticsParams): Promise<T>;
138
216
  /**
139
- * WhatsApp volume and delivery analytics.
217
+ * Retrieve WhatsApp messaging volume and delivery performance analytics.
218
+ * Includes total sent, delivered, read, and daily volume trends.
219
+ *
220
+ * @param params - Optional filters (time range).
221
+ * @example
222
+ * ```typescript
223
+ * const waStats = await erixClient.crm.analytics.whatsapp({ range: "7d" });
224
+ * console.log(waStats.totalSent);
225
+ * ```
140
226
  */
141
227
  whatsapp<T = any>(params?: AnalyticsParams): Promise<T>;
142
228
  }
143
229
 
144
230
  declare class AutomationDashboard extends APIResource {
145
231
  /**
146
- * Retrieve summary statistics for automation health.
232
+ * Retrieve summary statistics for automation health (total, success, failed).
233
+ *
234
+ * @returns Stats object.
235
+ * @example
236
+ * ```typescript
237
+ * const stats = await erixClient.crm.automationDashboard.stats();
238
+ * ```
147
239
  */
148
240
  stats<T = any>(): Promise<T>;
149
241
  /**
150
- * List recent EventLog entries (automation logs).
242
+ * List recent EventLog entries representing automation executions.
243
+ *
244
+ * @param params - Optional filters (limit, status).
245
+ * @example
246
+ * ```typescript
247
+ * const logs = await erixClient.crm.automationDashboard.logs({ status: "failed" });
248
+ * ```
151
249
  */
152
250
  logs<T = any>(params?: {
153
251
  limit?: number;
154
252
  status?: string;
155
253
  }): Promise<T>;
156
254
  /**
157
- * Re-emit a failed event log to process its automations again.
255
+ * Re-emit a failed event log to re-trigger its associated automation rules.
256
+ *
257
+ * @param logId - The unique ID of the failed event log.
258
+ * @example
259
+ * ```typescript
260
+ * await erixClient.crm.automationDashboard.retryFailedEvent("log_123");
261
+ * ```
158
262
  */
159
263
  retryFailedEvent<T = any>(logId: string): Promise<T>;
160
264
  }
@@ -168,11 +272,29 @@ interface AutomationRulePayload {
168
272
  }
169
273
  declare class Automations extends APIResource {
170
274
  /**
171
- * List all automation rules for the tenant.
275
+ * List all automation rules (workflows) configured for the tenant.
276
+ *
277
+ * @returns Array of automation rule objects.
278
+ * @example
279
+ * ```typescript
280
+ * const rules = await erixClient.crm.automations.list();
281
+ * ```
172
282
  */
173
283
  list<T = any>(): Promise<T>;
174
284
  /**
175
- * Create a new automation rule.
285
+ * Create a new automation rule with triggers and workflow nodes.
286
+ *
287
+ * @param payload - The automation rule definition (trigger, nodes, edges).
288
+ * @returns The created automation rule.
289
+ * @example
290
+ * ```typescript
291
+ * await erixClient.crm.automations.create({
292
+ * name: "Welcome Email Workflow",
293
+ * trigger: "contact_created",
294
+ * nodes: [...],
295
+ * edges: [...]
296
+ * });
297
+ * ```
176
298
  */
177
299
  create<T = any>(payload: AutomationRulePayload): Promise<T>;
178
300
  /**
@@ -192,7 +314,14 @@ declare class Automations extends APIResource {
192
314
  */
193
315
  bulkDelete<T = any>(ruleIds: string[]): Promise<T>;
194
316
  /**
195
- * Dry-run test an automation rule against a specific lead.
317
+ * Dry-run test an automation rule against a specific lead to verify logic.
318
+ *
319
+ * @param ruleId - The ID of the rule to test.
320
+ * @param leadId - The ID of the lead to run the test against.
321
+ * @example
322
+ * ```typescript
323
+ * await erixClient.crm.automations.test("rule_123", "lead_456");
324
+ * ```
196
325
  */
197
326
  test<T = any>(ruleId: string, leadId: string): Promise<T>;
198
327
  /**
@@ -336,13 +465,28 @@ declare class Leads extends APIResource {
336
465
  *
337
466
  * @param params - Lead creation parameters. `firstName` is required.
338
467
  * @returns The newly created Lead document.
468
+ * @example
469
+ * ```typescript
470
+ * const lead = await erixClient.crm.leads.create({
471
+ * firstName: "Alice",
472
+ * phone: "+919876543210",
473
+ * source: "website"
474
+ * });
475
+ * ```
339
476
  */
340
477
  create<T = any>(params: CreateLeadParams): Promise<T>;
341
478
  /**
342
- * Upsert a lead by phone number. Creates if not exists, updates if exists.
479
+ * Upsert a lead by phone number. If a lead with the same phone exists,
480
+ * it will be updated; otherwise, a new lead is created.
343
481
  *
344
482
  * @param params - Upsert parameters containing leadData with a phone number.
345
483
  * @returns The newly created or updated Lead document.
484
+ * @example
485
+ * ```typescript
486
+ * await erixClient.crm.leads.upsert({
487
+ * leadData: { phone: "+919876543210", firstName: "Alice" }
488
+ * });
489
+ * ```
346
490
  */
347
491
  upsert<T = any>(params: UpsertLeadParams): Promise<T>;
348
492
  /**
@@ -361,10 +505,18 @@ declare class Leads extends APIResource {
361
505
  */
362
506
  import<T = any>(leads: Partial<CreateLeadParams>[]): Promise<T>;
363
507
  /**
364
- * List leads with optional filtering and pagination.
508
+ * List CRM leads with optional filtering and pagination.
365
509
  *
366
510
  * @param params - Filter options (status, source, pipelineId, page, limit, etc.)
367
511
  * @returns Paginated list of Lead documents.
512
+ * @example
513
+ * ```typescript
514
+ * const leads = await erixClient.crm.leads.list({
515
+ * status: "new",
516
+ * source: "website",
517
+ * limit: 20
518
+ * });
519
+ * ```
368
520
  */
369
521
  list<T = any>(params?: ListLeadsParams): Promise<T>;
370
522
  /**
@@ -384,6 +536,10 @@ declare class Leads extends APIResource {
384
536
  *
385
537
  * @param leadId - The MongoDB ObjectId of the lead.
386
538
  * @returns The Lead document, or a 404 error if not found.
539
+ * @example
540
+ * ```typescript
541
+ * const lead = await erixClient.crm.leads.retrieve("64abc...");
542
+ * ```
387
543
  */
388
544
  retrieve<T = any>(leadId: string): Promise<T>;
389
545
  /**
@@ -405,6 +561,13 @@ declare class Leads extends APIResource {
405
561
  * @param leadId - The ID of the lead to update.
406
562
  * @param params - Partial lead fields to update.
407
563
  * @returns The updated Lead document.
564
+ * @example
565
+ * ```typescript
566
+ * await erixClient.crm.leads.update("64abc...", {
567
+ * lastName: "Smith",
568
+ * status: "qualified"
569
+ * });
570
+ * ```
408
571
  */
409
572
  update<T = any>(leadId: string, params: Partial<CreateLeadParams>): Promise<T>;
410
573
  /**
@@ -495,7 +658,18 @@ declare class Leads extends APIResource {
495
658
 
496
659
  declare class Payments extends APIResource {
497
660
  /**
498
- * Record an inbound payment against a lead or appointment.
661
+ * Record an inbound payment/transaction against a lead or specific appointment.
662
+ *
663
+ * @param payload - Payment details (leadId, amount, currency, description).
664
+ * @example
665
+ * ```typescript
666
+ * await erixClient.crm.payments.capture({
667
+ * leadId: "lead_123",
668
+ * amount: 5000,
669
+ * currency: "INR",
670
+ * description: "Consultation Fee"
671
+ * });
672
+ * ```
499
673
  */
500
674
  capture<T = any>(payload: {
501
675
  leadId: string;
@@ -518,18 +692,40 @@ interface PipelineStageParams {
518
692
  }
519
693
  declare class Pipelines extends APIResource {
520
694
  /**
521
- * List all pipelines and their stages.
695
+ * List all CRM pipelines and their configured stages.
696
+ *
697
+ * @returns Array of pipeline objects with nested stages.
698
+ * @example
699
+ * ```typescript
700
+ * const pipelines = await erixClient.crm.pipelines.list();
701
+ * ```
522
702
  */
523
703
  list<T = any>(): Promise<T>;
524
704
  /**
525
- * Create a new pipeline.
705
+ * Create a new CRM sales or support pipeline.
706
+ *
707
+ * @param payload - Pipeline details (name and array of stage names).
708
+ * @returns The created pipeline record.
709
+ * @example
710
+ * ```typescript
711
+ * await erixClient.crm.pipelines.create({
712
+ * name: "Sales Pipeline",
713
+ * stages: ["Lead", "Contacted", "Proposal", "Negotiation", "Closed"]
714
+ * });
715
+ * ```
526
716
  */
527
717
  create<T = any>(payload: {
528
718
  name: string;
529
719
  stages: string[];
530
720
  }): Promise<T>;
531
721
  /**
532
- * Retrieve a single pipeline by ID.
722
+ * Retrieve a single pipeline configuration by ID.
723
+ *
724
+ * @param pipelineId - The unique ID of the pipeline.
725
+ * @example
726
+ * ```typescript
727
+ * const pipeline = await erixClient.crm.pipelines.retrieve("pipe_123");
728
+ * ```
533
729
  */
534
730
  retrieve<T = any>(pipelineId: string): Promise<T>;
535
731
  /**
@@ -557,6 +753,12 @@ declare class Pipelines extends APIResource {
557
753
  delete(pipelineId: string): Promise<unknown>;
558
754
  /**
559
755
  * Retrieve a Kanban-style board representation of the pipeline with leads nested.
756
+ *
757
+ * @param pipelineId - The unique ID of the pipeline.
758
+ * @example
759
+ * ```typescript
760
+ * const board = await erixClient.crm.pipelines.board("pipe_123");
761
+ * ```
560
762
  */
561
763
  board<T = any>(pipelineId: string): Promise<T>;
562
764
  /**
@@ -565,6 +767,17 @@ declare class Pipelines extends APIResource {
565
767
  forecast<T = any>(pipelineId: string): Promise<T>;
566
768
  /**
567
769
  * Add a new stage to the pipeline.
770
+ *
771
+ * @param pipelineId - The unique ID of the pipeline.
772
+ * @param params - Stage details (name, color, probability).
773
+ * @example
774
+ * ```typescript
775
+ * await erixClient.crm.pipelines.addStage("pipe_123", {
776
+ * name: "Decision Maker Bought In",
777
+ * color: "#FF5733",
778
+ * probability: 80
779
+ * });
780
+ * ```
568
781
  */
569
782
  addStage<T = any>(pipelineId: string, params: PipelineStageParams): Promise<T>;
570
783
  /**
@@ -576,7 +789,10 @@ declare class Pipelines extends APIResource {
576
789
  */
577
790
  updateStage<T = any>(stageId: string, params: Partial<PipelineStageParams>): Promise<T>;
578
791
  /**
579
- * Delete a stage. Optionally provide a fallback stageId to move active leads to.
792
+ * Delete a stage permanently.
793
+ *
794
+ * @param stageId - The unique ID of the stage to delete.
795
+ * @param moveLeadsToStageId - Optional fallback stageId to move active leads to before deletion.
580
796
  */
581
797
  deleteStage(stageId: string, moveLeadsToStageId?: string): Promise<unknown>;
582
798
  }
@@ -591,7 +807,13 @@ interface ScoringConfig {
591
807
  }
592
808
  declare class Scoring extends APIResource {
593
809
  /**
594
- * Retrieve the tenant's global lead scoring configuration.
810
+ * Retrieve the tenant's global lead scoring configuration (rules, decay, thresholds).
811
+ *
812
+ * @returns The scoring configuration object.
813
+ * @example
814
+ * ```typescript
815
+ * const config = await erixClient.crm.scoring.getConfig();
816
+ * ```
595
817
  */
596
818
  getConfig<T = any>(): Promise<T>;
597
819
  /**
@@ -599,14 +821,31 @@ declare class Scoring extends APIResource {
599
821
  */
600
822
  updateConfig<T = any>(payload: Partial<ScoringConfig>): Promise<T>;
601
823
  /**
602
- * Force recalculate the score for a specific lead.
824
+ * Force an immediate score recalculation for a specific lead.
825
+ * Useful when profile data changes significantly.
826
+ *
827
+ * @param leadId - The unique ID of the lead.
828
+ * @example
829
+ * ```typescript
830
+ * await erixClient.crm.scoring.recalculate("lead_123");
831
+ * ```
603
832
  */
604
833
  recalculate<T = any>(leadId: string): Promise<T>;
605
834
  }
606
835
 
607
836
  declare class Sequences extends APIResource {
608
837
  /**
609
- * Manually enroll a lead in a drip sequence (automation rule).
838
+ * Manually enroll a lead into a specific automation drip sequence (Workflow).
839
+ *
840
+ * @param payload - Enrollment details (leadId, ruleId, and custom variables).
841
+ * @example
842
+ * ```typescript
843
+ * await erixClient.crm.sequences.enroll({
844
+ * leadId: "lead_123",
845
+ * ruleId: "rule_456",
846
+ * variables: { start_date: "2026-05-01" }
847
+ * });
848
+ * ```
610
849
  */
611
850
  enroll<T = any>(payload: {
612
851
  leadId: string;
@@ -614,11 +853,24 @@ declare class Sequences extends APIResource {
614
853
  variables?: Record<string, any>;
615
854
  }): Promise<T>;
616
855
  /**
617
- * Unenroll a lead from a running sequence.
856
+ * Unenroll a lead from a currently running automation sequence.
857
+ *
858
+ * @param enrollmentId - The unique ID of the sequence enrollment.
859
+ * @example
860
+ * ```typescript
861
+ * await erixClient.crm.sequences.unenroll("enroll_123");
862
+ * ```
618
863
  */
619
864
  unenroll<T = any>(enrollmentId: string): Promise<unknown>;
620
865
  /**
621
- * List active sequence enrollments for a specific lead.
866
+ * List all active and completed sequence enrollments for a specific lead.
867
+ *
868
+ * @param leadId - The unique ID of the lead.
869
+ * @returns Array of enrollment records.
870
+ * @example
871
+ * ```typescript
872
+ * const enrollments = await erixClient.crm.sequences.listForLead("lead_123");
873
+ * ```
622
874
  */
623
875
  listForLead<T = any>(leadId: string): Promise<T>;
624
876
  }
@@ -660,14 +912,26 @@ declare class EmailResource extends APIResource {
660
912
  * Send an HTML email campaign to a list of recipients.
661
913
  *
662
914
  * @param payload - The campaign details (recipients, subject, html).
663
- * @returns The dispatch result.
915
+ * @returns The dispatch result indicating success or failure.
916
+ * @example
917
+ * ```typescript
918
+ * await erixClient.email.sendEmailCampaign({
919
+ * recipients: ["user1@example.com", "user2@example.com"],
920
+ * subject: "Monthly Newsletter",
921
+ * html: "<h1>Hello!</h1><p>Check out our latest updates...</p>"
922
+ * });
923
+ * ```
664
924
  */
665
925
  sendEmailCampaign(payload: SendCampaignPayload): Promise<CampaignResult>;
666
926
  /**
667
- * Send a system verification/test email to validate SMTP configuration.
927
+ * Send a system test email to validate your current SMTP configuration.
668
928
  *
669
929
  * @param to - The recipient's email address.
670
930
  * @returns The dispatch result.
931
+ * @example
932
+ * ```typescript
933
+ * await erixClient.email.sendTestEmail("admin@company.com");
934
+ * ```
671
935
  */
672
936
  sendTestEmail(to: string): Promise<CampaignResult>;
673
937
  }
@@ -761,7 +1025,13 @@ interface TriggerResponse {
761
1025
  }
762
1026
  declare class EventsResource extends APIResource {
763
1027
  /**
764
- * Retrieve all valid events (system + custom) that can be used as Automation Rule triggers.
1028
+ * List all available event definitions (both system and custom) that can trigger automations.
1029
+ *
1030
+ * @returns Array of event definitions.
1031
+ * @example
1032
+ * ```typescript
1033
+ * const events = await erixClient.events.list();
1034
+ * ```
765
1035
  */
766
1036
  list(): Promise<{
767
1037
  success: boolean;
@@ -790,8 +1060,20 @@ declare class EventsResource extends APIResource {
790
1060
  message: string;
791
1061
  }>;
792
1062
  /**
793
- * Programmatically fire an event into the CRM automation engine.
794
- * Emits to the internal EventBus to match with active Workflow Automation Rules.
1063
+ * Programmatically trigger an automation workflow by firing a specific event.
1064
+ * This matches the event against active Automation Rules and executes linked actions.
1065
+ *
1066
+ * @param payload - The trigger details (event name, lead phone/email, variables).
1067
+ * @returns Trigger response with diagnostic info (eventLogId, matched rules).
1068
+ * @example
1069
+ * ```typescript
1070
+ * await erixClient.events.trigger({
1071
+ * trigger: "webinar_joined",
1072
+ * phone: "+919876543210",
1073
+ * variables: { webinar_name: "AI Masterclass" },
1074
+ * createLeadIfMissing: true
1075
+ * });
1076
+ * ```
795
1077
  */
796
1078
  trigger(payload: TriggerPayload): Promise<TriggerResponse>;
797
1079
  /**
@@ -853,7 +1135,15 @@ interface JobStatus {
853
1135
  }
854
1136
  declare class Health extends APIResource {
855
1137
  /**
856
- * Global platform health check.
1138
+ * Perform a global platform health check.
1139
+ * Verify that the API, database, and background workers are operational.
1140
+ *
1141
+ * @returns System health summary (status, version, uptime).
1142
+ * @example
1143
+ * ```typescript
1144
+ * const health = await erixClient.health.system();
1145
+ * console.log(`API Status: ${health.status}`);
1146
+ * ```
857
1147
  */
858
1148
  system(): Promise<SystemHealth>;
859
1149
  /**
@@ -861,7 +1151,17 @@ declare class Health extends APIResource {
861
1151
  */
862
1152
  clientHealth(): Promise<ClientHealth>;
863
1153
  /**
864
- * Job execution status lookup.
1154
+ * Lookup the execution status of a background job.
1155
+ *
1156
+ * @param jobId - The unique ID of the background job.
1157
+ * @returns Job status report (attempts, error trace, completion time).
1158
+ * @example
1159
+ * ```typescript
1160
+ * const status = await erixClient.health.jobStatus("job_123");
1161
+ * if (status.status === "completed") {
1162
+ * console.log("Job finished successfully!");
1163
+ * }
1164
+ * ```
865
1165
  */
866
1166
  jobStatus(jobId: string): Promise<JobStatus>;
867
1167
  }
@@ -873,7 +1173,18 @@ interface SendCampaignParams {
873
1173
  }
874
1174
  declare class Emails extends APIResource {
875
1175
  /**
876
- * Dispatch a bulk email campaign.
1176
+ * Dispatch a bulk email campaign to a list of recipients.
1177
+ *
1178
+ * @param params - The campaign details (recipients, subject, html).
1179
+ * @returns The dispatch result.
1180
+ * @example
1181
+ * ```typescript
1182
+ * await erixClient.marketing.emails.sendCampaign({
1183
+ * recipients: ["user@example.com"],
1184
+ * subject: "Special Offer",
1185
+ * html: "<p>Check out our deal!</p>"
1186
+ * });
1187
+ * ```
877
1188
  */
878
1189
  sendCampaign<T = any>(params: SendCampaignParams): Promise<T>;
879
1190
  /**
@@ -883,14 +1194,33 @@ declare class Emails extends APIResource {
883
1194
  }
884
1195
  declare class Campaigns extends APIResource {
885
1196
  /**
886
- * List email and SMS marketing campaigns.
1197
+ * List all email and SMS marketing campaigns with optional status filtering.
1198
+ *
1199
+ * @param params - Optional filters (status, limit).
1200
+ * @returns Paginated list of campaign objects.
1201
+ * @example
1202
+ * ```typescript
1203
+ * const campaigns = await erixClient.marketing.campaigns.list({ status: "sent" });
1204
+ * ```
887
1205
  */
888
1206
  list<T = any>(params?: {
889
1207
  status?: string;
890
1208
  limit?: number;
891
1209
  }): Promise<T>;
892
1210
  /**
893
- * Create a new campaign.
1211
+ * Create a new marketing campaign (Email or SMS).
1212
+ *
1213
+ * @param payload - Campaign details (name, type, content).
1214
+ * @returns The created campaign record.
1215
+ * @example
1216
+ * ```typescript
1217
+ * await erixClient.marketing.campaigns.create({
1218
+ * name: "Spring Sale",
1219
+ * type: "email",
1220
+ * subject: "Our Spring Sale is Here!",
1221
+ * html: "<h1>BIG DEALS!</h1>"
1222
+ * });
1223
+ * ```
894
1224
  */
895
1225
  create<T = any>(payload: {
896
1226
  name: string;
@@ -901,7 +1231,13 @@ declare class Campaigns extends APIResource {
901
1231
  recipients?: string[];
902
1232
  }): Promise<T>;
903
1233
  /**
904
- * Retrieve campaign details.
1234
+ * Retrieve full details for a specific marketing campaign.
1235
+ *
1236
+ * @param campaignId - The unique ID of the campaign.
1237
+ * @example
1238
+ * ```typescript
1239
+ * const campaign = await erixClient.marketing.campaigns.retrieve("camp_123");
1240
+ * ```
905
1241
  */
906
1242
  retrieve<T = any>(campaignId: string): Promise<T>;
907
1243
  /**
@@ -913,13 +1249,35 @@ declare class Campaigns extends APIResource {
913
1249
  */
914
1250
  delete<T = any>(campaignId: string): Promise<T>;
915
1251
  /**
916
- * Send or schedule a campaign.
1252
+ * Send a campaign immediately or schedule it for a later date.
1253
+ *
1254
+ * @param campaignId - The ID of the campaign to dispatch.
1255
+ * @param payload - Optional scheduling information (ISO timestamp).
1256
+ * @example
1257
+ * ```typescript
1258
+ * // Send immediately
1259
+ * await erixClient.marketing.campaigns.send("camp_123");
1260
+ *
1261
+ * // Schedule for tomorrow
1262
+ * await erixClient.marketing.campaigns.send("camp_123", {
1263
+ * scheduledAt: "2026-04-10T09:00:00Z"
1264
+ * });
1265
+ * ```
917
1266
  */
918
1267
  send<T = any>(campaignId: string, payload?: {
919
1268
  scheduledAt?: string;
920
1269
  }): Promise<T>;
921
1270
  /**
922
- * Get campaign stats (opens, clicks, bounces).
1271
+ * Get detailed delivery and engagement statistics for a campaign.
1272
+ * Includes opens, clicks, bounces, and delivery failures.
1273
+ *
1274
+ * @param campaignId - The ID of the campaign.
1275
+ * @returns Stats summary object.
1276
+ * @example
1277
+ * ```typescript
1278
+ * const report = await erixClient.marketing.campaigns.stats("camp_123");
1279
+ * console.log(`Open Rate: ${report.openRate}%`);
1280
+ * ```
923
1281
  */
924
1282
  stats<T = any>(campaignId: string): Promise<T>;
925
1283
  }
@@ -927,8 +1285,18 @@ declare class WhatsAppMarketing extends APIResource {
927
1285
  /**
928
1286
  * Dispatch a template-based WhatsApp message with CRM-integrated variable resolution.
929
1287
  *
930
- * Unlike direct WhatsApp sending, this endpoint automatically pulls data from the CRM
1288
+ * Unlike direct WhatsApp sending, this endpoint documentation automatically pulls data from the CRM
931
1289
  * based on the provided variables mapping.
1290
+ *
1291
+ * @param params - Template details and recipient phone.
1292
+ * @example
1293
+ * ```typescript
1294
+ * await erixClient.marketing.whatsapp.sendTemplate({
1295
+ * phone: "+919876543210",
1296
+ * templateName: "order_update",
1297
+ * variables: { "1": "Order #123" }
1298
+ * });
1299
+ * ```
932
1300
  */
933
1301
  sendTemplate<T = any>(params: {
934
1302
  phone: string;
@@ -1346,26 +1714,46 @@ declare class Notifications extends APIResource {
1346
1714
  */
1347
1715
  listCallbacks(params?: Omit<LogFilter, "trigger" | "phone">): Promise<unknown>;
1348
1716
  /**
1349
- * List unread CRM notifications/alerts for the current tenant.
1350
- * Maps to: GET /api/crm/notifications
1717
+ * List unread CRM notifications and alerts (e.g., lead assignments, system alerts).
1718
+ *
1719
+ * @param params - Optional filters (limit, unreadOnly).
1720
+ * @returns Paginated list of notification objects.
1721
+ * @example
1722
+ * ```typescript
1723
+ * const alerts = await erixClient.notifications.listAlerts({ unreadOnly: true });
1724
+ * ```
1351
1725
  */
1352
1726
  listAlerts<T = any>(params?: {
1353
1727
  limit?: number;
1354
1728
  unreadOnly?: boolean;
1355
1729
  }): Promise<T>;
1356
1730
  /**
1357
- * Dismiss a specific notification alert.
1358
- * Maps to: PATCH /api/crm/notifications/:id/dismiss
1731
+ * Dismiss/mark a specific notification alert as read.
1732
+ *
1733
+ * @param notificationId - The unique ID of the notification.
1734
+ * @example
1735
+ * ```typescript
1736
+ * await erixClient.notifications.dismissAlert("alert_123");
1737
+ * ```
1359
1738
  */
1360
1739
  dismissAlert<T = any>(notificationId: string): Promise<T>;
1361
1740
  /**
1362
- * Clear (dismiss) all notifications for the current tenant.
1363
- * Maps to: DELETE /api/crm/notifications/clear-all
1741
+ * Clear all notifications for the current tenant immediately.
1742
+ *
1743
+ * @example
1744
+ * ```typescript
1745
+ * await erixClient.notifications.clearAllAlerts();
1746
+ * ```
1364
1747
  */
1365
1748
  clearAllAlerts<T = any>(): Promise<T>;
1366
1749
  /**
1367
1750
  * Retry an action from a notification (e.g. failed automation send).
1368
- * Maps to: POST /api/crm/notifications/:id/retry
1751
+ *
1752
+ * @param notificationId - The unique ID of the notification.
1753
+ * @example
1754
+ * ```typescript
1755
+ * await erixClient.notifications.retryAction("alert_123");
1756
+ * ```
1369
1757
  */
1370
1758
  retryAction<T = any>(notificationId: string): Promise<T>;
1371
1759
  }
@@ -1379,26 +1767,57 @@ interface JobStats {
1379
1767
  }
1380
1768
  declare class Queue extends APIResource {
1381
1769
  /**
1382
- * List all failed jobs.
1770
+ * List all background jobs that have failed execution.
1771
+ *
1772
+ * @returns Array of failed job objects.
1773
+ * @example
1774
+ * ```typescript
1775
+ * const failed = await erixClient.queue.listFailed();
1776
+ * ```
1383
1777
  */
1384
1778
  listFailed<T = any>(): Promise<T>;
1385
1779
  /**
1386
- * Get queue health statistics.
1780
+ * Get real-time health statistics for the background job queue (waiting, active, failed).
1781
+ *
1782
+ * @returns Queue statistics summary.
1783
+ * @example
1784
+ * ```typescript
1785
+ * const stats = await erixClient.queue.getStats();
1786
+ * console.log(`Active Jobs: ${stats.active}`);
1787
+ * ```
1387
1788
  */
1388
1789
  getStats<T = JobStats>(): Promise<T>;
1389
1790
  /**
1390
- * Retry a failed job.
1791
+ * Manually retry a failed background job.
1792
+ *
1793
+ * @param jobId - The unique ID of the failed job.
1794
+ * @example
1795
+ * ```typescript
1796
+ * await erixClient.queue.retryJob("job_123");
1797
+ * ```
1391
1798
  */
1392
1799
  retryJob<T = any>(jobId: string): Promise<T>;
1393
1800
  /**
1394
1801
  * Remove a job from the queue.
1802
+ *
1803
+ * @param jobId - The unique ID of the job to delete.
1804
+ * @example
1805
+ * ```typescript
1806
+ * await erixClient.queue.deleteJob("job_123");
1807
+ * ```
1395
1808
  */
1396
1809
  deleteJob<T = any>(jobId: string): Promise<T>;
1397
1810
  }
1398
1811
 
1399
1812
  declare class Folders extends APIResource {
1400
1813
  /**
1401
- * Create a new folder.
1814
+ * Create a new folder in the tenant's cloud storage.
1815
+ *
1816
+ * @param name - The name of the folder to create.
1817
+ * @example
1818
+ * ```typescript
1819
+ * await erixClient.storage.folders.create("Invoices");
1820
+ * ```
1402
1821
  */
1403
1822
  create<T = any>(name: string): Promise<T>;
1404
1823
  /**
@@ -1408,7 +1827,14 @@ declare class Folders extends APIResource {
1408
1827
  }
1409
1828
  declare class Files extends APIResource {
1410
1829
  /**
1411
- * List files in a folder.
1830
+ * List files within a specific folder.
1831
+ *
1832
+ * @param folder - The folder name or path.
1833
+ * @param params - Optional year/month filters for organized storage.
1834
+ * @example
1835
+ * ```typescript
1836
+ * const files = await erixClient.storage.files.list("Invoices", { year: "2026" });
1837
+ * ```
1412
1838
  */
1413
1839
  list<T = any>(folder: string, params?: {
1414
1840
  year?: string;
@@ -1416,6 +1842,18 @@ declare class Files extends APIResource {
1416
1842
  }): Promise<T>;
1417
1843
  /**
1418
1844
  * Get a presigned upload URL for direct-to-cloud browser uploads.
1845
+ * This allows the client to upload files directly to R2/S3 without hitting the backend.
1846
+ *
1847
+ * @param params - Upload parameters (folder, filename, contentType).
1848
+ * @example
1849
+ * ```typescript
1850
+ * const { data } = await erixClient.storage.files.getUploadUrl({
1851
+ * folder: "Invoices",
1852
+ * filename: "inv_1.pdf",
1853
+ * contentType: "application/pdf"
1854
+ * });
1855
+ * // Now use data.url with a PUT request
1856
+ * ```
1419
1857
  */
1420
1858
  getUploadUrl<T = any>(params: {
1421
1859
  folder: string;
@@ -1557,13 +1995,70 @@ interface CreateBroadcastParams {
1557
1995
  }
1558
1996
  declare class Broadcasts extends APIResource {
1559
1997
  /**
1560
- * List past and active broadcasts.
1998
+ * List past and active WhatsApp broadcast campaigns.
1999
+ *
2000
+ * @param params - Optional filter parameters (page, limit, status).
2001
+ * @returns Paginated list of broadcast records.
2002
+ * @example
2003
+ * ```typescript
2004
+ * const broadcasts = await erixClient.whatsapp.broadcasts.list({ limit: 10 });
2005
+ * ```
1561
2006
  */
1562
2007
  list<T = any>(params?: Record<string, any>): Promise<T>;
1563
2008
  /**
1564
- * Create a new broadcast to send a template message to multiple recipients.
2009
+ * Retrieve full details and real-time stats for a specific broadcast campaign.
2010
+ *
2011
+ * @param id - The unique identifier of the broadcast.
2012
+ * @returns The broadcast record including sent/failed counts.
2013
+ * @example
2014
+ * ```typescript
2015
+ * const stats = await erixClient.whatsapp.broadcasts.retrieve("bc_123");
2016
+ * console.log(`Success Rate: ${(stats.sentCount / stats.totalRecipients) * 100}%`);
2017
+ * ```
2018
+ */
2019
+ retrieve<T = any>(id: string): Promise<T>;
2020
+ /**
2021
+ * Create a new broadcast campaign to send template messages to multiple recipients.
2022
+ *
2023
+ * @param params - Broadcast configuration (name, templateName, recipients).
2024
+ * @returns The newly created broadcast record.
2025
+ * @example
2026
+ * ```typescript
2027
+ * await erixClient.whatsapp.broadcasts.create({
2028
+ * name: "Spring Sale",
2029
+ * templateName: "promo_code",
2030
+ * recipients: [
2031
+ * { phone: "+919876543210", variables: ["SAVE10"] }
2032
+ * ]
2033
+ * });
2034
+ * ```
1565
2035
  */
1566
2036
  create<T = any>(params: CreateBroadcastParams): Promise<T>;
2037
+ /**
2038
+ * Update broadcast metadata, such as its name or administrative status.
2039
+ *
2040
+ * @param id - The unique ID of the broadcast.
2041
+ * @param data - The fields to update (name, status).
2042
+ * @example
2043
+ * ```typescript
2044
+ * await erixClient.whatsapp.broadcasts.update("bc_123", { name: "Revised Spring Sale" });
2045
+ * ```
2046
+ */
2047
+ update<T = any>(id: string, data: {
2048
+ name?: string;
2049
+ status?: string;
2050
+ }): Promise<T>;
2051
+ /**
2052
+ * Delete a broadcast campaign record.
2053
+ * Note: This does not cancel messages already in flight but removes the record from the dashboard.
2054
+ *
2055
+ * @param id - The unique ID of the broadcast.
2056
+ * @example
2057
+ * ```typescript
2058
+ * await erixClient.whatsapp.broadcasts.delete("bc_123");
2059
+ * ```
2060
+ */
2061
+ delete<T = any>(id: string): Promise<T>;
1567
2062
  }
1568
2063
 
1569
2064
  interface ListParams {
@@ -1575,12 +2070,28 @@ interface ListParams {
1575
2070
  declare class Conversations extends APIResource {
1576
2071
  /**
1577
2072
  * List conversations for the tenant.
2073
+ * @deprecated Use `list` method from `ErixClient` instead.
2074
+ * @param params - List parameters.
2075
+ * @returns List of conversations.
2076
+ * @example
2077
+ * ```typescript
2078
+ * import { ErixClient } from "erix-react";
2079
+ * const erixClient = new ErixClient({ apiKey: "YOUR_API_KEY" });
2080
+ * const conversations = await erixClient.whatsapp.conversations.list();
2081
+ * ```
1578
2082
  */
1579
2083
  list<T = any>(params?: ListParams): Promise<T>;
1580
2084
  /**
1581
2085
  * Create a new conversation explicitly.
1582
2086
  *
1583
2087
  * @param params - Conversation details.
2088
+ * @example
2089
+ * ```typescript
2090
+ * const conversation = await erixClient.whatsapp.conversations.create({
2091
+ * phone: "+919876543210",
2092
+ * name: "John Doe"
2093
+ * });
2094
+ * ```
1584
2095
  */
1585
2096
  create<T = any>(params: {
1586
2097
  phone: string;
@@ -1588,26 +2099,65 @@ declare class Conversations extends APIResource {
1588
2099
  }): Promise<T>;
1589
2100
  /**
1590
2101
  * Retrieve details of a specific conversation.
2102
+ *
2103
+ * @param conversationId - The unique ID of the conversation.
2104
+ * @example
2105
+ * ```typescript
2106
+ * const conversation = await erixClient.whatsapp.conversations.retrieve("conv_123");
2107
+ * ```
1591
2108
  */
1592
2109
  retrieve<T = any>(conversationId: string): Promise<T>;
1593
2110
  /**
1594
2111
  * Get messages for a specific conversation.
2112
+ *
2113
+ * @param conversationId - The unique ID of the conversation.
2114
+ * @param params - Pagination and filter parameters.
2115
+ * @example
2116
+ * ```typescript
2117
+ * const messages = await erixClient.whatsapp.conversations.messages("conv_123", { limit: 50 });
2118
+ * ```
1595
2119
  */
1596
2120
  messages<T = any>(conversationId: string, params?: ListParams): Promise<T>;
1597
2121
  /**
1598
- * Link a conversation to a lead.
2122
+ * Link a conversation to a lead in the CRM.
2123
+ *
2124
+ * @param conversationId - The unique ID of the conversation.
2125
+ * @param leadId - The unique ID of the lead to link.
2126
+ * @param leadData - Optional additional lead metadata.
2127
+ * @example
2128
+ * ```typescript
2129
+ * await erixClient.whatsapp.conversations.linkLead("conv_123", "lead_456");
2130
+ * ```
1599
2131
  */
1600
2132
  linkLead<T = any>(conversationId: string, leadId: string, leadData?: any): Promise<T>;
1601
2133
  /**
1602
2134
  * Mark a conversation as read (clear unread count).
2135
+ *
2136
+ * @param conversationId - The unique ID of the conversation.
2137
+ * @example
2138
+ * ```typescript
2139
+ * await erixClient.whatsapp.conversations.markRead("conv_123");
2140
+ * ```
1603
2141
  */
1604
2142
  markRead<T = any>(conversationId: string): Promise<T>;
1605
2143
  /**
1606
2144
  * Delete a conversation.
2145
+ *
2146
+ * @param conversationId - The unique ID of the conversation.
2147
+ * @example
2148
+ * ```typescript
2149
+ * await erixClient.whatsapp.conversations.delete("conv_123");
2150
+ * ```
1607
2151
  */
1608
2152
  delete(conversationId: string): Promise<unknown>;
1609
2153
  /**
1610
2154
  * Bulk delete conversations.
2155
+ *
2156
+ * @param ids - Array of conversation IDs to delete.
2157
+ * @example
2158
+ * ```typescript
2159
+ * await erixClient.whatsapp.conversations.bulkDelete(["conv_1", "conv_2"]);
2160
+ * ```
1611
2161
  */
1612
2162
  bulkDelete<T = any>(ids: string[]): Promise<T>;
1613
2163
  }
@@ -1700,26 +2250,26 @@ declare class Messages extends APIResource {
1700
2250
  * Send a free-text or media message to a WhatsApp number.
1701
2251
  *
1702
2252
  * For text-only messages, supply `text`. For media, supply `mediaUrl`
1703
- * and `mediaType`. Both can be combined.
2253
+ * and `mediaType`. Both can be combined in a single message.
1704
2254
  *
1705
- * @param params - Message parameters.
1706
- * @returns The created message record.
2255
+ * @param params - Message parameters including recipient, text, and media.
2256
+ * @returns The created message record from the database.
1707
2257
  *
1708
- * @example Text message
2258
+ * @example Send a simple text message
1709
2259
  * ```typescript
1710
- * await ecod.whatsapp.messages.send({
2260
+ * await erixClient.whatsapp.messages.send({
1711
2261
  * to: "+919876543210",
1712
- * text: "Hello!",
2262
+ * text: "Hello from Ecodrix!",
1713
2263
  * });
1714
2264
  * ```
1715
2265
  *
1716
- * @example Media message
2266
+ * @example Send an image with a caption
1717
2267
  * ```typescript
1718
- * await ecod.whatsapp.messages.send({
2268
+ * await erixClient.whatsapp.messages.send({
1719
2269
  * to: "+919876543210",
1720
- * mediaUrl: "https://cdn.ecodrix.com/invoice.pdf",
1721
- * mediaType: "document",
1722
- * filename: "invoice.pdf",
2270
+ * text: "Check out this flyer",
2271
+ * mediaUrl: "https://example.com/flyer.jpg",
2272
+ * mediaType: "image",
1723
2273
  * });
1724
2274
  * ```
1725
2275
  */
@@ -1727,20 +2277,20 @@ declare class Messages extends APIResource {
1727
2277
  /**
1728
2278
  * Send a pre-approved WhatsApp Business template message.
1729
2279
  *
1730
- * Templates must be approved in Meta Business Manager before use.
1731
- * Variable placeholders in the template body are filled left-to-right
1732
- * from the `variables` array.
2280
+ * Templates must be approved in Meta Business Manager before they can be sent.
2281
+ * Variable placeholders (e.g., {{1}}, {{2}}) are replaced with values from the
2282
+ * `variables` array in order.
1733
2283
  *
1734
- * @param params - Template message parameters.
2284
+ * @param params - Template message configuration (name, language, variables).
1735
2285
  * @returns The created message record.
1736
2286
  *
1737
2287
  * @example
1738
2288
  * ```typescript
1739
- * await ecod.whatsapp.messages.sendTemplate({
2289
+ * await erixClient.whatsapp.messages.sendTemplate({
1740
2290
  * to: "+919876543210",
1741
- * templateName: "appointment_reminder",
2291
+ * templateName: "welcome_user",
1742
2292
  * language: "en_US",
1743
- * variables: ["Alice", "10 April", "10:00 AM"],
2293
+ * variables: ["Alice"], // Replaces {{1}} in template
1744
2294
  * });
1745
2295
  * ```
1746
2296
  */
@@ -1802,7 +2352,14 @@ interface TemplateMapping {
1802
2352
  }
1803
2353
  declare class Templates extends APIResource {
1804
2354
  /**
1805
- * List all templates from the tenant database.
2355
+ * List all WhatsApp message templates in the tenant database.
2356
+ *
2357
+ * @param params - Optional filter parameters (status, mappingStatus, channel).
2358
+ * @returns List of message templates.
2359
+ * @example
2360
+ * ```typescript
2361
+ * const templates = await erixClient.whatsapp.templates.list({ status: "APPROVED" });
2362
+ * ```
1806
2363
  */
1807
2364
  list<T = any>(params?: {
1808
2365
  status?: string;
@@ -1810,54 +2367,108 @@ declare class Templates extends APIResource {
1810
2367
  channel?: string;
1811
2368
  }): Promise<T>;
1812
2369
  /**
1813
- * Synchronize templates from Meta API.
2370
+ * Synchronize templates from the Meta WhatsApp Business API.
2371
+ * This updates the local database with the latest template status and content from Meta.
2372
+ *
2373
+ * @returns Success status of the sync operation.
2374
+ * @example
2375
+ * ```typescript
2376
+ * await erixClient.whatsapp.templates.sync();
2377
+ * ```
1814
2378
  */
1815
2379
  sync<T = any>(): Promise<T>;
1816
2380
  /**
1817
- * Get template details.
2381
+ * Retrieve details of a specific WhatsApp template.
2382
+ *
2383
+ * @param templateIdentifier - The name or ID of the template.
2384
+ * @returns Detailed template object including components and status.
2385
+ * @example
2386
+ * ```typescript
2387
+ * const template = await erixClient.whatsapp.templates.retrieve("welcome_message");
2388
+ * ```
1818
2389
  */
1819
2390
  retrieve<T = any>(templateIdentifier: string): Promise<T>;
1820
2391
  /**
1821
- * Create a new template manually.
2392
+ * Create a new WhatsApp template manually (Draft).
2393
+ *
2394
+ * @param payload - Template configuration (name, category, language, components).
2395
+ * @example
2396
+ * ```typescript
2397
+ * await erixClient.whatsapp.templates.create({
2398
+ * name: "new_promotion",
2399
+ * category: "MARKETING",
2400
+ * language: "en_US",
2401
+ * components: [...]
2402
+ * });
2403
+ * ```
1822
2404
  */
1823
2405
  create<T = any>(payload: any): Promise<T>;
1824
2406
  /**
1825
- * Update an existing template.
2407
+ * Update an existing WhatsApp template.
2408
+ *
2409
+ * @param templateId - The unique ID of the template.
2410
+ * @param payload - Updated template configuration.
1826
2411
  */
1827
2412
  update<T = any>(templateId: string, payload: any): Promise<T>;
1828
2413
  /**
1829
- * Delete a template.
2414
+ * Delete a WhatsApp template from both the local database and Meta (if specified).
2415
+ *
2416
+ * @param templateName - The name of the template to delete.
2417
+ * @param force - If true, attempts to delete from Meta API as well.
2418
+ * @example
2419
+ * ```typescript
2420
+ * await erixClient.whatsapp.templates.deleteTemplate("old_template", true);
2421
+ * ```
1830
2422
  */
1831
2423
  deleteTemplate<T = any>(templateName: string, force?: boolean): Promise<T>;
1832
2424
  /**
1833
- * List curated mapping config options.
2425
+ * List available configuration options for variable mapping.
2426
+ *
2427
+ * @example
2428
+ * ```typescript
2429
+ * const config = await erixClient.whatsapp.templates.mappingConfig();
2430
+ * ```
1834
2431
  */
1835
2432
  mappingConfig<T = any>(): Promise<T>;
1836
2433
  /**
1837
- * List CRM collections for variable mapping.
2434
+ * List CRM collections available for variable mapping (Leads, Deals, etc.).
1838
2435
  */
1839
2436
  collections<T = any>(): Promise<T>;
1840
2437
  /**
1841
- * List CRM fields for a collection.
2438
+ * List fields for a specific CRM collection to be used in mapping.
2439
+ *
2440
+ * @param collectionName - The name of the CRM collection.
1842
2441
  */
1843
2442
  collectionFields<T = any>(collectionName: string): Promise<T>;
1844
2443
  /**
1845
- * Update variable mappings for a template.
2444
+ * Update variable mappings for a template to automate personalization.
2445
+ *
2446
+ * @param templateName - Name of the template.
2447
+ * @param payload - Mapping definitions.
1846
2448
  */
1847
2449
  updateMapping<T = any>(templateName: string, payload: TemplateMapping): Promise<T>;
1848
2450
  /**
1849
- * Validate mapping readiness.
2451
+ * Validate if a template is ready for automated sending based on its mappings.
1850
2452
  */
1851
2453
  validate<T = any>(templateName: string): Promise<T>;
1852
2454
  /**
1853
- * Preview a template resolution.
2455
+ * Preview a template resolution with sample data.
2456
+ *
2457
+ * @param templateName - Name of the template.
2458
+ * @param context - Lead data or variable overrides for preview.
2459
+ * @example
2460
+ * ```typescript
2461
+ * const preview = await erixClient.whatsapp.templates.preview("welcome", {
2462
+ * lead: { firstName: "Alice" }
2463
+ * });
2464
+ * ```
1854
2465
  */
1855
2466
  preview<T = any>(templateName: string, context: {
1856
2467
  lead?: any;
1857
2468
  vars?: any;
1858
2469
  }): Promise<T>;
1859
2470
  /**
1860
- * Check automation usage of a template.
2471
+ * Check which automations or sequences are currently using this template.
1861
2472
  */
1862
2473
  checkUsage<T = any>(templateName: string): Promise<T>;
1863
2474
  }