runNewsletter (newsletter/index.js)

claude-code-templates · cloudflare-workers/newsletter/index.js · javascript · MIT
email

Cloudflare Worker that composes a weekly newsletter from trending components and sends it via Resend.

// Source: https://github.com/davila7/claude-code-templates | License: MIT | Copyright 2025 Daniel (San) Ávila
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Cloudflare Worker: Newsletter — Weekly Community Components Email
 *
 * Picks trending components (Skills, Agents, MCPs, Hooks, Settings) with
 * weighted randomness, composes a simple email whose wording rotates on
 * every send, and delivers it as a Resend Broadcast to the segment in
 * RESEND_SEGMENT_ID. Resend injects the per-recipient unsubscribe link
 * ({{{RESEND_UNSUBSCRIBE_URL}}} in the body) and manages the suppression
 * list automatically. Replies go to NEWSLETTER_REPLY_TO.
 *
 * The segment is the safety gate: point RESEND_SEGMENT_ID at a test segment
 * (single recipient) while iterating, and at 

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key