lettr
v1.7.0
Published
Official Node.js SDK for the [Lettr](https://lettr.com) transactional email API. Type-safe client that returns a `Result` (`{ data, error }`) instead of throwing — covers emails, templates, domains, webhooks, audience, and campaigns.
Readme
Lettr Node.js SDK
Official Node.js SDK for the Lettr transactional email API. Type-safe client that returns a Result ({ data, error }) instead of throwing — covers emails, templates, domains, webhooks, audience, and campaigns.
Installation
npm install lettr
# or: pnpm add lettr / yarn add lettr / bun add lettrUsage
import { Lettr } from "lettr";
const client = new Lettr(process.env.LETTR_API_KEY!);
const { data, error } = await client.emails.send({
from: "[email protected]",
to: ["[email protected]"],
subject: "Welcome!",
html: "<p>Hello!</p>",
});
if (error) {
// error.type is "validation" | "api" | "network"
console.error(error.message);
} else {
console.log(data.request_id);
}Every method returns a Result<T> — destructure { data, error } and handle error before reading data. The SDK never throws for API or network failures.
Documentation
Full guides for every resource, with complete request/response details, live in the docs:
📚 docs.lettr.com/quickstart/nodejs
| Topic | Guide | |-|-| | Install, client, the Result pattern | Installation | | HTML, text, templates, attachments, scheduling, errors | Sending Emails | | Manage Lettr templates & merge tags | Templates | | Add, verify, and manage sending domains | Domains | | Webhook endpoints for delivery & engagement events | Webhooks | | Lists, contacts, topics, properties, segments | Audience | | List, send, and schedule campaigns | Campaigns | | Endpoint reference (params & schemas) | API Reference |
License
MIT
