JavaScript / TypeScript SDK
The official @shopimind/sdk-shopimind SDK is the recommended way to integrate the ShopiMind API from Node.js.
- Node.js ≥ 14 — CommonJS (
require) and ESM / TypeScript (import) .d.tstypes included — autocompletion and type checking ready to use out of the box- Single runtime dependency:
axios - Automatic retry, optional chunking, uniform return format (envelope)
Installation
bash
npm install @shopimind/sdk-shopimind
# yarn add @shopimind/sdk-shopimind
# pnpm add @shopimind/sdk-shopimindDetails and version pinning: see Installation.
Quickstart
javascript
const { SpmClient, SpmCustomers } = require('@shopimind/sdk-shopimind');
// 1. Create a client for API version v1
const client = SpmClient.getClient('v1', process.env.SHOPIMIND_API_KEY);
// 2. Read — paginated list
const page = await SpmCustomers.list(client, { limit: 50 });
console.log(page.data);
// 3. Write — bulk synchronization with automatic chunking
const res = await SpmCustomers.bulkSave(client, customers, { chunk: true });
if (!res.ok) {
console.error('Failed', res.error);
} else {
console.log(`${res.data.sent_count} sent, ${res.data.rejected_count} rejected`);
}In TypeScript / ESM:
typescript
import { SpmClient, SpmCustomers } from '@shopimind/sdk-shopimind';Why the SDK instead of fetch?
Without the SDK (raw fetch) | With the SDK |
|---|---|
| You handle headers, URL, serialization | SpmClient.getClient('v1', key) |
| You write your own retries on 429/5xx | Built-in exponential retry |
| You split your batches by hand | { chunk: true } aligned with API limits |
try/catch everywhere, varied error shapes | Single envelope { ok, statusCode, data, error } |
| No types | Complete .d.ts |
Going further
- Installation — registries, Git, versions
- Usage — reading, writing, nested resources
- Resilience — retry, chunking, helpers
- Resources & methods — the complete list
- TypeScript — types and examples
- Validate a webhook —
SpmRequestValidator - Scope & versions — what the SDK covers