<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Tanush J</title>
    <description>The latest articles on Forem by Tanush J (@tanush_j_582df12547e80167).</description>
    <link>https://forem.com/tanush_j_582df12547e80167</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1874276%2Fcc53b77b-e5e1-4df8-9a24-818a0847672e.jpg</url>
      <title>Forem: Tanush J</title>
      <link>https://forem.com/tanush_j_582df12547e80167</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/tanush_j_582df12547e80167"/>
    <language>en</language>
    <item>
      <title>AI-powered News-to-Email Agent</title>
      <dc:creator>Tanush J</dc:creator>
      <pubDate>Sun, 31 Aug 2025 18:23:29 +0000</pubDate>
      <link>https://forem.com/tanush_j_582df12547e80167/ai-powered-news-to-email-agent-3h1d</link>
      <guid>https://forem.com/tanush_j_582df12547e80167/ai-powered-news-to-email-agent-3h1d</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/brightdata-n8n-2025-08-13"&gt;AI Agents Challenge powered by n8n and Bright Data&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;I built an AI-powered News-to-Email Agent that automatically:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fetches the latest news articles of specific categories you provide.&lt;/li&gt;
&lt;li&gt;Uses an LLM to generate a professional, table-based HTML email newsletter with multiple articles formatted for email clients like Gmail, Outlook, and Apple Mail.&lt;/li&gt;
&lt;li&gt;Sends the final email to subscribers with proper preheader text, article summaries, and "Read more" links.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This solves the problem of turning raw RSS/news data into a polished daily newsletter—without manual formatting.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://drive.google.com/file/d/10XdfrN5yv8OBFiPB0Ic9szwe8r58ob7c/view?usp=sharing" rel="noopener noreferrer"&gt;Demo Video&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  n8n Workflow
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://gist.github.com/Tanush-J/fbc3b91302baae51f38a97d113d374cd" rel="noopener noreferrer"&gt;Workflow Link&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Technical Implementation
&lt;/h2&gt;

&lt;p&gt;System Instructions: The system prompt was carefully crafted to enforce compatibility with email clients (table-based layout, inline CSS, no external assets). It also ensures each article is formatted consistently with title, source, summary, and link.&lt;/p&gt;

&lt;p&gt;Model Choice: "meta-llama/Llama-3.1-8B-Instruct" from HuggingFace Inference API, good for text-generation and is helpful for template generation&lt;/p&gt;

&lt;p&gt;Memory: Stateless, each workflow execution processes the latest batch of news articles.&lt;/p&gt;

&lt;p&gt;Tools Used:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bright Data Node (Google News Scraper) → get latest articles.&lt;/li&gt;
&lt;li&gt;HTTP Request Node → send articles + system prompt to Hugging Face API.&lt;/li&gt;
&lt;li&gt;Function Node → structure JSON payloads (e.g. { instruction, articles: [...] }).&lt;/li&gt;
&lt;li&gt;SMTP Email Node → deliver the final HTML newsletter.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Bright Data Verified Node
&lt;/h3&gt;

&lt;p&gt;I used the Bright Data Verified Node to fetch clean, reliable, and structured news data from various web sources. This ensured the agent always received up-to-date, accurate articles to include in the newsletter without scraping issues or inconsistent data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Journey
&lt;/h2&gt;

&lt;p&gt;This was my first time exploring n8n and building a workflow that integrates with LLMs. At the start, I had to learn how n8n handles data, especially:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Data cleaning and transformations: writing Function nodes to reshape and sanitize incoming JSON so that the model could consume it properly.&lt;/li&gt;
&lt;li&gt;Understanding data flow between nodes: getting used to how n8n passes input/output made me rethink how to structure each step in the pipeline.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One of the biggest challenges came when I tried to connect the Hugging Face Inference API using n8n’s basic LLM Chain node. The node always defaulted to a conversational mode, which wasn’t suitable for structured HTML generation. After multiple attempts, I switched to using the HTTP Request node to directly access Hugging Face’s text-generation models. While this approach worked, it also raised concerns about security (exposing API keys when sharing workflows).&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;This workflow works end-to-end, but there’s still room for improvement:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The AI model doesn’t always generate a perfect email template.&lt;/li&gt;
&lt;li&gt;Optimizations could reduce the running cost of the workflow.&lt;/li&gt;
&lt;li&gt;Exploring safer and more scalable ways to integrate Hugging Face APIs in n8n would make this even more robust.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>devchallenge</category>
      <category>n8nbrightdatachallenge</category>
      <category>ai</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
