Node.js
Node.js 18+

Flowmails + Node.js

Plain Node.js, Express, Fastify, NestJS, Koa — anything built on Node 18+ runs the SDK out of the box. The SDK uses the runtime-native `fetch`, no polyfill.

Step 1

Install the SDK

installbash
pnpm add @flowmails/flowmails-sdk

Step 2

Send your first message

sendtypescript
// server.mjs
import express from "express";
import { Flowmails } from "@flowmails/flowmails-sdk";

const app = express();
app.use(express.json());

const fm = new Flowmails({ apiKey: process.env.FLOWMAILS_API_KEY });

app.post("/send", async (req, res) => {
  const result = await fm.send({
    from: "hello@yourdomain.com",
    to: req.body.to,
    subject: "Welcome",
    text: req.body.text,
  });
  res.json({ id: result.id });
});

app.listen(3000);

Prerequisites

What you need first

  • Node.js 18+ (for the native `fetch` global)
  • FLOWMAILS_API_KEY in the environment

Runtime notes

Things to know on Node.js

On Node 16 and below, polyfill `fetch` with `undici` — the SDK does not bundle one.

If you instantiate the SDK once at module scope (the snippet above) and reuse it across requests, you'll get connection pooling for free.

Other integrations

All Flowmails integrations