Keeping up with daily AI updates can be a challenge โ new models, tools, and breakthroughs appear almost every day. To simplify this process, we built an AI-powered โNewsletter Agentโ using n8n, an open-source workflow automation platform. This agent automatically finds trending AI topics, writes educational newsletters using Google Gemini AI, formats the content, and sends it to subscribers โ all without manual work.
๐ The Concept The idea was to automate daily newsletter creation and delivery โ so the system itself handles: โ Finding a trending AI topic โ Writing the newsletter โ Formatting and cleaning the text โ Fetching email contacts โ Sending the email automatically The result? A fully autonomous digital writer and publisher, powered by n8n + Gemini AI. โ๏ธ Workflow Overview The entire automation was created inside n8nโs visual editor. Hereโs how it works step-by-step: 1. **Schedule Trigger**** โ Runs the workflow daily or weekly. **2. AI Topic Selector โ Uses Gemini to find a trending AI topic from the last 24โ48 hours. 3. AI Newsletter Writer โ Generates a complete, structured newsletter. 4. Extract & Format Content โ Cleans and converts raw AI output into HTML. 5. Google Sheets โ Fetches subscriber email addresses dynamically. 6. Aggregate Node โ Combines all emails into a single list. 7. Send AI Newsletter (Gmail) โ Sends a well-designed HTML email automatically.
๐ง **AI Topic Selector** This step is powered by Google Gemini. It searches recent AI trends and picks one relevant topic โ like โPrompt Engineering Techniquesโ or โAI Workflow Automation.โ A short, structured prompt instructs Gemini to act as a curator, selecting only the most valuable and recent topics. This ensures every newsletter stays fresh, relevant, and industry-aligned. โ๏ธ **AI Newsletter Writer** Once the topic is selected, another Gemini node writes the newsletter content automatically. It includes: โ Topic introduction โ Why it matters โ Key concepts โ Real-world use cases โ Pro tips and takeaways The AI follows predefined HTML formatting for Cambria font, highlighted sections, and clean headings โ ready for email delivery. ๐ป **Content Formatting & Cleanup** The AIโs raw output often contains structured data or unwanted escape characters. A Code node (JavaScript) was added to: โฅ Extract clean HTML โฅ Remove metadata or formatting errors โฅ Trim unnecessary text This ensures that the final newsletter looks professional when rendered inside an email. ๐ Fetching Subscribers via Google Sheets Instead of static emails, the agent pulls recipient data directly from a connected Google Sheet. Anyone can add or update email addresses without opening n8n. This simple integration makes the workflow scalable and easy to maintain โ perfect for teams or communities. ๐ฆ Data Aggregation Before sending, the Aggregate node compiles all emails into a single clean string. This avoids duplication and ensures a smooth send process. Itโs a small but essential step that keeps data management organized inside n8n. ๐จ Sending the Newsletter The final email is sent automatically using Gmail integration inside n8n. The email design includes: โ Gradient header (AI Deep Dive) โ Topic badge โ White content section with readable text โ Footer with tagline Itโs a simple, elegant layout optimized for readability and consistency.
๐ Why This Workflow Matters The โNewsletter Agentโ combines the creative power of AI with the automation strength of n8n, offering: โ Zero manual effort โ everything runs on schedule. โ Dynamic content โ real-time AI-generated insights. โ Smart email management โ integrates seamlessly with Google Sheets. โ Scalable setup โ ideal for teams or tech newsletters. This setup shows how AI and workflow automation can handle content creation reliably at scale. ๐ Best Practices ๐ก Use structured prompts for predictable AI outputs. ๐ก Keep formatting consistent using HTML and CSS inside n8n. ๐ก Regularly test AI responses for accuracy and tone. ๐ก Maintain your subscriber list directly from Google Sheets. ๐ก Review the first few outputs manually before full automation. โ ๏ธ Common Mistakes โ Using unstructured prompts can lead to messy or irrelevant newsletters. โ Ignoring HTML cleanup may cause broken email layouts. โ Forgetting to update the email list can reduce deliverability. ๐ฎ Whatโs Next The next evolution of this workflow could include: โ Auto-posting newsletters on LinkedIn or Medium using n8n integrations. โ Summarizing newsletters into social media snippets. โ Adding analytics to track open rates and engagement. Automation like this paves the way for intelligent, continuous content delivery โ letting teams focus on creativity, not logistics. ๐ฏ Key Takeaways โ AI + n8n = Content Automation โ Gemini generates meaningful newsletters daily. โ Google Sheets keeps subscriber management simple โ Gmail ensures smooth, branded delivery
Top comments (0)