retransmit.dev 0.1.1 → 0.1.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.
Files changed (2) hide show
  1. package/README.md +48 -5
  2. package/package.json +7 -4
package/README.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # retransmit.dev
2
2
 
3
- Node.js SDK for the [Retransmit](https://retransmit.dev) email API. Zero dependencies, works on Node 18+ and edge runtimes with `fetch`.
3
+ Node.js SDK for the [Retransmit](https://retransmit.dev) messaging API. Send email and SMS through one typed client; WhatsApp support is coming soon. Zero dependencies, works on Node 18+ and edge runtimes with `fetch`.
4
+
5
+ | Channel | SDK namespace | Availability |
6
+ | --- | --- | --- |
7
+ | Email | `retransmit.emails` | Available |
8
+ | SMS | `retransmit.sms` | Available |
9
+ | WhatsApp | `retransmit.whatsapp` | Coming soon; not included in the current release |
4
10
 
5
11
  ## Install
6
12
 
@@ -10,7 +16,7 @@ npm install retransmit.dev
10
16
  pnpm add retransmit.dev
11
17
  ```
12
18
 
13
- ## Usage
19
+ ## Create a client
14
20
 
15
21
  Grab an API key from your Retransmit dashboard, then:
16
22
 
@@ -19,7 +25,11 @@ import { Retransmit } from "retransmit.dev";
19
25
 
20
26
  const retransmit = new Retransmit("rt_xxxxxxxxxxxx");
21
27
  // or set RETRANSMIT_API_KEY and call `new Retransmit()`
28
+ ```
22
29
 
30
+ ## Email
31
+
32
+ ```ts
23
33
  const { data, error } = await retransmit.emails.send({
24
34
  from: "Acme <hello@yourdomain.com>",
25
35
  to: "user@example.com",
@@ -41,7 +51,33 @@ const { data } = await retransmit.emails.get("em_xxxxxxxxxxxx");
41
51
  console.log(data?.status); // "delivered"
42
52
  ```
43
53
 
44
- ### Batches
54
+ ## SMS
55
+
56
+ Use international E.164 phone numbers. A single request can contain up to 50
57
+ recipients, all in the same country.
58
+
59
+ ```ts
60
+ const { data, error } = await retransmit.sms.send({
61
+ from: "Acme",
62
+ to: "+237670000000",
63
+ text: "Your verification code is 482913",
64
+ });
65
+
66
+ if (error) {
67
+ console.error(error.code, error.message);
68
+ } else {
69
+ console.log(data.id, data.country, data.segments);
70
+ }
71
+ ```
72
+
73
+ SMS messages are also asynchronous:
74
+
75
+ ```ts
76
+ const { data } = await retransmit.sms.get("sms_xxxxxxxxxxxx");
77
+ console.log(data?.status); // "sent" | "delivered" | "undelivered" | ...
78
+ ```
79
+
80
+ ## Email batches
45
81
 
46
82
  Send up to 10,000 emails in one request:
47
83
 
@@ -55,14 +91,21 @@ const { data: progress } = await retransmit.batch.get(batch!.id);
55
91
  console.log(progress?.processed, "/", progress?.total, progress?.counts);
56
92
  ```
57
93
 
94
+ ## WhatsApp
95
+
96
+ WhatsApp is the next planned channel. The intended SDK namespace is
97
+ `retransmit.whatsapp`, but it is deliberately not exported yet because the
98
+ production endpoint and request types are still being finalized. This keeps
99
+ the current SDK honest while reserving a consistent channel-based API shape.
100
+
58
101
  ## Error handling
59
102
 
60
103
  Methods never throw on API errors — they return `{ data, error }`:
61
104
 
62
105
  ```ts
63
- const { data, error } = await retransmit.emails.send(/* ... */);
106
+ const { data, error } = await retransmit.sms.send(/* ... */);
64
107
  if (error) {
65
- // error.code: "validation_error" | "domain_not_verified" | "unauthorized" | ...
108
+ // error.code: "validation_error" | "no_route" | "unauthorized" | ...
66
109
  }
67
110
  ```
68
111
 
package/package.json CHANGED
@@ -1,17 +1,20 @@
1
1
  {
2
2
  "name": "retransmit.dev",
3
- "version": "0.1.1",
4
- "description": "Node.js SDK for the Retransmit email API",
3
+ "version": "0.1.2",
4
+ "description": "Node.js SDK for the Retransmit email and SMS APIs",
5
5
  "keywords": [
6
6
  "email",
7
+ "sms",
8
+ "messaging-api",
7
9
  "retransmit",
8
10
  "ses",
9
- "transactional-email"
11
+ "transactional-email",
12
+ "transactional-sms"
10
13
  ],
11
14
  "homepage": "https://docs.retransmit.dev",
12
15
  "repository": {
13
16
  "type": "git",
14
- "url": "git+https://github.com/jpainam/retransmit.git",
17
+ "url": "git+https://github.com/retransmit-dev/retransmit.git",
15
18
  "directory": "packages/sdk"
16
19
  },
17
20
  "license": "MIT",