This documentation URL will be retired soon. Start using the Ranla API at https://api.ranla.ai. Docs: docs.ranla.ai.

SuperSend TX with Node.js

Use the Node SDK in Express, Fastify, workers, cron jobs, queue consumers, or any other server runtime where your API key can stay private.

1. Install the SDK

npm install supersendtx

2. Configure your API key

export SUPERSENDTX_API_KEY=stx_your_key_here

3. Send an email

import { SuperSendTX } from 'supersendtx'

const tx = new SuperSendTX(process.env.SUPERSENDTX_API_KEY!)

const result = await tx.emails.send({
  from: '[email protected]',
  to: '[email protected]',
  subject: 'Your receipt',
  html: '<p>Thanks for your purchase.</p>',
})

console.log(result.id, result.status)

Nodemailer transport

Many Node apps and tools (Payload, Auth.js email, Strapi, Ghost, and custom apps) accept a Nodemailer transport. Use ours so existing transporter.sendMail(...) calls hit SuperSend TX over HTTP (not SMTP).

Dedicated package: supersendtx-nodemailer (transport source of truth; also re-exported as supersendtx/nodemailer).

npm install supersendtx-nodemailer supersendtx nodemailer
import nodemailer from 'nodemailer'
import { createSuperSendTXTransport } from 'supersendtx-nodemailer'

const transporter = nodemailer.createTransport(
  createSuperSendTXTransport({
    apiKey: process.env.SUPERSENDTX_API_KEY!,
  }),
)

await transporter.sendMail({
  from: '[email protected]',
  to: '[email protected]',
  subject: 'Your receipt',
  html: '<p>Thanks for your purchase.</p>',
  headers: {
    'X-SuperSendTX-Tag': 'campaign=welcome',
    'X-SuperSendTX-Idempotency-Key': 'receipt-123',
    // 'X-SuperSendTX-Scheduled-At': '2030-01-01T00:00:00Z',
  },
})

X-SuperSendTX-Tag uses name=value. Pass an array of header values for multiple tags. Custom non-reserved headers are forwarded to the API headers field. Attachments must include inline content (Buffer or string); path / href are not supported yet.

Better Auth

Dedicated package (preferred for discoverability):

npm install supersendtx-better-auth supersendtx better-auth
import { createBetterAuthEmail } from 'supersendtx-better-auth'

Same helper is also exported as supersendtx/better-auth. Full setup: Better Auth email.

Auth.js / NextAuth

npm install supersendtx-authjs supersendtx next-auth
import SuperSendTX from 'supersendtx-authjs'

Same provider is also exported as supersendtx/authjs. Full setup: Auth.js / NextAuth email.

React Email

Author components with React Email, then pass them to the Node SDK’s react option:

npm install supersendtx @react-email/render react
await tx.emails.send({
  from: '[email protected]',
  to: '[email protected]',
  subject: 'Welcome',
  react: WelcomeEmail({ name: 'Ada' }),
})

Full walkthrough (Next.js, CLI template push, troubleshooting): Send React Email.