Node.js

Use the REST API with the built-in fetch (Node 18 and later), or keep Nodemailer and point it at our SMTP relay.

Option A: REST API

No dependencies. Put your API key in SIGNALLY_API_KEY.

signally.js
// signally.js
export async function sendEmail({ to, subject, html, text, idempotencyKey }) {
  const res = await fetch('https://api.signally.cloud/v1/email', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.SIGNALLY_API_KEY}`,
      'Content-Type': 'application/json',
      ...(idempotencyKey && { 'Idempotency-Key': idempotencyKey }),
    },
    body: JSON.stringify({
      from: { address: '[email protected]', name: 'Your Shop' },
      to: [].concat(to),
      subject, html, text,
    }),
  });
  const body = await res.json();
  if (!res.ok) throw Object.assign(new Error(body.error.message), { code: body.error.code, status: res.status });
  return body; // { message_id, accepted, suppressed }
}
Usage
import { sendEmail } from './signally.js';

await sendEmail({
  to: order.customerEmail,
  subject: `Order #${order.id} confirmed`,
  html: `<p>Thanks! We received your payment of KES ${order.total}.</p>`,
  idempotencyKey: `order-confirmed-${order.id}`,
});

Retry on network errors, 429 and 5xx responses with the same Idempotency-Key; see safe retries. Do not retry 4xx errors other than 429 without fixing the request.

Option B: Nodemailer over SMTP

Hostsmtp.signally.cloud
Port465 with SSL/TLS (recommended), or 587 with STARTTLS
UsernameYour SMTP username, e.g. smtp-12-ab3xk9
PasswordThe SMTP password shown once when you created the login

Create an SMTP login under API & SMTP in your dashboard. It is separate from your API keys. The From address must be on a domain you have verified.

Install
npm install nodemailer
mailer.js
import nodemailer from 'nodemailer';

const transporter = nodemailer.createTransport({
  host: 'smtp.signally.cloud',
  port: 465,
  secure: true, // SSL/TLS on 465. For port 587 use secure: false (STARTTLS is used automatically).
  auth: {
    user: process.env.SIGNALLY_SMTP_USER,
    pass: process.env.SIGNALLY_SMTP_PASS,
  },
});

await transporter.sendMail({
  from: '"Your Shop" <[email protected]>',
  to: '[email protected]',
  subject: 'Your order has shipped',
  html: '<p>It is on its way!</p>',
  text: 'It is on its way!',
});

Run await transporter.verify() once at start-up to check the connection and login.

Keep keys and passwords in environment variables or your secrets manager, never in your code or Git repository. If one leaks, revoke it under API & SMTP and create a new one.

Stuck? Email [email protected] with your account name and the message ID or error code.