Recipe: Auth provider → verification email
Send email verification or magic-link messages from Clerk, Better Auth, or Supabase Auth hooks using Notify.
Auth providers differ on hooks; the Notify step is always the same: your backend has an email + token/URL → POST /api/email/send.
Pattern
async function sendAuthEmail(opts: {
to: string;
subject: string;
html: string;
}) {
const res = await fetch('https://notify.cx/api/email/send', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': process.env.NOTIFY_API_KEY!
},
body: JSON.stringify({
to: opts.to,
subject: opts.subject,
message: opts.html,
from: 'noreply@your-verified-domain.com'
})
});
if (!res.ok) throw new Error(await res.text());
}
Where to plug in
| Stack | Typical hook |
| --- | --- |
| Clerk | Custom email / webhook after sign-up if you own the message, or call Notify from your backend when you issue a verify link |
| Better Auth | sendVerificationEmail / sendMagicLink callbacks in server config |
| Supabase Auth | Prefer your own Edge Function or app route after signup if you bypass built-in SMTP — or use Notify from a database webhook / Edge Function when a profile is created |
Example Better Auth–style callback:
sendVerificationEmail: async ({ user, url }) => {
await sendAuthEmail({
to: user.email,
subject: 'Verify your email',
html: `<p><a href="${url}">Verify email</a></p>`
});
}