@postbote/adapter-resend
v1.0.0
Published
Postbote-Adapter für Resend (natives SDK)
Readme
@postbote/adapter-resend
Postbote adapter for Resend — native resend SDK.
Installation
pnpm add @postbote/adapter-resendUsage
import { resend } from "@postbote/adapter-resend";
import { createPostbote } from "@postbote/core";
const postbote = createPostbote({
adapter: resend({ apiKey: "re_..." }),
});
const result = await postbote.send({
from: "Acme <[email protected]>",
to: "[email protected]",
subject: "Welcome",
text: "Hello!",
});Options
| Option | Type | Default | Description |
|---|---|---|---|
| apiKey | string | — | Resend API key |
| client | Resend | — | Existing Resend SDK instance (injectable) |
Client Injection
Pass a pre-configured SDK instance for testing or custom setup:
import { Resend } from "resend";
import { resend } from "@postbote/adapter-resend";
const client = new Resend("re_...");
const adapter = resend({ client });Error Mapping
| Condition | Code |
|---|---|
| HTTP 401 | AUTH |
| HTTP 422 (validation error) | INVALID_MESSAGE |
| HTTP 403 / 404 (contact not found) | RECIPIENT_REJECTED |
| HTTP 429 | RATE_LIMITED |
| HTTP 5xx / network error | PROVIDER_UNAVAILABLE |
| Timeout | TIMEOUT |
Contract
Passes the full @postbote/adapter-contract suite.
HTTP variant
For a fetch-based, zero-dependency version (edge-compatible), see @postbote/adapter-resend-http.
License
MIT — see LICENSE.md.
