Skip to content
This repository was archived by the owner on Jun 10, 2026. It is now read-only.

Commit ecae9ab

Browse files
committed
chore: update README
1 parent a000d3f commit ecae9ab

1 file changed

Lines changed: 27 additions & 14 deletions

File tree

README.md

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Rewrite Node SDK
44

5-
[`@rewritetoday/sdk`](https://www.npmjs.com/package/@rewritetoday/sdk), the official Node.js/TypeScript SDK for the Rewrite API.
5+
[`@rewritetoday/sdk`](https://docs.rewritetoday.com/en/sdks/node), the official Node.js/TypeScript SDK for the Rewrite API.
66

77
It wraps authentication, typed REST calls, and resource helpers on top of [`@rewritetoday/rest`](https://www.npmjs.com/package/@rewritetoday/rest) and [`@rewritetoday/types`](https://www.npmjs.com/package/@rewritetoday/types).
88

@@ -20,29 +20,25 @@ bun add @rewritetoday/sdk
2020
npm install @rewritetoday/sdk
2121
# Or
2222
pnpm add @rewritetoday/sdk
23-
# Or
24-
yarn add @rewritetoday/sdk
2523
```
2624

2725
<div align="center">
2826

29-
## Quick Start
27+
## Setup
28+
29+
First, you need to create an API key in the [Rewrite Dashboard](https://dash.rewritetoday.com/api-keys) and use it in the constructor.
3030

3131
</div>
3232

3333
```ts
3434
import { Rewrite } from '@rewritetoday/sdk';
3535

36-
const rewrite = new Rewrite(process.env.REWRITE_API_KEY!);
37-
38-
const { data } = await rewrite.webhooks.get('123456789012345678');
39-
40-
console.log({ data });
36+
const rewrite = new Rewrite(process.env.REWRITE_API_KEY);
4137
```
4238

4339
<div align="center">
4440

45-
## Create The Client
41+
## Create the client
4642

4743
You can pass the API key directly or use the full options object.
4844

@@ -51,23 +47,40 @@ You can pass the API key directly or use the full options object.
5147
```ts
5248
import { Rewrite } from '@rewritetoday/sdk';
5349

54-
const advanced = new Rewrite({
55-
secret: 'rw_xxx',
50+
const rewrite = new Rewrite({
51+
secret: 'rw_...',
5652
rest: {
5753
timeout: 10_000,
5854
headers: {
59-
'x-trace-id': 'my-service',
55+
'User-Agent': 'StatusPage One (1.0.0)',
6056
},
6157
retry: {
6258
max: 3,
63-
delay: (attempt) => attempt * 250,
59+
delay(attempt) {
60+
return attempt * 250;
61+
},
6462
},
6563
},
6664
});
6765
```
6866

6967
<div align="center">
7068

69+
## Send your first message
70+
71+
</div>
72+
73+
```ts
74+
const { data, error } = await rewrite.messages.send({
75+
to: '+551234567890',
76+
content: 'Hey, Rewrite is here!',
77+
});
78+
```
79+
80+
<div align="center">
81+
82+
You can view in our [documentation](https://docs.rewritetoday.com/api-reference/messages/send-a-message) everything in you can use when sending a message.
83+
7184
## Error Handling
7285

7386
Requests run through `@rewritetoday/rest`. HTTP failures can throw `HTTPError`.

0 commit comments

Comments
 (0)