@zindua/sdk 1.2.1 → 1.2.2
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 +39 -13
- package/dist/client.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,17 +2,50 @@
|
|
|
2
2
|
|
|
3
3
|
Official **server-side** SDK for [Zindua](https://zindua.run): one API for transactional **email** and **WhatsApp** (`POST /api/v1/send`).
|
|
4
4
|
|
|
5
|
-
**npm:** [https://www.npmjs.com/package/@zindua/sdk](https://www.npmjs.com/package/@zindua/sdk) (this URL does not change when we ship new versions)
|
|
6
|
-
|
|
7
5
|
| Resource | Link |
|
|
8
6
|
|----------|------|
|
|
9
|
-
|
|
|
10
|
-
| Website | [zindua.run](https://zindua.run) |
|
|
11
|
-
| Developer documentation | [zindua.run/developers](https://zindua.run/developers) |
|
|
7
|
+
| Website & docs | [zindua.run/developers](https://zindua.run/developers) |
|
|
12
8
|
| HTTP / cURL (no SDK) | [zindua.run/developers#http](https://zindua.run/developers#http) |
|
|
13
|
-
|
|
|
9
|
+
| Pricing & plans | [zindua.run/pricing](https://zindua.run/pricing) |
|
|
14
10
|
| Dashboard | [zindua.run/login](https://zindua.run/login) |
|
|
15
11
|
|
|
12
|
+
Install: `npm install @zindua/sdk`
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Templates and languages
|
|
17
|
+
|
|
18
|
+
Create templates in the **dashboard** (one **slug** per template, e.g. `welcome`, `otp-verification`). Each template can include **email HTML** and **WhatsApp text** for the same slug.
|
|
19
|
+
|
|
20
|
+
Send in a locale with the `lang` field (ISO code: `fr`, `en`, `sw`, …). If you omit `lang`, Zindua uses your project default.
|
|
21
|
+
|
|
22
|
+
| Plan | Templates per project | Languages per template (email + WhatsApp) |
|
|
23
|
+
|------|----------------------|-------------------------------------------|
|
|
24
|
+
| **Free** | 5 | 3 |
|
|
25
|
+
| **Pro** | 50 | 10 |
|
|
26
|
+
| **Team** | 1000 | 100 |
|
|
27
|
+
|
|
28
|
+
On **Free**, the **email API** (`channel: "email"`) is for dashboard/testing; production email via API needs **Pro** or **Team**. **WhatsApp OTP** works on Free (quota applies). See [pricing](https://zindua.run/pricing) for quotas.
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
// French version of the same template slug
|
|
32
|
+
await zindua.send({
|
|
33
|
+
to: "user@example.com",
|
|
34
|
+
template: "welcome",
|
|
35
|
+
lang: "fr",
|
|
36
|
+
variables: { name: "Alex" },
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// WhatsApp: same slug, different channel + E.164 phone
|
|
40
|
+
await zindua.send({
|
|
41
|
+
to: "+243812345678",
|
|
42
|
+
channel: "whatsapp",
|
|
43
|
+
template: "otp-verification",
|
|
44
|
+
lang: "fr",
|
|
45
|
+
variables: { code: "4592", app: "MonApp" },
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
16
49
|
---
|
|
17
50
|
|
|
18
51
|
## Requirements
|
|
@@ -202,13 +235,6 @@ Full reference: [HTTP / cURL](https://zindua.run/developers#http).
|
|
|
202
235
|
|
|
203
236
|
---
|
|
204
237
|
|
|
205
|
-
## Releases and versioning
|
|
206
|
-
|
|
207
|
-
- The registry page [npmjs.com/package/@zindua/sdk](https://www.npmjs.com/package/@zindua/sdk) is **permanent**.
|
|
208
|
-
- Each release only updates the **version** (`1.2.0`, `1.2.1`, `1.3.0`, …) using [semver](https://semver.org/).
|
|
209
|
-
- Consumers pin in `package.json`: `"@zindua/sdk": "^1.2.0"`, or run `npm update @zindua/sdk` for the latest compatible version.
|
|
210
|
-
- Maintainers: bump `version` in `package.json`, sync `SDK_VERSION` in `src/client.ts`, then `npm publish --access public` from this folder (see `PUBLISHING.md`).
|
|
211
|
-
|
|
212
238
|
## Local development (monorepo)
|
|
213
239
|
|
|
214
240
|
```bash
|
package/dist/client.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Zindua = void 0;
|
|
4
4
|
const errors_1 = require("./errors");
|
|
5
5
|
const validate_1 = require("./validate");
|
|
6
|
-
const SDK_VERSION = "1.2.
|
|
6
|
+
const SDK_VERSION = "1.2.2";
|
|
7
7
|
const USER_AGENT = `Zindua-JS/${SDK_VERSION}`;
|
|
8
8
|
function buildPayload(options, channel) {
|
|
9
9
|
const to = (0, validate_1.validateRecipient)(options.to, channel);
|