Systems Library / Marketing Automation / How to Build an AI Newsletter Writer
Marketing Automation email marketing

How to Build an AI Newsletter Writer

Generate weekly newsletters using AI that curates and writes relevant content.

Jay Banlasan

Jay Banlasan

The AI Systems Guy

This ai newsletter writer generates my weekly newsletters by curating relevant content and writing it in my voice. I went from two hours every week to 15 minutes reviewing what AI drafted.

Train it on your voice and give it good source material. That is the whole trick.

What You Need Before Starting

Step 1: Collect Source Content

import feedparser

def collect_sources(feed_urls):
    articles = []
    for url in feed_urls:
        feed = feedparser.parse(url)
        for entry in feed.entries[:5]:
            articles.append({
                "title": entry.title,
                "summary": entry.get("summary", "")[:200],
                "link": entry.link,
            })
    return articles

Step 2: Filter by Relevance

import anthropic
from dotenv import load_dotenv

load_dotenv()
client = anthropic.Anthropic()

def rank_articles(articles, audience):
    article_list = "\n".join([f"- {a['title']}: {a['summary']}" for a in articles])
    message = client.messages.create(
        model="claude-sonnet-4-20250514",
        max_tokens=512,
        system="Rank articles by relevance to audience. Return top 5 titles.",
        messages=[{"role": "user", "content": f"Audience: {audience}\n{article_list}"}]
    )
    return message.content[0].text

Step 3: Write the Newsletter

def write_newsletter(top_articles, voice, angle):
    message = client.messages.create(
        model="claude-sonnet-4-20250514",
        max_tokens=2048,
        system=f"Write newsletter in this voice: {voice}. No fluff. Each section teaches. Use contractions. Short paragraphs.",
        messages=[{"role": "user", "content": f"Angle: {angle}\nArticles: {top_articles}\nInclude: intro, 3 sections, one takeaway, sign-off."}]
    )
    return message.content[0].text

Step 4: Format for Send

def format_html(text):
    html = text.replace("\n\n", "</p><p>").replace("\n", "<br>")
    return f"<div style='max-width:600px;margin:auto;font-family:sans-serif'><p>{html}</p></div>"

What to Build Next

Add subscriber feedback. Let readers rate sections and feed that into content selection to improve over time.

Related Reading

Want this system built for your business?

Get a free assessment. We will map every system your business needs and show you the ROI.

Get Your Free Assessment

Related Systems