Showcase > Marketing & Outreach

AI-Powered Sustainability Newsletter

16-node n8n workflow using OpenAI, HTML scraping, and Gmail to auto-generate daily sustainability newsletters.

ShowcaseIntermediate5 min read

A 16-node automated newsletter system that scrapes, classifies, and delivers sustainability news without any human intervention. This workflow reads EU news sources, uses an AI classification pipeline to determine sustainability relevance, records the results, generates a formatted HTML email, and sends it via Gmail -- every single day, on schedule, without fail. It is the kind of "set it and forget it" automation that turns a one-time build into years of consistent value.

Nodes Category Complexity Key Integrations
16 Content Creation / Marketing Intermediate OpenAI, Google Sheets, Gmail

Prerequisites

  • OpenAI API key for AI classification and structured output parsing
  • Google Sheets OAuth2 credentials for classification data storage
  • Gmail OAuth2 credentials for newsletter delivery
  • Target news source URLs configured in the HTTP Request node (EU news sources or your preferred sources)
  • Knowledge level: Intermediate -- requires basic understanding of HTML scraping, AI classification, and scheduled workflows

Estimated Setup Time

25-35 minutes including news source URL configuration, OpenAI credential setup, Gmail configuration, and Google Sheets template creation.

What It Does

The workflow begins by scraping EU news sources via HTTP Request, then passes the raw HTML through extraction nodes that pull article titles, summaries, and links. Each article enters an AI classification pipeline where OpenAI evaluates it against sustainability criteria -- environmental impact, ESG relevance, regulatory significance, green technology, and climate policy.

Articles that pass the sustainability filter are recorded in Google Sheets with their classification metadata. The system then generates a formatted HTML email from the filtered articles, complete with section headers, article summaries, and source links. Gmail delivers the newsletter to the configured recipient list.

The dual parallel pipeline design is notable: article classification and newsletter generation run as coordinated but independent processes. This means the classification data is always saved to Google Sheets regardless of whether the email send succeeds, and the newsletter can be regenerated from stored data if needed.

Workflow Diagram

Workflow Diagram

Node Breakdown

Triggers

  • Schedule Trigger

Scraping & Extraction

  • HTTP Request
  • HTML Extract x2
  • Split Out

AI & Classification

  • AI Agent
  • OpenAI
  • Structured Output Parser

Logic & Data

  • IF
  • Loop
  • Google Sheets x2
  • Code

Delivery

  • Gmail

Step-by-Step Flow

  1. Daily Schedule Trigger -- The workflow fires at a configured time each morning, before the target audience starts their workday.

  2. News Scraping -- An HTTP Request node fetches content from configured EU news sources. HTML extraction nodes parse the raw response, pulling article titles, summaries, publication dates, and source URLs.

  3. Article Splitting -- The Split Out node separates the extracted articles into individual items, enabling the loop to process each article independently through the classification pipeline.

  4. AI Classification Loop -- Each article passes through the AI Agent with a structured output parser. OpenAI evaluates the article against sustainability criteria and returns a structured classification: relevance score, primary sustainability category (environmental, social, governance), key themes, and a brief analysis note.

  5. Relevance Filtering -- The IF node evaluates each classification. Articles that meet the relevance threshold continue to the newsletter. Articles that fall below the threshold are logged to Google Sheets for reference but excluded from the email.

  6. Data Recording -- Every classified article -- whether it passed the filter or not -- is appended to Google Sheets with its full classification metadata. This creates a growing database of sustainability news intelligence.

  7. Newsletter Generation -- A Code node assembles the filtered articles into a formatted HTML email. Articles are grouped by sustainability category, each with its summary, source link, and relevance score. The HTML template is designed for readability across email clients.

  8. Gmail Delivery -- The completed newsletter is sent via Gmail to the configured recipient list. Delivery confirmation is logged.

What Sets It Apart

HTML scraping plus AI classification pipeline. The combination of traditional web scraping with AI-powered content classification creates a system that is both reliable and intelligent. Scraping handles the predictable structure of news sites; AI handles the unpredictable judgment of what qualifies as "sustainability relevant."

Dual parallel pipeline. Classification data is always stored to Google Sheets regardless of email delivery status. This decoupled design means a Gmail outage does not lose your classification work, and the newsletter can be rebuilt from stored data at any time.

Fully automated daily newsletter. Once configured, this workflow requires zero ongoing maintenance. It scrapes, classifies, filters, formats, and delivers -- every day, without intervention. The only human involvement is reading the newsletter.

Cost Considerations

  • OpenAI: Classification of 20-50 articles per day costs ~$0.05-0.20 depending on article length and model tier
  • Google Sheets: Free with Google account
  • Gmail: Free with Google account (daily send limits apply: 500/day for personal, 2,000/day for Workspace)
  • No external scraping service fees -- uses direct HTTP requests to public news sources
  • Estimated daily cost: Under $0.25 for a typical daily newsletter run

Ideal For

  • Marketing teams maintaining thought leadership in sustainability topics
  • ESG and sustainability consultants staying current with regulatory developments
  • Non-profits tracking environmental policy changes and news
  • Corporate communications teams building internal sustainability awareness

Tip: Key Techniques

Structured Output for Classification -- Using a Structured Output Parser with explicit category definitions ensures consistent classification across all articles. Define your categories precisely in the parser schema -- vague categories produce inconsistent results.

HTML Extraction before AI -- Scrape and structure the raw data before sending it to the AI. Feeding raw HTML to an LLM wastes tokens and produces worse results than feeding clean, extracted text. Let HTML nodes handle structure; let AI handle judgment.

Decoupled Storage and Delivery -- Always store your processed data before attempting delivery. If Gmail fails, your classification work is preserved. If you need to resend, the data is ready. This pattern applies to any workflow where processing is expensive and delivery is unreliable.

Download

The workflow.json file in this folder can be imported directly into your n8n instance via Settings > Import Workflow.

Want this running in your stack?

I build production n8n and Cloudflare automation for teams — the same engineering behind HarperFlow. Fixed-price, escrow-protected, US-based.