Update SDK documentation (#20)

* Update SDK documentation

* fix doc
This commit is contained in:
KM Koushik
2024-05-26 15:00:07 +10:00
committed by GitHub
parent 5b5fa74f32
commit ad57992e21
3 changed files with 51 additions and 1 deletions

View File

@@ -35,6 +35,8 @@ description: "Send your mail using unsend in NodeJS"
Get the API key from the [Unsend dashboard](https://app.unsend.dev/api-keys) and initialize the SDK
```javascript
import { Unsend } from "unsend";
const unsend = new Unsend({ apiKey: "us_12345" });
```

48
packages/sdk/README.md Normal file
View File

@@ -0,0 +1,48 @@
# Unsend SDK
## Prerequisites
- [Unsend API key](https://app.unsend.dev/api-keys)
- [Verified domain](https://app.unsend.dev/domains)
## Installation
### NPM
```bash
npm install unsend
```
### Yarn
```bash
yarn add unsend
```
### PNPM
```bash
pnpm add unsend
```
### Bun
```bash
bun add unsend
```
## Usage
```javascript
import { Unsend } from "unsend";
const unsend = new Unsend({ apiKey: "us_12345" });
unsend.emails.send({
to: "hello@acme.com",
from: "hello@company.com",
subject: "Unsend email",
html: "<p>Unsend is the best open source product to send emails</p>",
text: "Unsend is the best open source product to send emails",
});
```

View File

@@ -27,7 +27,7 @@ export class Unsend {
if (!this.key) {
throw new Error(
'Missing API key. Pass it to the constructor `new Unsend("re_123")`'
'Missing API key. Pass it to the constructor `new Unsend("us_123")`'
);
}
}