Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Finfluencer-Instagram-Script-Automation

An n8n workflow that automatically reads this week's Mint finance articles, ranks them using Gemini AI, and emails 3 ready-to-use Instagram video scripts every Monday morning.

Built for Indian personal finance content creators and finfluencers.


What It Does

Every Monday at 8am IST, the workflow:

  1. Pulls articles from 4 Mint RSS feeds (markets, money, economy, companies)
  2. Filters to the last 7 days and matches finance keywords
  3. Scores each article 1-10 using Gemini AI based on virality potential for the creator's audience
  4. Generates 3 Instagram video scripts in the creator's exact writing style
  5. Emails all 3 scripts with article links and scores for easy selection

The email also includes a ranked table of every article evaluated that week so the creator can see the AI's reasoning.


Ranking Logic

Articles are scored based on topic fit for an Indian personal finance audience:

Topic Base Score
Macro (RBI, inflation, GDP, geopolitics) 7
Investment principles (behavioural finance, allocation) 6
Mutual funds (SIP, fund selection, MF tax) 5
Off-topic 1

Bonus points for: surprising angle (+1), concrete data (+1), broad relatability (+1) Penalty for: stock-specific content (-3), too niche (-1), generic advice (-1)


Stack

Component Tool
Workflow orchestration n8n (self-hosted)
Hosting Railway (free plan)
AI model Gemini 2.5 Flash-Lite
RSS parsing n8n native RSS Feed Read node
Email delivery Gmail via OAuth

Setup

Prerequisites

  • n8n instance running (Railway, self-hosted, or n8n cloud)
  • Gemini API key from aistudio.google.com (free)
  • Gmail account connected via OAuth in n8n credentials

Steps

  1. Import workflow.json into your n8n instance

    • New workflow > three-dot menu > Import from file
  2. In the Filter & Rank node, replace:

    YOUR_GEMINI_API_KEY_HERE
    

    with your actual Gemini API key

  3. In the Generate Script node, replace:

    YOUR_GEMINI_API_KEY_HERE
    

    with your actual Gemini API key

  4. In the Generate Script node, replace the placeholder style examples in the prompt with real posts from your creator. The more examples you add, the better the style matching.

  5. In the Send Email node, replace:

    YOUR_RECIPIENT_EMAIL@gmail.com
    

    with the destination email address

  6. Connect your Gmail account in n8n Credentials (Gmail OAuth2)

  7. Set the Generate Script node mode to Run Once for Each Item

  8. Click Execute Workflow to test


Customisation

Change the send time: Edit the cron expression in the Schedule Trigger node. Format: MM HH * * 1 where HH is UTC hour. IST is UTC+5:30, so 8am IST = 2:30am UTC = 30 2 * * 1

Add or remove RSS feeds: Edit the feeds array in the Build Feed URLs node.

Add or remove keywords: Edit the KEYWORDS array at the top of the Filter & Rank node.

Change number of scripts: Edit the top3 slice in Filter & Rank (ranked.slice(0, 3)) and update the Format Email node accordingly.

Add more recipients: Comma-separate email addresses in the Send Email node's sendTo field.


Important Technical Notes

These are hard-won lessons from building this workflow:

  • fetch is not available in n8n code node sandbox. Use this.helpers.httpRequest() instead.
  • $env is blocked on n8n community plan. Use $vars (paid) or hardcode values directly.
  • Use the native RSS Feed Read node, not HTTP Request + manual XML parsing. The native node handles all XML edge cases reliably.
  • Generate Script node must be set to "Run Once for Each Item" mode, not the default "Run Once for All Items".
  • Generate Script returns a single object return { json: {...} } not an array return [{ json: {...} }] when in per-item mode.
  • Gemini thinking mode must be OFF: set thinkingConfig: { thinkingBudget: 0 } in every Gemini API call. Without this, parts[0] contains internal reasoning instead of the answer, producing blank or broken output.

Workflow Structure

Schedule Trigger (Monday 8am IST)
    ↓
Build Feed URLs (4 Mint RSS feeds)
    ↓
Read RSS Feeds (native n8n RSS node, runs 4x)
    ↓
Filter & Rank (keyword filter + Gemini scoring, returns top 3)
    ↓
Generate Script (Gemini script generation, runs 3x)
    ↓
Combine Scripts (Aggregate node, merges 3 items)
    ↓
Format Email (builds HTML email)
    ↓
Send Email (Gmail OAuth)

Built By

Jatin Dinesh linkedin.com/in/jatindinesh

About

Every Monday 8am IST, automatically pulls Mint finance articles, ranks them using Gemini AI, generates 3 Instagram video scripts in the client's writing style, and emails them.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors