@sealpost/sdk
v0.1.0
Published
Zero-dependency TypeScript client for the Sealpost API. Resend-style { data, error } results; works in Node 18+, browsers, Deno, Bun and edge runtimes.
Downloads
249
Maintainers
Readme
@sealpost/sdk
Zero-dependency TypeScript client for the Sealpost API. Works in Node 18+, browsers, Deno, Bun and edge runtimes. Results are { data, error }; methods never throw for API or network errors.
npm i @sealpost/sdkimport { Sealpost } from "@sealpost/sdk";
const mail = new Sealpost({ apiKey: process.env.SEALPOST_KEY!, baseUrl: "https://mail.yourdomain.com" });
const { data, error } = await mail.emails.send({
template: "magic_link_otp_verification",
to: "[email protected]",
variables: { userName: "Ada", otpCode: "482913", signInUrl: "https://app.example.com/in" },
});
if (error?.code === "preflight_blocked") console.log(error.preflight?.checks); // nothing was sent
else if (data) console.log(data.messageId, data.receipt); // evw_… receiptconst aud = (await mail.audiences.create("Customers")).data!;
await mail.audiences.addContacts(aud.id, [{ email: "[email protected]", name: "Ada", variables: { userName: "Ada" } }]);
await mail.broadcasts.create({ name: "Launch", audienceId: aud.id, template: "workspace_team_invitation", scheduledAt: new Date("2026-11-01T09:00:00Z"), ratePerMinute: 300 });
await mail.domains.check("news.example.org"); // live SPF / DKIM / DMARC lookupVerify webhooks with verifyWebhook(secret, rawBody, signatureHeader).
See the API reference. MIT.
