One Hono route that sends, on any runtime.
Hono runs on Node, Bun, Deno and Cloudflare Workers, and the send is the same everywhere: a POST to the Notix API. Use notix-js where Node's crypto module is available, or a plain fetch where it is not.
Send an email from Hono.
import { Hono } from "hono";
import { Notix } from "notix-js";
const app = new Hono();
const notix = new Notix(process.env.NOTIX_API_KEY!);
app.post("/send", async (c) => {
const { to } = await c.req.json();
const { data, error } = await notix.emails.send({
from: "Acme <receipts@acme.com>",
to,
subject: "Your receipt",
html: "<p>Thanks for your order.</p>",
});
if (error) return c.json({ error }, 502);
return c.json({ id: data?.emailId });
});
export default app;
app.post("/send", async (c) => {
const { to } = await c.req.json();
const response = await fetch("https://app.usenotix.dev/api/v1/emails", {
method: "POST",
headers: { Authorization: `Bearer ${c.env.NOTIX_API_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({ from: "Acme <receipts@acme.com>", to, subject: "Your receipt", html: "<p>Thanks.</p>" }),
});
return c.json(await response.json(), response.ok ? 200 : 502);
});
The from address must be on a domain you have verified in Notix. Step by step: the Node.js quickstart and the longer guide to sending email from Hono.
One API key, kept on the server.
Create an API key on the API keys page of the Notix console and store it as NOTIX_API_KEY in the runtime's environment: process.env on Node and Bun, Deno.env on Deno, a secret read through c.env on Workers. Read it only in code that runs on the server, never in anything shipped to a browser.
A Send only key is enough for code that only sends: if it leaks, it cannot read your contacts or delete a domain.
NOTIX_API_KEY=notix_xxxxxxxxxxxx
NOTIX_WEBHOOK_SECRET=whsec_xxxxxxxxxxxx
Verify delivery events over the raw body.
Notix signs every webhook call with the webhook's signing secret: an HMAC-SHA256 of the X-Notix-Timestamp header, a dot and the raw body, sent in X-Notix-Signature. The SDKs check the signature and refuse a call more than 5 minutes old.
Call request.text() before anything parses the body: the signature covers the exact bytes Notix sent.
import { Notix } from "notix-js";
const notix = new Notix(process.env.NOTIX_API_KEY!);
const webhooks = notix.webhooks(process.env.NOTIX_WEBHOOK_SECRET!);
export async function handleNotixWebhook(request: Request): Promise<Response> {
const rawBody = await request.text();
try {
const event = webhooks.constructEvent(rawBody, { headers: request.headers });
if (event.type === "email.bounced") {
// Mark the address in your own records.
}
return new Response("ok");
} catch {
return new Response("invalid signature", { status: 400 });
}
}
Questions, answered.
Does notix-js work on every runtime Hono supports?
What if the same request runs twice?
Why is my send refused with a from-address error?
Keep reading.
Send email from Hono
A Hono route that sends through Notix on Node, Bun, Deno or Cloudflare Workers, the runtime Notix's own API is written in.
DocsNode.js
Send an email from Node.js with the notix-js SDK.
IntegrationsIntegrations
Notix inside the frameworks, platforms and AI coding tools you already use, from Next.js and Laravel to Supabase, Vercel and Cursor.
ProductEmail API
One JSON API for transactional and marketing email: send, batch, schedule, webhooks, typed SDKs.
NotixPricing
A free plan with no card, and Pro at $15 a month for 50,000 emails. Only sent volume is metered.
Send your first email in five minutes.
Verify a domain, copy an API key, make one call. The free plan does not ask for a card.