Notix
Integrations

Clerk for sign-in, Notix for everything else you send.

Clerk manages sign-in and its own authentication emails. The rest of your app's mail, receipts, alerts, onboarding, comes from your code. This page reads the signed-in user's address from Clerk on the server and sends with notix-js.

The send

Send an email from Clerk.

app/api/welcome/route.ts
import { currentUser } from "@clerk/nextjs/server";
import { Notix } from "notix-js";

const notix = new Notix(process.env.NOTIX_API_KEY!);

export async function POST() {
  const user = await currentUser();
  const to = user?.primaryEmailAddress?.emailAddress;
  if (!user || !to) return new Response("Unauthorized", { status: 401 });

  const { data, error } = await notix.emails.send(
    { from: "Acme <hello@acme.com>", to, subject: "Welcome to Acme", html: "<p>Glad you are here.</p>" },
    { idempotencyKey: `welcome-${user.id}` },
  );
  if (error) return Response.json({ error }, { status: 502 });
  return Response.json({ id: data?.emailId });
}

The from address must be on a domain you have verified in Notix. Step by step: the Next.js quickstart and the longer guide to sending email from Next.js.

Environment

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 .env.local and your host's environment. Never give it the NEXT_PUBLIC_ prefix: variables with that prefix are built into the browser bundle, and anyone who opens the site can read them.

A Send only key is enough for code that only sends: if it leaks, it cannot read your contacts or delete a domain.

.env
NOTIX_API_KEY=notix_xxxxxxxxxxxx
NOTIX_WEBHOOK_SECRET=whsec_xxxxxxxxxxxx
FAQ

Questions, answered.

Does Notix replace Clerk's own emails?
This page does not change them: Clerk keeps sending its sign-in emails. Notix sends the email your application writes itself, from server code, using the address Clerk stores for the user.
Why an idempotency key on a welcome email?
Keyed on the Clerk user id, a welcome email can only go once per user, even if the route is called twice. The same key and body return the first result instead of sending again.
Why is my send refused with a from-address error?
The from address must be on a domain you have verified in Notix. Add the domain in the console, publish the DNS records it shows, and wait for verification; until then, sends from that domain are refused.

The free plan does not ask for a card.

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.