@ecodrix/erix-api 1.3.2 → 1.3.4
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 +6 -6
- package/dist/index.d.ts +220 -34
- package/dist/ts/browser/index.global.js +14 -14
- package/dist/ts/browser/index.global.js.map +1 -1
- package/dist/ts/cjs/index.cjs +1 -1
- package/dist/ts/cjs/index.cjs.map +1 -1
- package/dist/ts/cjs/index.d.cts +220 -34
- package/dist/ts/esm/index.d.ts +220 -34
- package/dist/ts/esm/index.js +1 -1
- package/dist/ts/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/ts/cjs/index.d.cts
CHANGED
|
@@ -211,6 +211,12 @@ declare class Analytics extends APIResource {
|
|
|
211
211
|
* Consolidated analytics including CRM overview and WhatsApp messaging metrics.
|
|
212
212
|
*
|
|
213
213
|
* @param params - Time range filters.
|
|
214
|
+
* @returns {Promise<any>} Consolidated analytics object containing CRM overview and WhatsApp messaging metrics.
|
|
215
|
+
* @example
|
|
216
|
+
* ```typescript
|
|
217
|
+
* const stats = await erixClient.crm.analytics.summary({ range: "30d" });
|
|
218
|
+
* console.log(stats.overview.totalLeads);
|
|
219
|
+
* ```
|
|
214
220
|
*/
|
|
215
221
|
summary<T = any>(params?: AnalyticsParams): Promise<T>;
|
|
216
222
|
/**
|
|
@@ -376,6 +382,21 @@ declare class Automations extends APIResource {
|
|
|
376
382
|
* @param payload - Arbitrary data forwarded to the node context.
|
|
377
383
|
*/
|
|
378
384
|
webhookEvent<T = any>(ruleId: string, eventName: string, payload?: any): Promise<T>;
|
|
385
|
+
/**
|
|
386
|
+
* Fire a CRM automation trigger for a given phone number.
|
|
387
|
+
*
|
|
388
|
+
* @param params - Trigger payload (trigger name, phone, variables, etc.)
|
|
389
|
+
*/
|
|
390
|
+
trigger<T = any>(params: {
|
|
391
|
+
trigger: string;
|
|
392
|
+
phone: string;
|
|
393
|
+
email?: string;
|
|
394
|
+
variables?: Record<string, string>;
|
|
395
|
+
createLeadIfMissing?: boolean;
|
|
396
|
+
leadData?: any;
|
|
397
|
+
delayMinutes?: number;
|
|
398
|
+
runAt?: Date | string;
|
|
399
|
+
}): Promise<T>;
|
|
379
400
|
}
|
|
380
401
|
|
|
381
402
|
/**
|
|
@@ -451,18 +472,32 @@ type LeadSource = "website" | "whatsapp" | "direct" | "referral" | string;
|
|
|
451
472
|
* Parameters for creating a new CRM Lead.
|
|
452
473
|
*/
|
|
453
474
|
interface CreateLeadParams {
|
|
454
|
-
/** Lead's
|
|
455
|
-
|
|
475
|
+
/** Lead's full name (alternative to firstName/lastName). */
|
|
476
|
+
name?: string;
|
|
477
|
+
/** Lead's first name. Required for creation if name is not provided. */
|
|
478
|
+
firstName?: string;
|
|
456
479
|
/** Lead's last name. */
|
|
457
480
|
lastName?: string;
|
|
458
481
|
/** Lead's email address. */
|
|
459
482
|
email?: string;
|
|
460
483
|
/** Lead's phone number in E.164 format (e.g. "+919876543210"). */
|
|
461
484
|
phone?: string;
|
|
485
|
+
/**
|
|
486
|
+
* Current status of the lead.
|
|
487
|
+
*/
|
|
488
|
+
status?: LeadStatus;
|
|
489
|
+
/**
|
|
490
|
+
* Estimated value of the lead.
|
|
491
|
+
*/
|
|
492
|
+
value?: number;
|
|
462
493
|
/**
|
|
463
494
|
* Acquisition channel.
|
|
464
495
|
*/
|
|
465
496
|
source?: LeadSource;
|
|
497
|
+
/** Primary message or enquiry from the lead. */
|
|
498
|
+
message?: string;
|
|
499
|
+
/** Internal note about the lead activity. */
|
|
500
|
+
activityNote?: string;
|
|
466
501
|
/** Arbitrary key-value metadata (UTM params, order IDs, etc.). */
|
|
467
502
|
metadata?: Record<string, any>;
|
|
468
503
|
/** Pipeline ID to assign the lead */
|
|
@@ -568,11 +603,19 @@ declare class Leads extends APIResource {
|
|
|
568
603
|
*/
|
|
569
604
|
createMany(leads: CreateLeadParams[], chunkSize?: number): Promise<any[]>;
|
|
570
605
|
/**
|
|
571
|
-
* Bulk upsert (import) leads.
|
|
606
|
+
* Bulk upsert (import) leads. Supports high-volume synchronization.
|
|
572
607
|
*
|
|
573
608
|
* @param leads - Array of leads to import.
|
|
609
|
+
* ---- **Done** ---- API Endpoint
|
|
574
610
|
*/
|
|
575
611
|
import<T = any>(leads: Partial<CreateLeadParams>[]): Promise<T>;
|
|
612
|
+
/**
|
|
613
|
+
* Alias for bulk upserting leads.
|
|
614
|
+
*
|
|
615
|
+
* @param leads - Array of leads to import.
|
|
616
|
+
* ---- **Done** ---- API Endpoint
|
|
617
|
+
*/
|
|
618
|
+
bulkUpsert<T = any>(leads: Partial<CreateLeadParams>[]): Promise<T>;
|
|
576
619
|
/**
|
|
577
620
|
* List CRM leads with optional filtering and pagination.
|
|
578
621
|
*
|
|
@@ -615,8 +658,22 @@ declare class Leads extends APIResource {
|
|
|
615
658
|
* Retrieve a single lead by its phone number.
|
|
616
659
|
*
|
|
617
660
|
* @param phone - Lead's phone number.
|
|
661
|
+
* ---- **Done** ---- API Endpoint
|
|
618
662
|
*/
|
|
619
663
|
retrieveByPhone<T = any>(phone: string): Promise<T>;
|
|
664
|
+
/**
|
|
665
|
+
* Fetches all leads belonging to a specific Kanban column in a pipeline.
|
|
666
|
+
*
|
|
667
|
+
* @param pipelineId - Parent pipeline ID.
|
|
668
|
+
* @param stageId - Target stage ID.
|
|
669
|
+
* @param params - Pagination controls.
|
|
670
|
+
* @returns Paginated result set.
|
|
671
|
+
* ---- **Done** ---- API Endpoint
|
|
672
|
+
*/
|
|
673
|
+
byStage<T = any>(pipelineId: string, stageId: string, params?: {
|
|
674
|
+
page?: number;
|
|
675
|
+
limit?: number;
|
|
676
|
+
}): Promise<T>;
|
|
620
677
|
/**
|
|
621
678
|
* Retrieve a single lead by a reference key and value.
|
|
622
679
|
*
|
|
@@ -712,17 +769,32 @@ declare class Leads extends APIResource {
|
|
|
712
769
|
*/
|
|
713
770
|
deleteNote<T = any>(leadId: string, noteId: string): Promise<unknown>;
|
|
714
771
|
/**
|
|
715
|
-
*
|
|
772
|
+
* Delete a single lead permanently.
|
|
716
773
|
*
|
|
717
|
-
* @param leadId - The ID of the lead to
|
|
774
|
+
* @param leadId - The ID of the lead to delete.
|
|
775
|
+
* ---- **Done** ---- API Endpoint
|
|
718
776
|
*/
|
|
719
777
|
delete(leadId: string): Promise<unknown>;
|
|
720
778
|
/**
|
|
721
779
|
* Bulk archive multiple leads.
|
|
722
780
|
*
|
|
723
781
|
* @param ids - Array of lead IDs to archive.
|
|
782
|
+
* ---- **Done** ---- API Endpoint
|
|
783
|
+
*/
|
|
784
|
+
bulkArchive<T = any>(ids: string[]): Promise<T>;
|
|
785
|
+
/**
|
|
786
|
+
* Bulk delete multiple leads permanently.
|
|
787
|
+
*
|
|
788
|
+
* @param ids - Array of lead IDs to archive.
|
|
789
|
+
* ---- **Done** ---- API Endpoint
|
|
724
790
|
*/
|
|
725
791
|
bulkDelete(ids: string[]): Promise<unknown>;
|
|
792
|
+
/**
|
|
793
|
+
* Archive a single lead.
|
|
794
|
+
*
|
|
795
|
+
* @param leadId - The ID of the lead to archive.
|
|
796
|
+
*/
|
|
797
|
+
archive<T = any>(leadId: string): Promise<T>;
|
|
726
798
|
}
|
|
727
799
|
|
|
728
800
|
declare class Payments extends APIResource {
|
|
@@ -749,15 +821,12 @@ declare class Payments extends APIResource {
|
|
|
749
821
|
}): Promise<T>;
|
|
750
822
|
}
|
|
751
823
|
|
|
752
|
-
interface CreatePipelineParams {
|
|
753
|
-
name: string;
|
|
754
|
-
isDefault?: boolean;
|
|
755
|
-
stages?: any[];
|
|
756
|
-
}
|
|
757
824
|
interface PipelineStageParams {
|
|
758
825
|
name: string;
|
|
759
826
|
color?: string;
|
|
760
827
|
probability?: number;
|
|
828
|
+
isWon?: boolean;
|
|
829
|
+
isLost?: boolean;
|
|
761
830
|
}
|
|
762
831
|
declare class Pipelines extends APIResource {
|
|
763
832
|
/**
|
|
@@ -880,12 +949,23 @@ declare class Pipelines extends APIResource {
|
|
|
880
949
|
}
|
|
881
950
|
|
|
882
951
|
interface ScoringConfig {
|
|
883
|
-
|
|
884
|
-
thresholds: {
|
|
885
|
-
hot: number;
|
|
886
|
-
warm: number;
|
|
887
|
-
};
|
|
952
|
+
/** Scoring rules — each rule adds/subtracts points based on field conditions. */
|
|
888
953
|
rules: any[];
|
|
954
|
+
/**
|
|
955
|
+
* Score threshold above which a lead is considered "hot".
|
|
956
|
+
* @default 70
|
|
957
|
+
*/
|
|
958
|
+
hotThreshold?: number;
|
|
959
|
+
/**
|
|
960
|
+
* Score threshold below which a lead is considered "cold".
|
|
961
|
+
* @default 20
|
|
962
|
+
*/
|
|
963
|
+
coldThreshold?: number;
|
|
964
|
+
/**
|
|
965
|
+
* List of CRM trigger names that cause an automatic score recalculation.
|
|
966
|
+
* @example ["lead_created", "appointment_booked"]
|
|
967
|
+
*/
|
|
968
|
+
recalculateOnTriggers?: string[];
|
|
889
969
|
}
|
|
890
970
|
declare class Scoring extends APIResource {
|
|
891
971
|
/**
|
|
@@ -1079,9 +1159,6 @@ declare class Email extends APIResource {
|
|
|
1079
1159
|
variables?: Record<string, any>;
|
|
1080
1160
|
}): Promise<TemplatePreviewResponse>;
|
|
1081
1161
|
}
|
|
1082
|
-
/** @deprecated Use Email instead */
|
|
1083
|
-
declare class EmailResource extends Email {
|
|
1084
|
-
}
|
|
1085
1162
|
|
|
1086
1163
|
/**
|
|
1087
1164
|
* Event definition representing an entry point capable of triggering automations.
|
|
@@ -1695,9 +1772,6 @@ declare class Media extends APIResource {
|
|
|
1695
1772
|
*/
|
|
1696
1773
|
upload(file: any, options: UploadOptions): Promise<any>;
|
|
1697
1774
|
}
|
|
1698
|
-
/** @deprecated Use Media instead */
|
|
1699
|
-
declare class MediaResource extends Media {
|
|
1700
|
-
}
|
|
1701
1775
|
|
|
1702
1776
|
/**
|
|
1703
1777
|
* Parameters for scheduling a new Google Meet appointment.
|
|
@@ -1709,6 +1783,8 @@ interface CreateMeetingParams {
|
|
|
1709
1783
|
participantName: string;
|
|
1710
1784
|
/** Phone number of the participant in E.164 format. */
|
|
1711
1785
|
participantPhone: string;
|
|
1786
|
+
/** Email addresses of the participants. */
|
|
1787
|
+
participantEmails?: string[];
|
|
1712
1788
|
/**
|
|
1713
1789
|
* Meeting start time.
|
|
1714
1790
|
* @example new Date("2026-04-10T10:00:00.000Z")
|
|
@@ -1719,8 +1795,19 @@ interface CreateMeetingParams {
|
|
|
1719
1795
|
* @example new Date("2026-04-10T10:30:00.000Z")
|
|
1720
1796
|
*/
|
|
1721
1797
|
endTime: Date | string;
|
|
1798
|
+
/** Duration in minutes. */
|
|
1799
|
+
duration?: number;
|
|
1800
|
+
/** Whether the meeting is online (Google Meet) or offline (In-person). */
|
|
1801
|
+
meetingMode?: "online" | "offline";
|
|
1802
|
+
/** Whether this is a free or paid consultation. */
|
|
1803
|
+
type?: "free" | "paid";
|
|
1804
|
+
/** Amount charged for paid consultations. */
|
|
1805
|
+
amount?: number;
|
|
1722
1806
|
/** Arbitrary metadata to attach to the meeting record. */
|
|
1723
|
-
metadata?:
|
|
1807
|
+
metadata?: {
|
|
1808
|
+
refs?: Record<string, string | undefined>;
|
|
1809
|
+
extra?: Record<string, any>;
|
|
1810
|
+
};
|
|
1724
1811
|
}
|
|
1725
1812
|
/**
|
|
1726
1813
|
* Parameters for updating an existing meeting.
|
|
@@ -1730,15 +1817,17 @@ interface UpdateMeetingParams {
|
|
|
1730
1817
|
* Update the meeting status.
|
|
1731
1818
|
* @example "scheduled" | "completed" | "cancelled"
|
|
1732
1819
|
*/
|
|
1733
|
-
status?: string;
|
|
1820
|
+
status?: "scheduled" | "completed" | "cancelled" | string;
|
|
1734
1821
|
/** Update the payment status for paid consultations. */
|
|
1735
|
-
paymentStatus?: string;
|
|
1822
|
+
paymentStatus?: "pending" | "paid" | "na" | string;
|
|
1736
1823
|
/** New start time for rescheduling. */
|
|
1737
1824
|
startTime?: Date | string;
|
|
1738
1825
|
/** New end time for rescheduling. */
|
|
1739
1826
|
endTime?: Date | string;
|
|
1740
1827
|
/** Duration in minutes. */
|
|
1741
1828
|
duration?: number;
|
|
1829
|
+
/** Update metadata. */
|
|
1830
|
+
metadata?: any;
|
|
1742
1831
|
}
|
|
1743
1832
|
/**
|
|
1744
1833
|
* Google Meet appointment scheduling resource.
|
|
@@ -2184,9 +2273,6 @@ declare class RateLimitError extends APIError {
|
|
|
2184
2273
|
constructor(message?: string);
|
|
2185
2274
|
}
|
|
2186
2275
|
|
|
2187
|
-
declare class WebhookSignatureError extends APIError {
|
|
2188
|
-
constructor(message: string);
|
|
2189
|
-
}
|
|
2190
2276
|
/**
|
|
2191
2277
|
* Validates and constructs webhook events sent by the ECODrIx platform.
|
|
2192
2278
|
* Ensures the payload has not been tampered with.
|
|
@@ -3011,13 +3097,111 @@ declare class Cors extends APIResource {
|
|
|
3011
3097
|
delete<T = any>(id: string): Promise<T>;
|
|
3012
3098
|
}
|
|
3013
3099
|
|
|
3100
|
+
interface CheckoutProduct {
|
|
3101
|
+
externalId: string;
|
|
3102
|
+
name: string;
|
|
3103
|
+
price: number;
|
|
3104
|
+
image?: string;
|
|
3105
|
+
}
|
|
3106
|
+
interface CheckoutAmountBreakdown {
|
|
3107
|
+
subtotal: number;
|
|
3108
|
+
discount: number;
|
|
3109
|
+
delivery: number;
|
|
3110
|
+
total: number;
|
|
3111
|
+
}
|
|
3112
|
+
interface CheckoutSession {
|
|
3113
|
+
sessionId: string;
|
|
3114
|
+
product: {
|
|
3115
|
+
name: string;
|
|
3116
|
+
price: number;
|
|
3117
|
+
image?: string;
|
|
3118
|
+
};
|
|
3119
|
+
amounts: CheckoutAmountBreakdown;
|
|
3120
|
+
items: Array<{
|
|
3121
|
+
productId: string;
|
|
3122
|
+
quantity: number;
|
|
3123
|
+
}>;
|
|
3124
|
+
}
|
|
3125
|
+
interface CreateSessionPayload {
|
|
3126
|
+
productId: string;
|
|
3127
|
+
quantity: number;
|
|
3128
|
+
couponCode?: string;
|
|
3129
|
+
}
|
|
3130
|
+
interface ApplyCouponPayload {
|
|
3131
|
+
sessionId: string;
|
|
3132
|
+
couponCode: string;
|
|
3133
|
+
}
|
|
3134
|
+
interface VerifyPayload {
|
|
3135
|
+
sessionId: string;
|
|
3136
|
+
method: "truecaller" | "otp";
|
|
3137
|
+
token?: string;
|
|
3138
|
+
phone?: string;
|
|
3139
|
+
otp?: string;
|
|
3140
|
+
}
|
|
3141
|
+
interface CreateOrderPayload {
|
|
3142
|
+
sessionId: string;
|
|
3143
|
+
customer: {
|
|
3144
|
+
name: string;
|
|
3145
|
+
phone: string;
|
|
3146
|
+
email?: string;
|
|
3147
|
+
address: {
|
|
3148
|
+
line1: string;
|
|
3149
|
+
city: string;
|
|
3150
|
+
state: string;
|
|
3151
|
+
pincode: string;
|
|
3152
|
+
};
|
|
3153
|
+
};
|
|
3154
|
+
paymentProvider: "razorpay" | "cod";
|
|
3155
|
+
}
|
|
3156
|
+
interface CheckoutOrderResponse {
|
|
3157
|
+
order_id: string;
|
|
3158
|
+
payment_order_id?: string;
|
|
3159
|
+
amount?: number;
|
|
3160
|
+
currency?: string;
|
|
3161
|
+
status?: string;
|
|
3162
|
+
message?: string;
|
|
3163
|
+
}
|
|
3164
|
+
|
|
3165
|
+
/**
|
|
3166
|
+
* Resource for managing the ErixCheckout one-click flow.
|
|
3167
|
+
*
|
|
3168
|
+
* This resource handles session creation, coupon application,
|
|
3169
|
+
* identity verification, and final order placement.
|
|
3170
|
+
*/
|
|
3171
|
+
declare class Checkout extends APIResource {
|
|
3172
|
+
/**
|
|
3173
|
+
* Retrieves product information for the checkout modal.
|
|
3174
|
+
* @param productId - External SKU/ID of the product.
|
|
3175
|
+
*/
|
|
3176
|
+
getProduct(productId: string): Promise<CheckoutProduct>;
|
|
3177
|
+
/**
|
|
3178
|
+
* Initializes a new checkout session.
|
|
3179
|
+
*/
|
|
3180
|
+
createSession(payload: CreateSessionPayload): Promise<CheckoutSession>;
|
|
3181
|
+
/**
|
|
3182
|
+
* Applies a discount coupon to an active session.
|
|
3183
|
+
*/
|
|
3184
|
+
applyCoupon(payload: ApplyCouponPayload): Promise<CheckoutSession>;
|
|
3185
|
+
/**
|
|
3186
|
+
* Verifies user identity via Truecaller or OTP.
|
|
3187
|
+
*/
|
|
3188
|
+
verify(payload: VerifyPayload): Promise<{
|
|
3189
|
+
verified: boolean;
|
|
3190
|
+
data?: any;
|
|
3191
|
+
}>;
|
|
3192
|
+
/**
|
|
3193
|
+
* Finalizes the order and initiates payment.
|
|
3194
|
+
*/
|
|
3195
|
+
createOrder(payload: CreateOrderPayload): Promise<CheckoutOrderResponse>;
|
|
3196
|
+
}
|
|
3197
|
+
|
|
3014
3198
|
/**
|
|
3015
|
-
* Configuration options for the
|
|
3199
|
+
* Configuration options for the ECODrIxAPI client.
|
|
3016
3200
|
*
|
|
3017
3201
|
* Minimum required: `apiKey` and `clientCode`.
|
|
3018
3202
|
* The backend URL is managed internally and should not need to be changed.
|
|
3019
3203
|
*/
|
|
3020
|
-
interface
|
|
3204
|
+
interface ECODrIxAPIOptions {
|
|
3021
3205
|
/**
|
|
3022
3206
|
* Your ECODrIx Platform API key.
|
|
3023
3207
|
* Obtain this from the ECODrIx dashboard under Settings → API Keys.
|
|
@@ -3054,9 +3238,9 @@ interface EcodrixOptions {
|
|
|
3054
3238
|
*
|
|
3055
3239
|
* @example
|
|
3056
3240
|
* ```typescript
|
|
3057
|
-
* import {
|
|
3241
|
+
* import { ECODrIxAPI } from "@ecodrix/erix-api";
|
|
3058
3242
|
*
|
|
3059
|
-
* const ecod = new
|
|
3243
|
+
* const ecod = new ECODrIxAPI({
|
|
3060
3244
|
* apiKey: process.env.ECOD_API_KEY!,
|
|
3061
3245
|
* clientCode: "ERIX_CLNT_JHBJHF",
|
|
3062
3246
|
* });
|
|
@@ -3065,7 +3249,7 @@ interface EcodrixOptions {
|
|
|
3065
3249
|
* const lead = await ecod.crm.leads.create({ firstName: "Alice", phone: "+91..." });
|
|
3066
3250
|
* ```
|
|
3067
3251
|
*/
|
|
3068
|
-
declare class
|
|
3252
|
+
declare class ECODrIxAPI {
|
|
3069
3253
|
/**
|
|
3070
3254
|
* @internal Axios HTTP client for making API requests.
|
|
3071
3255
|
*/
|
|
@@ -3114,7 +3298,9 @@ declare class Ecodrix {
|
|
|
3114
3298
|
readonly settings: Settings;
|
|
3115
3299
|
/** Dynamic Cross-Origin Resource Sharing network policies. */
|
|
3116
3300
|
readonly cors: Cors;
|
|
3117
|
-
|
|
3301
|
+
/** ErixCheckout one-click checkout flow management. */
|
|
3302
|
+
readonly checkout: Checkout;
|
|
3303
|
+
constructor(options: ECODrIxAPIOptions);
|
|
3118
3304
|
/**
|
|
3119
3305
|
* Join a specific real-time room (e.g., a conversation or a lead).
|
|
3120
3306
|
*
|
|
@@ -3195,4 +3381,4 @@ declare class Ecodrix {
|
|
|
3195
3381
|
request<T = any>(method: Method, path: string, data?: any, params?: any): Promise<T>;
|
|
3196
3382
|
}
|
|
3197
3383
|
|
|
3198
|
-
export { APIError,
|
|
3384
|
+
export { APIError, type ApplyCouponPayload, AuthenticationError, type CheckoutAmountBreakdown, type CheckoutOrderResponse, type CheckoutProduct, type CheckoutSession, type CreateOrderPayload, type CreateSessionPayload, ECODrIxAPI as ECODrIx, ECODrIxAPI, type ECODrIxAPIOptions, EcodrixError, type FieldManifest, type FieldType, RateLimitError, type ResourceManifest, type VerifyPayload, ECODrIxAPI as default };
|