📊 Breaking news aggregator with SendGrid and PostgreSQL

⚡ 165 views · 📊 Market Research & Insights

💡 Pro Tip — HTTP Request scraping tends to break when sites update their markup. If you’re scraping a major platform, check if ScraperNode covers it — it has maintained scrapers for LinkedIn, Instagram, TikTok, YouTube, and 20+ other platforms that return structured data.

View All Scrapers

Description

Breaking News Aggregator with SendGrid and PostgreSQL

⚠️ COMMUNITY TEMPLATE DISCLAIMER: This is a community-contributed template that uses ScrapeGraphAI (a community node). Please ensure you have the ScrapeGraphAI community node installed in your n8n instance before using this template.

This workflow automatically scrapes multiple government and regulatory websites, extracts the latest policy or compliance-related news, stores the data in PostgreSQL, and instantly emails daily summaries to your team through SendGrid. It is ideal for compliance professionals and industry analysts who need near real-time awareness of regulatory changes impacting their sector.

Pre-conditions/Requirements

Prerequisites

Required Credentials

Specific Setup Requirements

ResourceRequirementExample Value
PostgreSQLTable with columns: id, title, url, source, published_atnews_updates
Allowed HostsOutbound HTTPS access from n8n to target sites & SendGrid endpointhttps://*.gov, https://api.sendgrid.com
Keywords ListComma-separated compliance terms to filter resultsGDPR, AML, cybersecurity

How it works

This workflow automatically scrapes multiple government and regulatory websites, extracts the latest policy or compliance-related news, stores the data in PostgreSQL, and instantly emails daily summaries to your team through SendGrid. It is ideal for compliance professionals and industry analysts who need near real-time awareness of regulatory changes impacting their sector.

Key Steps:

Set up steps

Setup Time: 15-20 minutes

  1. Install ScrapeGraphAI Node:
    • From n8n, go to “Settings → Community Nodes → Install”, search “ScrapeGraphAI”, and install.
  2. Create PostgreSQL Table:
    CREATE TABLE news_updates (
      id SERIAL PRIMARY KEY,
      title TEXT,
      url TEXT UNIQUE,
      source TEXT,
      published_at TIMESTAMP
    );
  3. Add Credentials:
    • Navigate to “Credentials”, add ScrapeGraphAI, SendGrid, and PostgreSQL credentials.
  4. Import Workflow:
    • Copy the JSON workflow, paste into “Import from Clipboard”.
  5. Configure Environment Variables (optional):
    • REG_NEWS_KEYWORDS, SEND_TO_EMAILS, DB_TABLE_NAME.
  6. Set Schedule:
    • Open the Schedule Trigger node and define your preferred cron expression.
  7. Activate Workflow:
    • Toggle “Active”, then click “Execute Workflow” once to validate all connections.

Node Descriptions

Core Workflow Nodes:

Data Flow:

  1. Schedule Trigger → ScrapeGraphAI → Code → SplitInBatches → If → PostgreSQL → Set → SendGrid

Customization Examples

Change Keyword Filtering

// Code Node snippet
const keywords = ['GDPR','AML','SOX']; // Add or remove terms
item.filtered = keywords.some(k => item.title.includes(k));
return item;

Switch to Weekly Digest

{
  "trigger": {
    "cronExpression": "0 9 * * 1" // Every Monday at 09:00
  }
}

Data Output Format

The workflow outputs structured JSON data:

{
  "title": "Data Privacy Act Amendment Passed",
  "url": "https://regulator.gov/news/1234",
  "source": "regulator.gov",
  "published_at": "2024-06-12T14:30:00Z"
}

Troubleshooting

Common Issues

  1. ScrapeGraphAI node not found – Install the community node and restart n8n.
  2. Duplicate key error in PostgreSQL – Ensure the url column is marked UNIQUE to prevent duplicates.
  3. Emails not sending – Verify SendGrid API key and check account’s daily limit.

Performance Tips

Pro Tips:

đź”— Nodes Used

Postgres, SendGrid, Schedule Trigger

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup