@ecodrix/erix-api 1.0.7 → 1.0.9
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 +3 -3
- package/dist/index.d.ts +55 -13
- package/dist/ts/browser/index.global.js +9 -9
- 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 +55 -13
- package/dist/ts/esm/index.d.ts +55 -13
- package/dist/ts/esm/index.js +1 -1
- package/dist/ts/esm/index.js.map +1 -1
- package/package.json +4 -2
- package/src/resources/crm/activities.ts +10 -9
- package/src/resources/crm/analytics.ts +12 -11
- package/src/resources/crm/automationDashboard.ts +4 -3
- package/src/resources/crm/automations.ts +20 -18
- package/src/resources/crm/leads.ts +93 -23
- package/src/resources/crm/payments.ts +2 -1
- package/src/resources/crm/pipelines.ts +20 -20
- package/src/resources/crm/scoring.ts +4 -3
- package/src/resources/crm/sequences.ts +4 -3
- package/src/resources/queue.ts +4 -4
- package/src/resources/whatsapp/index.ts +2 -2
- package/src/resources/whatsapp/messages.ts +14 -2
- package/src/resources/whatsapp/templates.ts +13 -13
- package/dist/index.d.cts +0 -1979
|
@@ -14,73 +14,73 @@ export interface PipelineStageParams {
|
|
|
14
14
|
|
|
15
15
|
export class Pipelines extends APIResource {
|
|
16
16
|
/**
|
|
17
|
-
* List all pipelines
|
|
17
|
+
* List all pipelines and their stages.
|
|
18
18
|
*/
|
|
19
|
-
async list<T = any>(
|
|
20
|
-
return this.get<T>("/api/
|
|
19
|
+
async list<T = any>() {
|
|
20
|
+
return this.get<T>("/api/crm/pipelines");
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* Create a new pipeline.
|
|
25
25
|
*/
|
|
26
|
-
async create<T = any>(
|
|
27
|
-
return this.post<T>("/api/
|
|
26
|
+
async create<T = any>(payload: { name: string; stages: string[] }) {
|
|
27
|
+
return this.post<T>("/api/crm/pipelines", payload);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
|
-
* Retrieve a single pipeline.
|
|
31
|
+
* Retrieve a single pipeline by ID.
|
|
32
32
|
*/
|
|
33
33
|
async retrieve<T = any>(pipelineId: string) {
|
|
34
|
-
return this.get<T>(`/api/
|
|
34
|
+
return this.get<T>(`/api/crm/pipelines/${pipelineId}`);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
|
-
* Update
|
|
38
|
+
* Update an existing pipeline.
|
|
39
39
|
*/
|
|
40
|
-
async update<T = any>(pipelineId: string,
|
|
41
|
-
return this.patch<T>(`/api/
|
|
40
|
+
async update<T = any>(pipelineId: string, payload: Partial<{ name: string; stages: string[] }>) {
|
|
41
|
+
return this.patch<T>(`/api/crm/pipelines/${pipelineId}`, payload as any);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
* Set pipeline as the tenant's default.
|
|
46
46
|
*/
|
|
47
47
|
async setDefault<T = any>(pipelineId: string) {
|
|
48
|
-
return this.
|
|
48
|
+
return this.patch<T>(`/api/crm/pipelines/${pipelineId}/default`, {});
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* Duplicate a pipeline with a new name.
|
|
53
53
|
*/
|
|
54
54
|
async duplicate<T = any>(pipelineId: string, newName: string) {
|
|
55
|
-
return this.post<T>(`/api/
|
|
55
|
+
return this.post<T>(`/api/crm/pipelines/${pipelineId}/duplicate`, { newName });
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
59
|
* Archive a pipeline.
|
|
60
60
|
*/
|
|
61
61
|
async archive<T = any>(pipelineId: string) {
|
|
62
|
-
return this.
|
|
62
|
+
return this.patch<T>(`/api/crm/pipelines/${pipelineId}/archive`, {});
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
66
|
* Delete a pipeline permanently.
|
|
67
67
|
*/
|
|
68
68
|
async delete(pipelineId: string) {
|
|
69
|
-
return this.deleteRequest(`/api/
|
|
69
|
+
return this.deleteRequest(`/api/crm/pipelines/${pipelineId}`);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* Retrieve a Kanban-style board representation of the pipeline with leads nested.
|
|
74
74
|
*/
|
|
75
75
|
async board<T = any>(pipelineId: string) {
|
|
76
|
-
return this.get<T>(`/api/
|
|
76
|
+
return this.get<T>(`/api/crm/pipelines/${pipelineId}/board`);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
/**
|
|
80
80
|
* Retrieve a revenue forecast based on stage probabilities for a pipeline.
|
|
81
81
|
*/
|
|
82
82
|
async forecast<T = any>(pipelineId: string) {
|
|
83
|
-
return this.get<T>(`/api/
|
|
83
|
+
return this.get<T>(`/api/crm/pipelines/${pipelineId}/forecast`);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
// --- Stage Management ---
|
|
@@ -89,14 +89,14 @@ export class Pipelines extends APIResource {
|
|
|
89
89
|
* Add a new stage to the pipeline.
|
|
90
90
|
*/
|
|
91
91
|
async addStage<T = any>(pipelineId: string, params: PipelineStageParams) {
|
|
92
|
-
return this.post<T>(`/api/
|
|
92
|
+
return this.post<T>(`/api/crm/pipelines/${pipelineId}/stages`, params);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
/**
|
|
96
96
|
* Change the order of stages inside the pipeline.
|
|
97
97
|
*/
|
|
98
98
|
async reorderStages<T = any>(pipelineId: string, orderArray: string[]) {
|
|
99
|
-
return this.
|
|
99
|
+
return this.patch<T>(`/api/crm/pipelines/${pipelineId}/stages/reorder`, {
|
|
100
100
|
order: orderArray,
|
|
101
101
|
});
|
|
102
102
|
}
|
|
@@ -105,14 +105,14 @@ export class Pipelines extends APIResource {
|
|
|
105
105
|
* Update a specific stage.
|
|
106
106
|
*/
|
|
107
107
|
async updateStage<T = any>(stageId: string, params: Partial<PipelineStageParams>) {
|
|
108
|
-
return this.patch<T>(`/api/
|
|
108
|
+
return this.patch<T>(`/api/crm/stages/${stageId}`, params);
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
/**
|
|
112
112
|
* Delete a stage. Optionally provide a fallback stageId to move active leads to.
|
|
113
113
|
*/
|
|
114
114
|
async deleteStage(stageId: string, moveLeadsToStageId?: string) {
|
|
115
|
-
return this.deleteRequest(`/api/
|
|
115
|
+
return this.deleteRequest(`/api/crm/stages/${stageId}`, {
|
|
116
116
|
data: moveLeadsToStageId ? { moveLeadsToStageId } : undefined,
|
|
117
117
|
});
|
|
118
118
|
}
|
|
@@ -14,20 +14,21 @@ export class Scoring extends APIResource {
|
|
|
14
14
|
* Retrieve the tenant's global lead scoring configuration.
|
|
15
15
|
*/
|
|
16
16
|
async getConfig<T = any>() {
|
|
17
|
-
return this.get<T>("/api/
|
|
17
|
+
return this.get<T>("/api/crm/scoring");
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Update scoring configuration.
|
|
22
22
|
*/
|
|
23
23
|
async updateConfig<T = any>(payload: Partial<ScoringConfig>) {
|
|
24
|
-
return this.patch<T>("/api/
|
|
24
|
+
return this.patch<T>("/api/crm/scoring", payload as any);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* Force recalculate the score for a specific lead.
|
|
29
29
|
*/
|
|
30
30
|
async recalculate<T = any>(leadId: string) {
|
|
31
|
-
return this.post<T>(`/api/
|
|
31
|
+
return this.post<T>(`/api/crm/scoring/${leadId}/recalculate`, {});
|
|
32
32
|
}
|
|
33
|
+
|
|
33
34
|
}
|
|
@@ -9,20 +9,21 @@ export class Sequences extends APIResource {
|
|
|
9
9
|
ruleId: string;
|
|
10
10
|
variables?: Record<string, any>;
|
|
11
11
|
}) {
|
|
12
|
-
return this.post<T>("/api/
|
|
12
|
+
return this.post<T>("/api/crm/sequences/enroll", payload);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Unenroll a lead from a running sequence.
|
|
17
17
|
*/
|
|
18
18
|
async unenroll<T = any>(enrollmentId: string) {
|
|
19
|
-
return this.deleteRequest
|
|
19
|
+
return this.deleteRequest(`/api/crm/sequences/unenroll/${enrollmentId}`);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* List active sequence enrollments for a specific lead.
|
|
24
24
|
*/
|
|
25
25
|
async listForLead<T = any>(leadId: string) {
|
|
26
|
-
return this.get<T>(`/api/
|
|
26
|
+
return this.get<T>(`/api/crm/sequences/lead/${leadId}`);
|
|
27
27
|
}
|
|
28
|
+
|
|
28
29
|
}
|
package/src/resources/queue.ts
CHANGED
|
@@ -13,27 +13,27 @@ export class Queue extends APIResource {
|
|
|
13
13
|
* List all failed jobs.
|
|
14
14
|
*/
|
|
15
15
|
async listFailed<T = any>() {
|
|
16
|
-
return this.get<T>("/api/saas/queue/failed");
|
|
16
|
+
return this.get<T>("/api/saas/admin/queue/failed");
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Get queue health statistics.
|
|
21
21
|
*/
|
|
22
22
|
async getStats<T = JobStats>() {
|
|
23
|
-
return this.get<T>("/api/saas/queue/stats");
|
|
23
|
+
return this.get<T>("/api/saas/admin/queue/stats");
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Retry a failed job.
|
|
28
28
|
*/
|
|
29
29
|
async retryJob<T = any>(jobId: string) {
|
|
30
|
-
return this.post<T>(`/api/saas/queue/${jobId}/retry`, {});
|
|
30
|
+
return this.post<T>(`/api/saas/admin/queue/${jobId}/retry`, {});
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* Remove a job from the queue.
|
|
35
35
|
*/
|
|
36
36
|
async deleteJob<T = any>(jobId: string) {
|
|
37
|
-
return this.deleteRequest<T>(`/api/saas/queue/${jobId}`);
|
|
37
|
+
return this.deleteRequest<T>(`/api/saas/admin/queue/${jobId}`);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -38,7 +38,7 @@ export class WhatsApp extends APIResource {
|
|
|
38
38
|
async upload<T = any>(file: Blob | Buffer | File | any, filename: string) {
|
|
39
39
|
const form = new FormData();
|
|
40
40
|
form.append("file", file, filename);
|
|
41
|
-
return this.post<T>("/api/saas/
|
|
41
|
+
return this.post<T>("/api/saas/chat/upload", form, {
|
|
42
42
|
headers:
|
|
43
43
|
typeof (form as any).getHeaders === "function" ? (form as any).getHeaders() : undefined,
|
|
44
44
|
});
|
|
@@ -62,6 +62,6 @@ export class WhatsApp extends APIResource {
|
|
|
62
62
|
messageId?: string;
|
|
63
63
|
templateName?: string;
|
|
64
64
|
resolvedVariables?: any[];
|
|
65
|
-
}>("/api/saas/whatsapp/send-template", payload);
|
|
65
|
+
}>("/api/saas/marketing/whatsapp/send-template", payload);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -8,7 +8,11 @@ export interface SendMessageParams {
|
|
|
8
8
|
* Recipient's phone number in E.164 format.
|
|
9
9
|
* @example "+919876543210"
|
|
10
10
|
*/
|
|
11
|
-
to
|
|
11
|
+
to?: string;
|
|
12
|
+
/**
|
|
13
|
+
* The unique ID of the conversation. If supplied, `to` is resolved automatically.
|
|
14
|
+
*/
|
|
15
|
+
conversationId?: string;
|
|
12
16
|
/** Plain text body of the message. */
|
|
13
17
|
text?: string;
|
|
14
18
|
/** Public URL of the media asset to send. */
|
|
@@ -31,7 +35,11 @@ export interface SendTemplateParams {
|
|
|
31
35
|
* Recipient's phone number in E.164 format.
|
|
32
36
|
* @example "+919876543210"
|
|
33
37
|
*/
|
|
34
|
-
to
|
|
38
|
+
to?: string;
|
|
39
|
+
/**
|
|
40
|
+
* The unique ID of the conversation.
|
|
41
|
+
*/
|
|
42
|
+
conversationId?: string;
|
|
35
43
|
/** The exact template name as approved in Meta Business Manager. */
|
|
36
44
|
templateName: string;
|
|
37
45
|
/**
|
|
@@ -48,6 +56,10 @@ export interface SendTemplateParams {
|
|
|
48
56
|
mediaUrl?: string;
|
|
49
57
|
/** Media type for the header (e.g. "image", "document"). */
|
|
50
58
|
mediaType?: string;
|
|
59
|
+
/** User ID of the agent sending the message. */
|
|
60
|
+
userId?: string;
|
|
61
|
+
/** Optional filename for media headers. */
|
|
62
|
+
filename?: string;
|
|
51
63
|
}
|
|
52
64
|
|
|
53
65
|
/**
|
|
@@ -10,35 +10,35 @@ export class Templates extends APIResource {
|
|
|
10
10
|
* List all templates from the tenant database.
|
|
11
11
|
*/
|
|
12
12
|
async list<T = any>(params?: { status?: string; mappingStatus?: string; channel?: string }) {
|
|
13
|
-
return this.get<T>("/api/saas/
|
|
13
|
+
return this.get<T>("/api/saas/chat/templates", { params } as any);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Synchronize templates from Meta API.
|
|
18
18
|
*/
|
|
19
19
|
async sync<T = any>() {
|
|
20
|
-
return this.post<T>("/api/saas/
|
|
20
|
+
return this.post<T>("/api/saas/chat/templates/sync", {});
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* Get template details.
|
|
25
25
|
*/
|
|
26
26
|
async retrieve<T = any>(templateIdentifier: string) {
|
|
27
|
-
return this.get<T>(`/api/saas/
|
|
27
|
+
return this.get<T>(`/api/saas/chat/templates/${encodeURIComponent(templateIdentifier)}`);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* Create a new template manually.
|
|
32
32
|
*/
|
|
33
33
|
async create<T = any>(payload: any) {
|
|
34
|
-
return this.post<T>("/api/saas/
|
|
34
|
+
return this.post<T>("/api/saas/chat/templates", payload);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* Update an existing template.
|
|
39
39
|
*/
|
|
40
40
|
async update<T = any>(templateId: string, payload: any) {
|
|
41
|
-
return this.put<T>(`/api/saas/
|
|
41
|
+
return this.put<T>(`/api/saas/chat/templates/${templateId}`, payload);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
/**
|
|
@@ -46,7 +46,7 @@ export class Templates extends APIResource {
|
|
|
46
46
|
*/
|
|
47
47
|
async deleteTemplate<T = any>(templateName: string, force?: boolean) {
|
|
48
48
|
return this.deleteRequest<T>(
|
|
49
|
-
`/api/saas/
|
|
49
|
+
`/api/saas/chat/templates/${encodeURIComponent(templateName)}${force ? "?force=true" : ""}`,
|
|
50
50
|
);
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -54,14 +54,14 @@ export class Templates extends APIResource {
|
|
|
54
54
|
* List curated mapping config options.
|
|
55
55
|
*/
|
|
56
56
|
async mappingConfig<T = any>() {
|
|
57
|
-
return this.get<T>("/api/saas/
|
|
57
|
+
return this.get<T>("/api/saas/chat/templates/mapping/config");
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
61
|
* List CRM collections for variable mapping.
|
|
62
62
|
*/
|
|
63
63
|
async collections<T = any>() {
|
|
64
|
-
return this.get<T>("/api/saas/
|
|
64
|
+
return this.get<T>("/api/saas/chat/templates/collections");
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
/**
|
|
@@ -69,7 +69,7 @@ export class Templates extends APIResource {
|
|
|
69
69
|
*/
|
|
70
70
|
async collectionFields<T = any>(collectionName: string) {
|
|
71
71
|
return this.get<T>(
|
|
72
|
-
`/api/saas/
|
|
72
|
+
`/api/saas/chat/templates/collections/${encodeURIComponent(collectionName)}/fields`,
|
|
73
73
|
);
|
|
74
74
|
}
|
|
75
75
|
|
|
@@ -78,7 +78,7 @@ export class Templates extends APIResource {
|
|
|
78
78
|
*/
|
|
79
79
|
async updateMapping<T = any>(templateName: string, payload: TemplateMapping) {
|
|
80
80
|
return this.put<T>(
|
|
81
|
-
`/api/saas/
|
|
81
|
+
`/api/saas/chat/templates/${encodeURIComponent(templateName)}/mapping`,
|
|
82
82
|
payload,
|
|
83
83
|
);
|
|
84
84
|
}
|
|
@@ -87,7 +87,7 @@ export class Templates extends APIResource {
|
|
|
87
87
|
* Validate mapping readiness.
|
|
88
88
|
*/
|
|
89
89
|
async validate<T = any>(templateName: string) {
|
|
90
|
-
return this.get<T>(`/api/saas/
|
|
90
|
+
return this.get<T>(`/api/saas/chat/templates/${encodeURIComponent(templateName)}/validate`);
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
/**
|
|
@@ -95,7 +95,7 @@ export class Templates extends APIResource {
|
|
|
95
95
|
*/
|
|
96
96
|
async preview<T = any>(templateName: string, context: { lead?: any; vars?: any }) {
|
|
97
97
|
return this.post<T>(
|
|
98
|
-
`/api/saas/
|
|
98
|
+
`/api/saas/chat/templates/${encodeURIComponent(templateName)}/preview`,
|
|
99
99
|
{ context },
|
|
100
100
|
);
|
|
101
101
|
}
|
|
@@ -104,6 +104,6 @@ export class Templates extends APIResource {
|
|
|
104
104
|
* Check automation usage of a template.
|
|
105
105
|
*/
|
|
106
106
|
async checkUsage<T = any>(templateName: string) {
|
|
107
|
-
return this.get<T>(`/api/saas/
|
|
107
|
+
return this.get<T>(`/api/saas/chat/templates/${encodeURIComponent(templateName)}/usage`);
|
|
108
108
|
}
|
|
109
109
|
}
|