Cloudflare Pages
Cloudflare Pages Functions (V8 isolates)

Flowmails + Cloudflare Pages

Pages Functions sit on top of Workers — same runtime, same SDK. Use this when your site is on Pages and you want a contact / sign-up / notification endpoint without standing up a separate Worker project.

Step 1

Install the SDK

installbash
pnpm add @flowmails/flowmails-sdk

Step 2

Send your first message

sendtypescript
// functions/api/contact.ts
import { Flowmails } from "@flowmails/flowmails-sdk";

interface Env {
  FLOWMAILS_API_KEY: string;
}

export const onRequestPost: PagesFunction<Env> = async ({ request, env }) => {
  const body = (await request.json()) as { name: string; email: string };
  const fm = new Flowmails({ apiKey: env.FLOWMAILS_API_KEY });
  const result = await fm.send({
    from: "hello@yourdomain.com",
    to: "team@yourdomain.com",
    subject: `New contact: ${body.name}`,
    text: `From: ${body.email}`,
  });
  return Response.json({ ok: true, id: result.id });
};

Prerequisites

What you need first

  • Cloudflare Pages project
  • FLOWMAILS_API_KEY set in Pages → Settings → Environment variables

Runtime notes

Things to know on Cloudflare Pages

Pages Functions run in the same V8 isolate as Workers; the SDK's runtime requirements are identical.

Bundle size budget is tight on Pages — the SDK is ~12 KB minified + gzipped, comfortably under the 1 MB Functions limit.

Other integrations

All Flowmails integrations