@ecodrix/erix-api 1.0.0 → 1.0.1
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/README.md +32 -25
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -165,10 +165,10 @@ Use this specifically to dispatch high-priority utility templates containing dyn
|
|
|
165
165
|
const { messageId } = await ecod.whatsapp.sendTemplate({
|
|
166
166
|
phone: "+919876543210",
|
|
167
167
|
templateName: "payment_confirmation",
|
|
168
|
-
variables: {
|
|
169
|
-
name: "Dhanesh",
|
|
170
|
-
amount: "₹1,500"
|
|
171
|
-
}
|
|
168
|
+
variables: {
|
|
169
|
+
name: "Dhanesh",
|
|
170
|
+
amount: "₹1,500",
|
|
171
|
+
},
|
|
172
172
|
});
|
|
173
173
|
```
|
|
174
174
|
|
|
@@ -223,7 +223,7 @@ const { data: leads } = await ecod.crm.leads.list({
|
|
|
223
223
|
});
|
|
224
224
|
```
|
|
225
225
|
|
|
226
|
-
|
|
226
|
+
_(See [Enterprise Capabilities](#enterprise-capabilities) for efficient auto-pagination or bulk-creation tricks like `listAutoPaging` and `createMany`)._
|
|
227
227
|
|
|
228
228
|
**Retrieve a Lead by ID**
|
|
229
229
|
|
|
@@ -331,7 +331,7 @@ const { data } = await ecod.storage.upload(file, {
|
|
|
331
331
|
contentType: "image/png"
|
|
332
332
|
});
|
|
333
333
|
|
|
334
|
-
console.log(data.url);
|
|
334
|
+
console.log(data.url);
|
|
335
335
|
// -> https://cdn.ecodrix.com/avatars/dhanesh.png
|
|
336
336
|
```
|
|
337
337
|
|
|
@@ -396,7 +396,7 @@ Register a new entry point that you want to show up in the CRM Automation Builde
|
|
|
396
396
|
await ecod.events.assign({
|
|
397
397
|
name: "cart_abandoned",
|
|
398
398
|
displayName: "Shopping Cart Abandoned",
|
|
399
|
-
pipelineId: "pipeline_123"
|
|
399
|
+
pipelineId: "pipeline_123" /* Auto map leads to this pipeline */,
|
|
400
400
|
});
|
|
401
401
|
```
|
|
402
402
|
|
|
@@ -461,6 +461,7 @@ const { data: callbacks } = await ecod.notifications.listCallbacks({
|
|
|
461
461
|
The SDK is equipped with state-of-the-art native patterns for robust execution, zero-downtime performance, and unparalleled developer experience. All network requests automatically utilize an exponential-backoff retry engine to gracefully handle temporary network errors.
|
|
462
462
|
|
|
463
463
|
### Auto-Paginating Iterators
|
|
464
|
+
|
|
464
465
|
To rapidly ingest records without manually iterating pages, use standard Node.js `for await` loops. The SDK controls memory buffers and page fetching dynamically.
|
|
465
466
|
|
|
466
467
|
```typescript
|
|
@@ -471,6 +472,7 @@ for await (const lead of ecod.crm.leads.listAutoPaging({ status: "won" })) {
|
|
|
471
472
|
```
|
|
472
473
|
|
|
473
474
|
### Bulk Data Chunking
|
|
475
|
+
|
|
474
476
|
Need to insert 5,000 leads at once but worried about network congestion or rate limits? `createMany` automatically chunks arrays into concurrent streams.
|
|
475
477
|
|
|
476
478
|
```typescript
|
|
@@ -480,43 +482,48 @@ console.log(`Successfully ingested ${results.length} leads.`);
|
|
|
480
482
|
```
|
|
481
483
|
|
|
482
484
|
### Idempotency Keys
|
|
485
|
+
|
|
483
486
|
Because the SDK provides an automatic network retry engine (`axios-retry`), temporary blips could duplicate events. Passing an `idempotencyKey` strictly tells the backend: "Only execute this once, even if I accidentally retry the same payload."
|
|
484
487
|
|
|
485
488
|
```typescript
|
|
486
489
|
await ecod.email.sendEmailCampaign(
|
|
487
490
|
{ subject: "Promo", recipients: ["user@example.com"] },
|
|
488
|
-
{ idempotencyKey: "promo_campaign_uuid_123_abc" }
|
|
491
|
+
{ idempotencyKey: "promo_campaign_uuid_123_abc" },
|
|
489
492
|
);
|
|
490
493
|
```
|
|
491
494
|
|
|
492
495
|
### Webhook Signature Verification
|
|
496
|
+
|
|
493
497
|
Verify cryptographic webhook payloads issued by the ECODrIx platform reliably in Node environments, mitigating spoofing attacks seamlessly.
|
|
494
498
|
|
|
495
499
|
```typescript
|
|
496
|
-
app.post(
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
})
|
|
500
|
+
app.post(
|
|
501
|
+
"/api/webhooks",
|
|
502
|
+
express.raw({ type: "application/json" }),
|
|
503
|
+
async (req, res) => {
|
|
504
|
+
try {
|
|
505
|
+
const event = await ecod.webhooks.constructEvent(
|
|
506
|
+
req.body.toString(),
|
|
507
|
+
req.headers["x-ecodrix-signature"],
|
|
508
|
+
"whsec_your_secret_key",
|
|
509
|
+
);
|
|
510
|
+
console.log("Verified event received:", event);
|
|
511
|
+
} catch (err) {
|
|
512
|
+
return res.status(400).send(`Invalid signature: ${err.message}`);
|
|
513
|
+
}
|
|
514
|
+
},
|
|
515
|
+
);
|
|
508
516
|
```
|
|
509
517
|
|
|
510
518
|
### Raw Execution Engine
|
|
519
|
+
|
|
511
520
|
Need to execute an experimental, undocumented, or beta endpoint but still want full authentication mapping, global headers, and intelligent retries?
|
|
512
521
|
|
|
513
522
|
```typescript
|
|
514
523
|
// Bypass strictly typed resources with full network resiliency
|
|
515
|
-
const customData = await ecod.request(
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
{ experimentalFlag: true }
|
|
519
|
-
);
|
|
524
|
+
const customData = await ecod.request("POST", "/api/saas/beta-feature-route", {
|
|
525
|
+
experimentalFlag: true,
|
|
526
|
+
});
|
|
520
527
|
```
|
|
521
528
|
|
|
522
529
|
---
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecodrix/erix-api",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"author": "ECODrIx Team <contact@ecodrix.com>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Official Isomorphic SDK for the ECODrIx platform. Native support for WhatsApp, CRM, Storage, and Meetings across TS, JS, Python, and Java.",
|