Skip to content

Commit 14557a9

Browse files
authored
docs: fix node sdk initialization (#163)
1 parent e850512 commit 14557a9

File tree

5 files changed

+19
-5
lines changed

5 files changed

+19
-5
lines changed

apps/docs/get-started/nodejs.mdx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,14 @@ icon: node-js
3838
```javascript
3939
import { Unsend } from "unsend";
4040

41-
const unsend = new Unsend({ apiKey: "us_12345" });
41+
const unsend = new Unsend("us_12345");
42+
```
43+
44+
If you are running a self-hosted version of Unsend, pass the base URL as the
45+
second argument:
46+
47+
```javascript
48+
const unsend = new Unsend("us_12345", "https://my-unsend-instance.com");
4249
```
4350

4451
</Step>

apps/docs/guides/use-with-react-email.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ import { Unsend } from "unsend";
5353
import { render } from "@react-email/render";
5454
import { Email } from "./email";
5555

56-
const unsend = new Unsend({ apiKey: "us_your_unsend_api_key" });
56+
const unsend = new Unsend("us_your_unsend_api_key");
5757

5858
const html = await render(<Email url="https://unsend.dev" />);
5959

apps/web/src/lib/constants/example-codes.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ export const getSendTestEmailCode = ({
1919
title: "Node.js",
2020
code: `import { Unsend } from "unsend";
2121
22-
const unsend = new Unsend({ apiKey: "us_12345" });
22+
const unsend = new Unsend("us_12345");
23+
24+
// const unsend = new Unsend("us_12345", "https://my-unsend-instance.com");
2325
2426
unsend.emails.send({
2527
to: "${to}",

packages/email-editor/src/editor.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ You can create unordered list
4949
<p>Add code by typing \`\`\` and enter</p>
5050
<pre>
5151
<code>
52-
const unsend = new Unsend({ apiKey: "us_12345" });
52+
const unsend = new Unsend("us_12345");
53+
54+
// const unsend = new Unsend("us_12345", "https://my-unsend-instance.com");
5355
5456
unsend.emails.send({
5557
to: "john@doe.com",

packages/sdk/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ bun add unsend
3636
```javascript
3737
import { Unsend } from "unsend";
3838

39-
const unsend = new Unsend({ apiKey: "us_12345" });
39+
const unsend = new Unsend("us_12345");
40+
41+
// for self-hosted installations you can pass your base URL
42+
// const unsend = new Unsend("us_12345", "https://my-unsend-instance.com");
4043

4144
unsend.emails.send({
4245
to: "hello@acme.com",

0 commit comments

Comments
 (0)