Integrations
Node.js SDK
The official TypeScript SDK for Node.js, Next.js, Bun and edge runtimes.
npm install stackemails
import { StackEmails } from "stackemails";
const stack = new StackEmails(process.env.STACKEMAILS_API_KEY, {
// optional
baseUrl: "https://stackemails.com",
maxRetries: 2,
});
The client retries network errors and 429 / 5xx responses with backoff, and throws a StackEmailsError (status, code, message, requestId) on failure.
Resources
| Resource | Methods |
|---|---|
stack.emails |
send, batch, get, list, update, cancel |
stack.domains |
create, get, list, update, verify, remove |
stack.contacts |
create, get, list, update, remove |
stack.segments |
create, get, list, remove |
stack.topics |
create, list, update, remove |
stack.broadcasts |
create, list, send |
stack.events |
send |
React Email
Install @react-email/render and pass a component as react:
await stack.emails.send({ from, to, subject: "Welcome", react: <WelcomeEmail name="Ada" /> });
Webhooks
import { verifyWebhook } from "stackemails";
See Webhooks.