Better-Notify for Cloudflare Workers
Send notifications from Cloudflare Workers using Cloudflare Email Routing or any HTTP-based transport. Better-Notify is ESM-only and works natively in the Workers runtime.
Why it fits
- ESM-only — works in Workers without bundler hacks
- Native Cloudflare Email transport
- No SMTP or TCP sockets required
- Works with Queues for async delivery
Example
src/worker.ts
import { mail } from './lib/notifications';
export default {
async fetch(req: Request): Promise<Response> {
const { to, orderId } = await req.json();
await mail.orderConfirmation.send({
to,
input: { orderId },
});
return new Response('sent');
},
};