Clerk email with SuperSend TX

Clerk has no custom SMTP form for auth mail. To send verification codes, magic links, and similar templates through SuperSend TX:

  1. Turn off Delivered by Clerk on the templates you want to own
  2. Subscribe to the email.created webhook
  3. Deliver with supersendtx-clerk (also supersendtx/clerk)

Prerequisites

  1. SuperSend TX account + stx_… API key
  2. Verified sending domain (or Sandbox for self-tests — see Quickstart)
  3. Clerk app with webhook signing secret
npm install supersendtx-clerk supersendtx @clerk/nextjs
SUPERSENDTX_API_KEY=stx_your_key_here
SUPERSENDTX_FROM_EMAIL=noreply@yourdomain.com

Webhook route

// app/api/webhooks/clerk/route.ts
import { verifyWebhook } from '@clerk/nextjs/webhooks'
import { createClerkEmailDeliverer } from 'supersendtx-clerk'

const deliver = createClerkEmailDeliverer({
  from: process.env.SUPERSENDTX_FROM_EMAIL!,
  // apiKey: process.env.SUPERSENDTX_API_KEY,
})

export async function POST(req: Request) {
  const evt = await verifyWebhook(req)
  if (evt.type === 'email.created') {
    await deliver(evt.data)
  }
  return new Response('ok')
}

When delivered_by_clerk is still true, the helper returns null and does not send (avoids double delivery). Turn delivery off in the Clerk dashboard for each template you want SuperSend TX to own.

Point the Clerk webhook endpoint at this route and subscribe to email.created.


Options

Option Default Purpose
from — (required) Verified sender
apiKey SUPERSENDTX_API_KEY API key
baseUrl https://api.supersendtx.com API base URL
skipIfDeliveredByClerk true Skip when Clerk still delivers
force false Send even when delivered_by_clerk is true
client Inject a SuperSendTX instance (tests)

Sends are tagged auth=clerk-<slug> (or clerk-email) and use idempotency key clerk-email-<id> when Clerk provides an email id.


SMTP alternative

If you only need SMTP fields somewhere else in your stack, create a SuperSend TX SMTP credential (smtp.supersendtx.com). Clerk auth templates themselves still go through the webhook path above.