Self-hosted · CFFlowmails
Runtime v0.1
Deno
Deno 1.40+
Flowmails + Deno
Deno works without a package.json — import the SDK via npm: specifier. The runtime's fetch is used directly.
Step 1
Install the SDK
installbash
// import directly from npm:
import { Flowmails } from "npm:@flowmails/flowmails-sdk";Step 2
Send your first message
sendtypescript
// main.ts
import { Flowmails } from "npm:@flowmails/flowmails-sdk";
const fm = new Flowmails({
apiKey: Deno.env.get("FLOWMAILS_API_KEY")!,
});
Deno.serve(async (request: Request) => {
if (request.method !== "POST") {
return new Response("Use POST", { status: 405 });
}
const body = await request.json();
const result = await fm.send({
from: "hello@yourdomain.com",
to: body.to,
subject: "Welcome",
text: body.text,
});
return Response.json({ id: result.id });
});Prerequisites
What you need first
- Deno 1.40+
- FLOWMAILS_API_KEY in the Deno environment
Runtime notes
Things to know on Deno
Deno Deploy runs the SDK in the same V8 isolate as Workers — sub-millisecond cold start.
If you cache the SDK import across requests, you'll save a few ms of module-graph overhead per cold start.
Other integrations