SDKs
Official client libraries for sending email and handling webhooks. All SDKs wrap the same REST API — anything you can do with curl, you can do with the SDK.
Node / TypeScript Stable
Works in Node 18+, every modern bundler, and edge runtimes that support fetch.
install
pnpm add @cybersquad/nextmailsend.ts
import { NextMail } from '@cybersquad/nextmail';
const mail = new NextMail({ apiKey: process.env.NEXTMAIL_KEY! });
const sent = await mail.emails.send({
from: 'noreply@mail.example.com',
to: 'user@example.com',
subject: 'Welcome',
templateSlug: 'welcome',
data: { firstName: 'Sarah' },
});
console.log('Queued', sent.id);Batch send
batch.ts
const res = await mail.emails.batch([
{ from, to: 'a@example.com', subject: 'Hi', text: 'one' },
{ from, to: 'b@example.com', subject: 'Hi', text: 'two' },
]);
// res.results carries per-item ok/error; one bad item doesn't sink the rest.Idempotent retries
idempotent.ts
// Pair every retryable send with a stable idempotencyKey — a repeat
// with the same key returns the original result instead of double-sending.
await mail.emails.send({
from, to, subject, html,
idempotencyKey: orderId, // your own operation id
});PHP Roadmap
Not started. Until a first-party SDK ships, the REST API and SMTP relay are both first-class options for PHP apps.
Python Roadmap
Not started. Same story as PHP — call the REST API directly with httpx / requests for now.
Roll your own
If no SDK fits, the REST API is fine to call directly — there's no SDK magic the API doesn't expose. See the API reference for the request shape.