@helmdesk/sdk 0.4.0 → 0.4.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.
Files changed (2) hide show
  1. package/README.md +28 -1
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -97,6 +97,33 @@ const result = await helmdesk.emails.send({
97
97
  });
98
98
  ```
99
99
 
100
+ **Send a batch of emails**
101
+
102
+ Send up to 100 transactional emails in a single request. Each item has its own
103
+ template, recipient, variables, and optional `idempotencyKey`, and is delivered
104
+ independently — a failed item is reported in its `results` slot (with an `error`)
105
+ without failing the rest. Requires the **Pro plan or higher**.
106
+
107
+ ```ts
108
+ const { total, sent, blocked, failed, results } = await helmdesk.emails.sendBatch({
109
+ emails: [
110
+ {
111
+ templateKey: "welcome",
112
+ to: { email: "jane@example.com", name: "Jane" },
113
+ variables: { activationUrl: "https://app.example.com/activate?token=abc" },
114
+ },
115
+ {
116
+ templateKey: "welcome",
117
+ to: { email: "sam@example.com" },
118
+ variables: { activationUrl: "https://app.example.com/activate?token=def" },
119
+ idempotencyKey: "welcome-sam-2026",
120
+ },
121
+ ],
122
+ });
123
+
124
+ // Inspect each recipient's outcome: results[i].error, results[i].blocked, results[i].id
125
+ ```
126
+
100
127
  **Preview an email**
101
128
 
102
129
  ```ts
@@ -146,7 +173,7 @@ try {
146
173
 
147
174
  ## Idempotency
148
175
 
149
- The `emails.send()` method accepts an optional `idempotencyKey` to safely retry email sends without duplicates. If a request with the same key has already been processed, the API returns the original result.
176
+ The `emails.send()` method accepts an optional `idempotencyKey` to safely retry email sends without duplicates. If a request with the same key has already been processed, the API returns the original result. In `emails.sendBatch()`, the key is set per item (a batch has many recipients).
150
177
 
151
178
  ```ts
152
179
  await helmdesk.emails.send(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helmdesk/sdk",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Official Node.js SDK for the Helmdesk API",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",