@postbote/adapter-resend-http
v1.0.0
Published
Postbote-Adapter für Resend (HTTP via fetch)
Readme
@postbote/adapter-resend-http
Postbote adapter for Resend — HTTP via fetch, zero SDK dependencies, edge-compatible.
Installation
pnpm add @postbote/adapter-resend-httpUsage
import { resendHttp } from "@postbote/adapter-resend-http";
import { createPostbote } from "@postbote/core";
const postbote = createPostbote({
adapter: resendHttp({ 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 |
| baseUrl | string | https://api.resend.com | API base URL |
| timeoutMs | number | 30000 | Request timeout |
| fetch | typeof fetch | globalThis.fetch | Custom fetch implementation |
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.
Native SDK variant
For the version using the official Resend SDK, see @postbote/adapter-resend.
License
MIT — see LICENSE.md.
