Send AI stock risk alerts from Google Sheets with Twelve Data and Groq
Go to WorkflowDescription
Google Sheets + Twelve Data + Groq AI Stock Risk Alert Workflow
> Smart Stock Risk Alerts in Minutes
This workflow automatically reads your stock portfolio from Google Sheets, fetches real-time prices via API, calculates risk metrics (price drops and volatility) and sends AI-generated email alerts only when risks are detected. It helps you stay informed without being overwhelmed by unnecessary notifications.
Quick Implementation Steps
Connect your Google Sheets account and prepare your portfolio sheet.
Add your Twelve Data API key in the HTTP Request node.
Connect your Gmail account for sending alerts.
Configure thresholds in the Edit Fields – Config & Thresholds node.
Set up a Cron (Schedule Trigger) instead of manual execution.
Run the workflow and monitor alerts.
What It Does
This workflow automates stock portfolio monitoring by combining spreadsheet data, real-time market prices and AI-powered summaries. It reads your portfolio data from Google Sheets and processes each stock by fetching its current market price through an external API.
Once the data is enriched, the workflow calculates key risk indicators such as percentage price change and volatility. Based on predefined thresholds, it flags stocks that may require attention. Instead of sending raw data, it uses an AI model to generate a clean, human-readable summary.
The workflow ensures efficiency by sending alerts only when necessary, reducing noise and helping you focus on meaningful risks.
Who It's For
Retail investors tracking personal portfolios
Financial analysts monitoring stock risks
Traders who want automated alerts
Anyone using Google Sheets for stock tracking
Users looking to integrate AI into financial workflows
Requirements
To use this workflow, you need:
n8n account (self-hosted or cloud)
Google Sheets account** (OAuth2 connection required)
Gmail account** (OAuth2 connection required)
Twelve Data API key** (mandatory)
Groq API access** (for AI summary generation)
How It Works & Setup Guide
Step 1: Prepare Google Sheets
Use a sheet named: Portfolio
Range: A:E
Required columns (in order):
| Column | Field Name | Description |
|--------|-------------|-------------|
| A | symbol | Stock ticker (e.g., AAPL) |
| B | avg_price | Average purchase price |
| C | quantity | Number of shares |
| D | sector | Industry sector |
| E | notes | Optional notes |
Step 2: Connect Google Sheets
Open Read Portfolio from Google Sheets node
Authenticate using Google OAuth2
Ensure:
Sheet ID is correct
Range is set to Portfolio!A:E
Step 3: Configure API (MANDATORY)
⚠️ This is a required setup step. The workflow will NOT work without it.
Open Fetch Stock Prices node
Update URL:
Replace YOUR_API_KEY with your Twelve Data API key
Step 4: Configure Email Alerts (MANDATORY)
⚠️ You must configure the recipient email manually.
Open Send Risk Alert Notification node
Set:
sendTo → your email address
Subject is already set: Daily Stock Risk Alert
Step 5: Configure Thresholds
Open Edit Fields – Config & Thresholds node
Default values:
drop_threshold = -5 → triggers alert if price drops ≥ 5%
volatility_threshold = 3 → triggers alert if volatility ≥ 3%
Adjust these based on your risk tolerance.
Step 6: Enable Scheduling
The workflow is designed for scheduled execution.
Replace Manual Trigger with Cron Node
Example schedule:
Daily at 9 AM
Every hour during market hours
Step 7: Execute Workflow
Run once manually for testing
Activate workflow for automation
How It Works (Flow Summary)
Reads portfolio data from Google Sheets
Adds configuration thresholds
Loops through each stock
Fetches real-time prices (with delay to avoid rate limits)
Merges portfolio + price data
Computes:
Price change %
Volatility
Flags risky stocks
Filters only flagged items
Formats data into readable text
Uses AI (Groq model) to generate summary
Sends email alert
How To Customize Nodes
Edit Fields – Config & Thresholds**
Adjust sensitivity of alerts
Wait 8 Seconds Before request**
Modify delay based on API rate limits
Compute Risk Logic**
Add new conditions (e.g., stop-loss, sector-based alerts)
Generate Risk Summary**
Customize prompt for different tone or format
Send Risk Alert Notification**
Change subject or email structure
Add-ons (Extend This Workflow)
Add Slack/Telegram alerts instead of email
Store alerts in a database (PostgreSQL / Airtable)
Add historical tracking & charts
Integrate multiple APIs for redundancy
Add portfolio performance analytics dashboard
Enable multi-user alerts
Use Case Examples
Daily Portfolio Monitoring
Automatically receive alerts for risky stocks each day
Intraday Risk Tracking
Run hourly to track sudden market movements
High Volatility Detection
Identify stocks with unstable price behavior
Loss Prevention Alerts
Get notified when stocks drop beyond safe thresholds
Sector-Based Monitoring
Track risk exposure across industries
There can be many more use cases depending on how you customize thresholds and logic.
Troubleshooting Guide
| Issue | Possible Cause | Solution |
|------|--------------|----------|
| No data fetched from Google Sheets | Incorrect sheet ID or range | Verify Sheet ID and Portfolio!A:E |
| API not returning prices | Missing API key | Add apikey in HTTP Request node |
| Workflow stops unexpectedly | API rate limit | Increase wait time |
| No email received | sendTo field empty | Add recipient email |
| No alerts triggered | Thresholds too strict | Adjust drop/volatility values |
| AI summary not generated | Groq API issue | Check API credentials |
| Incorrect risk calculation | Data format issue | Ensure numeric values in sheet |
Need Help?
If you need assistance with:
Setting up this workflow
Customizing risk logic
Adding advanced features
Integrating additional APIs
Building similar automation workflows
We’re here to help!
👉 Contact our n8n developes at WeblineIndia for expert support in building scalable, AI-powered automation solutions tailored to your needs.