@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.
@@ -36,7 +36,15 @@ export interface JobStatus {
36
36
 
37
37
  export class Health extends APIResource {
38
38
  /**
39
- * Global platform health check.
39
+ * Perform a global platform health check.
40
+ * Verify that the API, database, and background workers are operational.
41
+ *
42
+ * @returns System health summary (status, version, uptime).
43
+ * @example
44
+ * ```typescript
45
+ * const health = await erixClient.health.system();
46
+ * console.log(`API Status: ${health.status}`);
47
+ * ```
40
48
  */
41
49
  async system(): Promise<SystemHealth> {
42
50
  const res = await this.get<{ data: SystemHealth }>("/api/saas/health", {
@@ -54,10 +62,22 @@ export class Health extends APIResource {
54
62
  }
55
63
 
56
64
  /**
57
- * Job execution status lookup.
65
+ * Lookup the execution status of a background job.
66
+ *
67
+ * @param jobId - The unique ID of the background job.
68
+ * @returns Job status report (attempts, error trace, completion time).
69
+ * @example
70
+ * ```typescript
71
+ * const status = await erixClient.health.jobStatus("job_123");
72
+ * if (status.status === "completed") {
73
+ * console.log("Job finished successfully!");
74
+ * }
75
+ * ```
58
76
  */
59
77
  async jobStatus(jobId: string): Promise<JobStatus> {
60
- const res = await this.get<{ data: JobStatus }>(`/api/saas/jobs/status/${jobId}`);
78
+ const res = await this.get<{ data: JobStatus }>(
79
+ `/api/saas/jobs/status/${jobId}`,
80
+ );
61
81
  return res.data;
62
82
  }
63
83
  }
@@ -8,7 +8,18 @@ export interface SendCampaignParams {
8
8
 
9
9
  export class Emails extends APIResource {
10
10
  /**
11
- * Dispatch a bulk email campaign.
11
+ * Dispatch a bulk email campaign to a list of recipients.
12
+ *
13
+ * @param params - The campaign details (recipients, subject, html).
14
+ * @returns The dispatch result.
15
+ * @example
16
+ * ```typescript
17
+ * await erixClient.marketing.emails.sendCampaign({
18
+ * recipients: ["user@example.com"],
19
+ * subject: "Special Offer",
20
+ * html: "<p>Check out our deal!</p>"
21
+ * });
22
+ * ```
12
23
  */
13
24
  async sendCampaign<T = any>(params: SendCampaignParams) {
14
25
  return this.post<T>("/api/saas/marketing/emails/campaign", params);
@@ -23,14 +34,33 @@ export class Emails extends APIResource {
23
34
  }
24
35
  export class Campaigns extends APIResource {
25
36
  /**
26
- * List email and SMS marketing campaigns.
37
+ * List all email and SMS marketing campaigns with optional status filtering.
38
+ *
39
+ * @param params - Optional filters (status, limit).
40
+ * @returns Paginated list of campaign objects.
41
+ * @example
42
+ * ```typescript
43
+ * const campaigns = await erixClient.marketing.campaigns.list({ status: "sent" });
44
+ * ```
27
45
  */
28
46
  async list<T = any>(params?: { status?: string; limit?: number }) {
29
47
  return this.get<T>("/api/saas/marketing/campaigns", { params } as any);
30
48
  }
31
49
 
32
50
  /**
33
- * Create a new campaign.
51
+ * Create a new marketing campaign (Email or SMS).
52
+ *
53
+ * @param payload - Campaign details (name, type, content).
54
+ * @returns The created campaign record.
55
+ * @example
56
+ * ```typescript
57
+ * await erixClient.marketing.campaigns.create({
58
+ * name: "Spring Sale",
59
+ * type: "email",
60
+ * subject: "Our Spring Sale is Here!",
61
+ * html: "<h1>BIG DEALS!</h1>"
62
+ * });
63
+ * ```
34
64
  */
35
65
  async create<T = any>(payload: {
36
66
  name: string;
@@ -44,7 +74,13 @@ export class Campaigns extends APIResource {
44
74
  }
45
75
 
46
76
  /**
47
- * Retrieve campaign details.
77
+ * Retrieve full details for a specific marketing campaign.
78
+ *
79
+ * @param campaignId - The unique ID of the campaign.
80
+ * @example
81
+ * ```typescript
82
+ * const campaign = await erixClient.marketing.campaigns.retrieve("camp_123");
83
+ * ```
48
84
  */
49
85
  async retrieve<T = any>(campaignId: string) {
50
86
  return this.get<T>(`/api/saas/marketing/campaigns/${campaignId}`);
@@ -65,14 +101,39 @@ export class Campaigns extends APIResource {
65
101
  }
66
102
 
67
103
  /**
68
- * Send or schedule a campaign.
104
+ * Send a campaign immediately or schedule it for a later date.
105
+ *
106
+ * @param campaignId - The ID of the campaign to dispatch.
107
+ * @param payload - Optional scheduling information (ISO timestamp).
108
+ * @example
109
+ * ```typescript
110
+ * // Send immediately
111
+ * await erixClient.marketing.campaigns.send("camp_123");
112
+ *
113
+ * // Schedule for tomorrow
114
+ * await erixClient.marketing.campaigns.send("camp_123", {
115
+ * scheduledAt: "2026-04-10T09:00:00Z"
116
+ * });
117
+ * ```
69
118
  */
70
119
  async send<T = any>(campaignId: string, payload?: { scheduledAt?: string }) {
71
- return this.post<T>(`/api/saas/marketing/campaigns/${campaignId}/send`, payload || {});
120
+ return this.post<T>(
121
+ `/api/saas/marketing/campaigns/${campaignId}/send`,
122
+ payload || {},
123
+ );
72
124
  }
73
125
 
74
126
  /**
75
- * Get campaign stats (opens, clicks, bounces).
127
+ * Get detailed delivery and engagement statistics for a campaign.
128
+ * Includes opens, clicks, bounces, and delivery failures.
129
+ *
130
+ * @param campaignId - The ID of the campaign.
131
+ * @returns Stats summary object.
132
+ * @example
133
+ * ```typescript
134
+ * const report = await erixClient.marketing.campaigns.stats("camp_123");
135
+ * console.log(`Open Rate: ${report.openRate}%`);
136
+ * ```
76
137
  */
77
138
  async stats<T = any>(campaignId: string) {
78
139
  return this.get<T>(`/api/saas/marketing/campaigns/${campaignId}/stats`);
@@ -83,8 +144,18 @@ export class WhatsAppMarketing extends APIResource {
83
144
  /**
84
145
  * Dispatch a template-based WhatsApp message with CRM-integrated variable resolution.
85
146
  *
86
- * Unlike direct WhatsApp sending, this endpoint automatically pulls data from the CRM
147
+ * Unlike direct WhatsApp sending, this endpoint documentation automatically pulls data from the CRM
87
148
  * based on the provided variables mapping.
149
+ *
150
+ * @param params - Template details and recipient phone.
151
+ * @example
152
+ * ```typescript
153
+ * await erixClient.marketing.whatsapp.sendTemplate({
154
+ * phone: "+919876543210",
155
+ * templateName: "order_update",
156
+ * variables: { "1": "Order #123" }
157
+ * });
158
+ * ```
88
159
  */
89
160
  async sendTemplate<T = any>(params: {
90
161
  phone: string;
@@ -125,24 +125,39 @@ export class Notifications extends APIResource {
125
125
  // Backend routes mounted at /api/crm — see crm.router.ts + notification.routes.ts
126
126
 
127
127
  /**
128
- * List unread CRM notifications/alerts for the current tenant.
129
- * Maps to: GET /api/crm/notifications
128
+ * List unread CRM notifications and alerts (e.g., lead assignments, system alerts).
129
+ *
130
+ * @param params - Optional filters (limit, unreadOnly).
131
+ * @returns Paginated list of notification objects.
132
+ * @example
133
+ * ```typescript
134
+ * const alerts = await erixClient.notifications.listAlerts({ unreadOnly: true });
135
+ * ```
130
136
  */
131
137
  async listAlerts<T = any>(params?: { limit?: number; unreadOnly?: boolean }) {
132
138
  return this.get<T>("/api/crm/notifications", { params } as any);
133
139
  }
134
140
 
135
141
  /**
136
- * Dismiss a specific notification alert.
137
- * Maps to: PATCH /api/crm/notifications/:id/dismiss
142
+ * Dismiss/mark a specific notification alert as read.
143
+ *
144
+ * @param notificationId - The unique ID of the notification.
145
+ * @example
146
+ * ```typescript
147
+ * await erixClient.notifications.dismissAlert("alert_123");
148
+ * ```
138
149
  */
139
150
  async dismissAlert<T = any>(notificationId: string) {
140
151
  return this.patch<T>(`/api/crm/notifications/${notificationId}/dismiss`);
141
152
  }
142
153
 
143
154
  /**
144
- * Clear (dismiss) all notifications for the current tenant.
145
- * Maps to: DELETE /api/crm/notifications/clear-all
155
+ * Clear all notifications for the current tenant immediately.
156
+ *
157
+ * @example
158
+ * ```typescript
159
+ * await erixClient.notifications.clearAllAlerts();
160
+ * ```
146
161
  */
147
162
  async clearAllAlerts<T = any>() {
148
163
  return this.deleteRequest<T>("/api/crm/notifications/clear-all");
@@ -150,7 +165,12 @@ export class Notifications extends APIResource {
150
165
 
151
166
  /**
152
167
  * Retry an action from a notification (e.g. failed automation send).
153
- * Maps to: POST /api/crm/notifications/:id/retry
168
+ *
169
+ * @param notificationId - The unique ID of the notification.
170
+ * @example
171
+ * ```typescript
172
+ * await erixClient.notifications.retryAction("alert_123");
173
+ * ```
154
174
  */
155
175
  async retryAction<T = any>(notificationId: string) {
156
176
  return this.post<T>(`/api/crm/notifications/${notificationId}/retry`, {});
@@ -10,21 +10,40 @@ export interface JobStats {
10
10
 
11
11
  export class Queue extends APIResource {
12
12
  /**
13
- * List all failed jobs.
13
+ * List all background jobs that have failed execution.
14
+ *
15
+ * @returns Array of failed job objects.
16
+ * @example
17
+ * ```typescript
18
+ * const failed = await erixClient.queue.listFailed();
19
+ * ```
14
20
  */
15
21
  async listFailed<T = any>() {
16
22
  return this.get<T>("/api/saas/admin/queue/failed");
17
23
  }
18
24
 
19
25
  /**
20
- * Get queue health statistics.
26
+ * Get real-time health statistics for the background job queue (waiting, active, failed).
27
+ *
28
+ * @returns Queue statistics summary.
29
+ * @example
30
+ * ```typescript
31
+ * const stats = await erixClient.queue.getStats();
32
+ * console.log(`Active Jobs: ${stats.active}`);
33
+ * ```
21
34
  */
22
35
  async getStats<T = JobStats>() {
23
36
  return this.get<T>("/api/saas/admin/queue/stats");
24
37
  }
25
38
 
26
39
  /**
27
- * Retry a failed job.
40
+ * Manually retry a failed background job.
41
+ *
42
+ * @param jobId - The unique ID of the failed job.
43
+ * @example
44
+ * ```typescript
45
+ * await erixClient.queue.retryJob("job_123");
46
+ * ```
28
47
  */
29
48
  async retryJob<T = any>(jobId: string) {
30
49
  return this.post<T>(`/api/saas/admin/queue/${jobId}/retry`, {});
@@ -32,6 +51,12 @@ export class Queue extends APIResource {
32
51
 
33
52
  /**
34
53
  * Remove a job from the queue.
54
+ *
55
+ * @param jobId - The unique ID of the job to delete.
56
+ * @example
57
+ * ```typescript
58
+ * await erixClient.queue.deleteJob("job_123");
59
+ * ```
35
60
  */
36
61
  async deleteJob<T = any>(jobId: string) {
37
62
  return this.deleteRequest<T>(`/api/saas/admin/queue/${jobId}`);
@@ -2,7 +2,13 @@ import { APIResource } from "../resource";
2
2
 
3
3
  export class Folders extends APIResource {
4
4
  /**
5
- * Create a new folder.
5
+ * Create a new folder in the tenant's cloud storage.
6
+ *
7
+ * @param name - The name of the folder to create.
8
+ * @example
9
+ * ```typescript
10
+ * await erixClient.storage.folders.create("Invoices");
11
+ * ```
6
12
  */
7
13
  async create<T = any>(name: string) {
8
14
  return this.post<T>("/api/saas/storage/folders", { name });
@@ -18,16 +24,42 @@ export class Folders extends APIResource {
18
24
 
19
25
  export class Files extends APIResource {
20
26
  /**
21
- * List files in a folder.
27
+ * List files within a specific folder.
28
+ *
29
+ * @param folder - The folder name or path.
30
+ * @param params - Optional year/month filters for organized storage.
31
+ * @example
32
+ * ```typescript
33
+ * const files = await erixClient.storage.files.list("Invoices", { year: "2026" });
34
+ * ```
22
35
  */
23
- async list<T = any>(folder: string, params?: { year?: string; month?: string }) {
36
+ async list<T = any>(
37
+ folder: string,
38
+ params?: { year?: string; month?: string },
39
+ ) {
24
40
  return this.get<T>(`/api/saas/storage/files/${folder}`, { params } as any);
25
41
  }
26
42
 
27
43
  /**
28
44
  * Get a presigned upload URL for direct-to-cloud browser uploads.
45
+ * This allows the client to upload files directly to R2/S3 without hitting the backend.
46
+ *
47
+ * @param params - Upload parameters (folder, filename, contentType).
48
+ * @example
49
+ * ```typescript
50
+ * const { data } = await erixClient.storage.files.getUploadUrl({
51
+ * folder: "Invoices",
52
+ * filename: "inv_1.pdf",
53
+ * contentType: "application/pdf"
54
+ * });
55
+ * // Now use data.url with a PUT request
56
+ * ```
29
57
  */
30
- async getUploadUrl<T = any>(params: { folder: string; filename: string; contentType: string }) {
58
+ async getUploadUrl<T = any>(params: {
59
+ folder: string;
60
+ filename: string;
61
+ contentType: string;
62
+ }) {
31
63
  return this.post<T>("/api/saas/storage/upload-url", params);
32
64
  }
33
65
 
@@ -16,16 +16,79 @@ export interface CreateBroadcastParams {
16
16
 
17
17
  export class Broadcasts extends APIResource {
18
18
  /**
19
- * List past and active broadcasts.
19
+ * List past and active WhatsApp broadcast campaigns.
20
+ *
21
+ * @param params - Optional filter parameters (page, limit, status).
22
+ * @returns Paginated list of broadcast records.
23
+ * @example
24
+ * ```typescript
25
+ * const broadcasts = await erixClient.whatsapp.broadcasts.list({ limit: 10 });
26
+ * ```
20
27
  */
21
28
  async list<T = any>(params?: Record<string, any>) {
22
29
  return this.get<T>("/api/saas/chat/broadcasts", { params } as any);
23
30
  }
24
31
 
25
32
  /**
26
- * Create a new broadcast to send a template message to multiple recipients.
33
+ * Retrieve full details and real-time stats for a specific broadcast campaign.
34
+ *
35
+ * @param id - The unique identifier of the broadcast.
36
+ * @returns The broadcast record including sent/failed counts.
37
+ * @example
38
+ * ```typescript
39
+ * const stats = await erixClient.whatsapp.broadcasts.retrieve("bc_123");
40
+ * console.log(`Success Rate: ${(stats.sentCount / stats.totalRecipients) * 100}%`);
41
+ * ```
42
+ */
43
+ async retrieve<T = any>(id: string) {
44
+ return this.get<T>(`/api/saas/chat/broadcasts/${id}`);
45
+ }
46
+
47
+ /**
48
+ * Create a new broadcast campaign to send template messages to multiple recipients.
49
+ *
50
+ * @param params - Broadcast configuration (name, templateName, recipients).
51
+ * @returns The newly created broadcast record.
52
+ * @example
53
+ * ```typescript
54
+ * await erixClient.whatsapp.broadcasts.create({
55
+ * name: "Spring Sale",
56
+ * templateName: "promo_code",
57
+ * recipients: [
58
+ * { phone: "+919876543210", variables: ["SAVE10"] }
59
+ * ]
60
+ * });
61
+ * ```
27
62
  */
28
63
  async create<T = any>(params: CreateBroadcastParams) {
29
64
  return this.post<T>("/api/saas/chat/broadcast", params);
30
65
  }
66
+
67
+ /**
68
+ * Update broadcast metadata, such as its name or administrative status.
69
+ *
70
+ * @param id - The unique ID of the broadcast.
71
+ * @param data - The fields to update (name, status).
72
+ * @example
73
+ * ```typescript
74
+ * await erixClient.whatsapp.broadcasts.update("bc_123", { name: "Revised Spring Sale" });
75
+ * ```
76
+ */
77
+ async update<T = any>(id: string, data: { name?: string; status?: string }) {
78
+ return this.patch<T>(`/api/saas/chat/broadcasts/${id}`, data);
79
+ }
80
+
81
+ /**
82
+ * Delete a broadcast campaign record.
83
+ * Note: This does not cancel messages already in flight but removes the record from the dashboard.
84
+ *
85
+ * @param id - The unique ID of the broadcast.
86
+ * @example
87
+ * ```typescript
88
+ * await erixClient.whatsapp.broadcasts.delete("bc_123");
89
+ * ```
90
+ */
91
+ async delete<T = any>(id: string) {
92
+ return this.deleteRequest<T>(`/api/saas/chat/broadcasts/${id}`);
93
+ }
31
94
  }
@@ -10,6 +10,15 @@ export interface ListParams {
10
10
  export class Conversations extends APIResource {
11
11
  /**
12
12
  * List conversations for the tenant.
13
+ * @deprecated Use `list` method from `ErixClient` instead.
14
+ * @param params - List parameters.
15
+ * @returns List of conversations.
16
+ * @example
17
+ * ```typescript
18
+ * import { ErixClient } from "erix-react";
19
+ * const erixClient = new ErixClient({ apiKey: "YOUR_API_KEY" });
20
+ * const conversations = await erixClient.whatsapp.conversations.list();
21
+ * ```
13
22
  */
14
23
  async list<T = any>(params?: ListParams) {
15
24
  return this.get<T>("/api/saas/chat/conversations", { params } as any);
@@ -19,6 +28,13 @@ export class Conversations extends APIResource {
19
28
  * Create a new conversation explicitly.
20
29
  *
21
30
  * @param params - Conversation details.
31
+ * @example
32
+ * ```typescript
33
+ * const conversation = await erixClient.whatsapp.conversations.create({
34
+ * phone: "+919876543210",
35
+ * name: "John Doe"
36
+ * });
37
+ * ```
22
38
  */
23
39
  async create<T = any>(params: { phone: string; name?: string }) {
24
40
  return this.post<T>("/api/saas/chat/conversations", params);
@@ -26,6 +42,12 @@ export class Conversations extends APIResource {
26
42
 
27
43
  /**
28
44
  * Retrieve details of a specific conversation.
45
+ *
46
+ * @param conversationId - The unique ID of the conversation.
47
+ * @example
48
+ * ```typescript
49
+ * const conversation = await erixClient.whatsapp.conversations.retrieve("conv_123");
50
+ * ```
29
51
  */
30
52
  async retrieve<T = any>(conversationId: string) {
31
53
  return this.get<T>(`/api/saas/chat/conversations/${conversationId}`);
@@ -33,32 +55,72 @@ export class Conversations extends APIResource {
33
55
 
34
56
  /**
35
57
  * Get messages for a specific conversation.
58
+ *
59
+ * @param conversationId - The unique ID of the conversation.
60
+ * @param params - Pagination and filter parameters.
61
+ * @example
62
+ * ```typescript
63
+ * const messages = await erixClient.whatsapp.conversations.messages("conv_123", { limit: 50 });
64
+ * ```
36
65
  */
37
66
  async messages<T = any>(conversationId: string, params?: ListParams) {
38
- return this.get<T>(`/api/saas/chat/conversations/${conversationId}/messages`, {
39
- params,
40
- } as any);
67
+ return this.get<T>(
68
+ `/api/saas/chat/conversations/${conversationId}/messages`,
69
+ {
70
+ params,
71
+ } as any,
72
+ );
41
73
  }
42
74
 
43
75
  /**
44
- * Link a conversation to a lead.
76
+ * Link a conversation to a lead in the CRM.
77
+ *
78
+ * @param conversationId - The unique ID of the conversation.
79
+ * @param leadId - The unique ID of the lead to link.
80
+ * @param leadData - Optional additional lead metadata.
81
+ * @example
82
+ * ```typescript
83
+ * await erixClient.whatsapp.conversations.linkLead("conv_123", "lead_456");
84
+ * ```
45
85
  */
46
- async linkLead<T = any>(conversationId: string, leadId: string, leadData?: any) {
47
- return this.post<T>(`/api/saas/chat/conversations/${conversationId}/link-lead`, {
48
- leadId,
49
- leadData,
50
- });
86
+ async linkLead<T = any>(
87
+ conversationId: string,
88
+ leadId: string,
89
+ leadData?: any,
90
+ ) {
91
+ return this.post<T>(
92
+ `/api/saas/chat/conversations/${conversationId}/link-lead`,
93
+ {
94
+ leadId,
95
+ leadData,
96
+ },
97
+ );
51
98
  }
52
99
 
53
100
  /**
54
101
  * Mark a conversation as read (clear unread count).
102
+ *
103
+ * @param conversationId - The unique ID of the conversation.
104
+ * @example
105
+ * ```typescript
106
+ * await erixClient.whatsapp.conversations.markRead("conv_123");
107
+ * ```
55
108
  */
56
109
  async markRead<T = any>(conversationId: string) {
57
- return this.post<T>(`/api/saas/chat/conversations/${conversationId}/read`, {});
110
+ return this.post<T>(
111
+ `/api/saas/chat/conversations/${conversationId}/read`,
112
+ {},
113
+ );
58
114
  }
59
115
 
60
116
  /**
61
117
  * Delete a conversation.
118
+ *
119
+ * @param conversationId - The unique ID of the conversation.
120
+ * @example
121
+ * ```typescript
122
+ * await erixClient.whatsapp.conversations.delete("conv_123");
123
+ * ```
62
124
  */
63
125
  async delete(conversationId: string) {
64
126
  return this.deleteRequest(`/api/saas/chat/conversations/${conversationId}`);
@@ -66,6 +128,12 @@ export class Conversations extends APIResource {
66
128
 
67
129
  /**
68
130
  * Bulk delete conversations.
131
+ *
132
+ * @param ids - Array of conversation IDs to delete.
133
+ * @example
134
+ * ```typescript
135
+ * await erixClient.whatsapp.conversations.bulkDelete(["conv_1", "conv_2"]);
136
+ * ```
69
137
  */
70
138
  async bulkDelete<T = any>(ids: string[]) {
71
139
  return this.post<T>("/api/saas/chat/conversations/bulk-delete", { ids });
@@ -90,26 +90,26 @@ export class Messages extends APIResource {
90
90
  * Send a free-text or media message to a WhatsApp number.
91
91
  *
92
92
  * For text-only messages, supply `text`. For media, supply `mediaUrl`
93
- * and `mediaType`. Both can be combined.
93
+ * and `mediaType`. Both can be combined in a single message.
94
94
  *
95
- * @param params - Message parameters.
96
- * @returns The created message record.
95
+ * @param params - Message parameters including recipient, text, and media.
96
+ * @returns The created message record from the database.
97
97
  *
98
- * @example Text message
98
+ * @example Send a simple text message
99
99
  * ```typescript
100
- * await ecod.whatsapp.messages.send({
100
+ * await erixClient.whatsapp.messages.send({
101
101
  * to: "+919876543210",
102
- * text: "Hello!",
102
+ * text: "Hello from Ecodrix!",
103
103
  * });
104
104
  * ```
105
105
  *
106
- * @example Media message
106
+ * @example Send an image with a caption
107
107
  * ```typescript
108
- * await ecod.whatsapp.messages.send({
108
+ * await erixClient.whatsapp.messages.send({
109
109
  * to: "+919876543210",
110
- * mediaUrl: "https://cdn.ecodrix.com/invoice.pdf",
111
- * mediaType: "document",
112
- * filename: "invoice.pdf",
110
+ * text: "Check out this flyer",
111
+ * mediaUrl: "https://example.com/flyer.jpg",
112
+ * mediaType: "image",
113
113
  * });
114
114
  * ```
115
115
  */
@@ -120,20 +120,20 @@ export class Messages extends APIResource {
120
120
  /**
121
121
  * Send a pre-approved WhatsApp Business template message.
122
122
  *
123
- * Templates must be approved in Meta Business Manager before use.
124
- * Variable placeholders in the template body are filled left-to-right
125
- * from the `variables` array.
123
+ * Templates must be approved in Meta Business Manager before they can be sent.
124
+ * Variable placeholders (e.g., {{1}}, {{2}}) are replaced with values from the
125
+ * `variables` array in order.
126
126
  *
127
- * @param params - Template message parameters.
127
+ * @param params - Template message configuration (name, language, variables).
128
128
  * @returns The created message record.
129
129
  *
130
130
  * @example
131
131
  * ```typescript
132
- * await ecod.whatsapp.messages.sendTemplate({
132
+ * await erixClient.whatsapp.messages.sendTemplate({
133
133
  * to: "+919876543210",
134
- * templateName: "appointment_reminder",
134
+ * templateName: "welcome_user",
135
135
  * language: "en_US",
136
- * variables: ["Alice", "10 April", "10:00 AM"],
136
+ * variables: ["Alice"], // Replaces {{1}} in template
137
137
  * });
138
138
  * ```
139
139
  */