This workflow corresponds to n8n.io template #5305 — we link there as the canonical source.
This workflow follows the Agent → Gmail Tool recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"meta": {
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "e27afbc7-8cae-44b6-b506-474bb2692f08",
"name": "Wait",
"type": "n8n-nodes-base.wait",
"position": [
-640,
-300
],
"parameters": {
"amount": 20
},
"typeVersion": 1.1
},
{
"id": "2cc8d35f-f255-4adc-b1d7-7f9ab34dde66",
"name": "Get progress",
"type": "n8n-nodes-base.httpRequest",
"position": [
-1020,
-400
],
"parameters": {
"url": "=https://api.brightdata.com/datasets/v3/progress/{{ $json.snapshot_id }}",
"options": {},
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "Bearer YOUR_TOKEN_HERE"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "eb6ab86c-3e8b-4dc6-8d70-3346531905fa",
"name": "Switch",
"type": "n8n-nodes-base.switch",
"position": [
-840,
-400
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "ready",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "4712e222-2bad-4d91-be87-ab0e0693c0c6",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.status }}",
"rightValue": "ready"
}
]
},
"renameOutput": true
},
{
"outputKey": "running",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "9a473960-6ba5-4f1b-afc6-396348bd338d",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.status }}",
"rightValue": "=running"
}
]
},
"renameOutput": true
}
]
},
"options": {}
},
"typeVersion": 3.2
},
{
"id": "88b7e912-af0c-4527-baa3-4f8cf0b072d1",
"name": "Split Out",
"type": "n8n-nodes-base.splitOut",
"position": [
-1660,
-400
],
"parameters": {
"options": {},
"fieldToSplitOut": "json"
},
"typeVersion": 1
},
{
"id": "d0ee4823-0536-415e-8fa9-861c1701665d",
"name": "SAMPLE DATA",
"type": "n8n-nodes-base.set",
"position": [
-1860,
-400
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "8d1bd0c8-37bf-4028-a20c-ac214ec06d7b",
"name": "json",
"type": "array",
"value": "=[\n {\n \"ticker\": \"NVDA\",\n \"name\": \"NVIDIA Corporation\",\n \"market_cap\": \"\u2248 $3.6T\"\n },\n {\n \"ticker\": \"MSFT\",\n \"name\": \"Microsoft Corporation\",\n \"market_cap\": \"\u2248 $3.6T\"\n },\n {\n \"ticker\": \"AAPL\",\n \"name\": \"Apple Inc.\",\n \"market_cap\": \"\u2248 $3.0T\"\n },\n {\n \"ticker\": \"AMZN\",\n \"name\": \"Amazon.com Inc.\",\n \"market_cap\": \"\u2248 $2.2T\"\n },\n {\n \"ticker\": \"GOOGL\",\n \"name\": \"Alphabet Inc.\",\n \"market_cap\": \"\u2248 $1.9T\"\n },\n {\n \"ticker\": \"META\",\n \"name\": \"Meta Platforms Inc.\",\n \"market_cap\": \"\u2248 $1.5T\"\n },\n {\n \"ticker\": \"BRK.B\",\n \"name\": \"Berkshire Hathaway Inc.\",\n \"market_cap\": \"\u2248 $1.1T\"\n },\n {\n \"ticker\": \"TSLA\",\n \"name\": \"Tesla Inc.\",\n \"market_cap\": \"\u2248 $830B\"\n },\n {\n \"ticker\": \"UNH\",\n \"name\": \"UnitedHealth Group Inc.\",\n \"market_cap\": \"\u2248 $450B\"\n },\n {\n \"ticker\": \"JNJ\",\n \"name\": \"Johnson & Johnson\",\n \"market_cap\": \"\u2248 $450B\"\n }\n]\n"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "2aab292f-0287-4da6-86ee-83c5a9aee30a",
"name": "set keyword",
"type": "n8n-nodes-base.set",
"position": [
-1480,
-400
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "8d9e80d9-16dd-4658-928f-d94735209bfd",
"name": "keyword",
"type": "string",
"value": "={{ $json.ticker }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "13f81727-f586-4fb6-be73-4880c9efd165",
"name": "Financial times scraper",
"type": "n8n-nodes-base.httpRequest",
"position": [
-1260,
-400
],
"parameters": {
"url": "https://api.brightdata.com/datasets/v3/trigger",
"method": "POST",
"options": {},
"jsonBody": "={{ $('set keyword').all().map(item => item.json)}}",
"sendBody": true,
"sendQuery": true,
"sendHeaders": true,
"specifyBody": "json",
"queryParameters": {
"parameters": [
{
"name": "dataset_id",
"value": "gd_lmrpz3vxmz972ghd7"
},
{
"name": "include_errors",
"value": "true"
},
{
"name": "type",
"value": "discover_new"
},
{
"name": "discover_by",
"value": "keyword"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "=Bearer YOUR_TOKEN_HERE"
}
]
}
},
"executeOnce": true,
"typeVersion": 4.2
},
{
"id": "5e828381-8268-4114-b16c-a60c4ca23e80",
"name": "Get snapshot + data",
"type": "n8n-nodes-base.httpRequest",
"position": [
-620,
-480
],
"parameters": {
"url": "=https://api.brightdata.com/datasets/v3/snapshot/{{ $json.snapshot_id }}",
"options": {},
"sendQuery": true,
"sendHeaders": true,
"queryParameters": {
"parameters": [
{
"name": "format",
"value": "json"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "Bearer YOUR_TOKEN_HERE"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "4c2826ee-30bb-4438-a531-c370edbe2103",
"name": "Aggregate",
"type": "n8n-nodes-base.aggregate",
"position": [
-300,
-280
],
"parameters": {
"options": {},
"aggregate": "aggregateAllItemData"
},
"typeVersion": 1
},
{
"id": "9cd0f2fd-248b-4047-aeb3-1a548ad02514",
"name": "Google Sheets",
"type": "n8n-nodes-base.googleSheets",
"position": [
-320,
-620
],
"parameters": {
"columns": {
"value": {},
"schema": [],
"mappingMode": "autoMapInputData",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1I5CvpHlmDsIFOfnGg4DEtniem0oTiumWWzGs4CV6AuM/edit#gid=0",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1I5CvpHlmDsIFOfnGg4DEtniem0oTiumWWzGs4CV6AuM",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1I5CvpHlmDsIFOfnGg4DEtniem0oTiumWWzGs4CV6AuM/edit?usp=drivesdk",
"cachedResultName": "Stock Monitor"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.6
},
{
"id": "d9797a77-bdf3-4600-bcd7-21311bb405fd",
"name": "Google Gemini Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
0,
-260
],
"parameters": {
"options": {},
"modelName": "models/gemini-2.0-flash-lite"
},
"credentials": {
"googlePalmApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "ef5165a4-0452-4b20-b2fa-994429f3bc5b",
"name": "create summary",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
0,
-480
],
"parameters": {
"text": "=\n\n## \ud83d\udce4 SYSTEM PROMPT: Daily Stock Summary Email Generator (for n8n AI Agent)\n\n````markdown\n## \ud83c\udfaf ROLE\nYou are a financial summary agent integrated in an n8n workflow. Your role is to:\n- Analyze incoming JSON data of top 10 U.S. stocks.\n- Identify meaningful insights: trends, outliers, sentiment, sector behavior.\n- Format this into a **clear, styled HTML email body** for professional users.\n- Return the **HTML content only** \u2013 ready to send via n8n\u2019s email nodes.\n\n---\n\n## \ud83d\udce5 INPUT FORMAT (JSON)\n\nYou will receive daily JSON input structured like this:\n\n\nThe day and date today is {{ $now.format('cccc yyyy-MM-dd t ') }}\n\nHere is today\u2019s data: =\n\n```\n\n{{ $json.data.toJsonString() }}\n\n```\n\n---\n\n## \u2705 TASKS\n\n1. **Analyze market trends** based on price movements and sentiment.\n2. **Highlight top 2 gainers and losers**, including reasoning from news or change %.\n3. **Generate a stock table** (Ticker, Name, Price Change, Sentiment Icon).\n4. **Include 3\u20135 key takeaways**, insights, or investor watch notes.\n5. **Add upcoming events** if mentioned in news or based on date.\n6. Format everything as **HTML only**, ready for use in an email body.\n\n---\n\n## \u2728 OUTPUT FORMAT (HTML Only)\n\n* Include inline styles (no external CSS).\n* Use semantic structure:\n\n * `<h2>` for main title\n * `<ul>` for movers and insights\n * `<table>` for stock data\n* Use icons or colors for sentiment: \ud83d\udfe2 Positive, \ud83d\udfe1 Neutral, \ud83d\udd34 Negative\n* Footer: \u201cGenerated automatically by your AI-powered stock monitor\u201d\n\n---\n\n## \u26a0\ufe0f CONSTRAINTS\n\n* DO NOT include subject or email headers\n* DO NOT output plaintext explanations or markdown\n* Output **HTML only**, clean and professional\n\n---\n\n## \ud83d\udcec GOAL\n\nDeliver a polished, mobile-friendly, and insightful daily stock market summary email that can be sent directly by n8n. Final output should require zero manual edits.\n\n",
"options": {},
"promptType": "define"
},
"typeVersion": 2
},
{
"id": "cf744498-62bf-4e6a-8570-dda7fea35fe5",
"name": "Schedule Trigger",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-2140,
-400
],
"parameters": {
"rule": {
"interval": [
{}
]
}
},
"typeVersion": 1.2
},
{
"id": "d564ee93-181f-461b-8ace-2dcb26439b6c",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1940,
-600
],
"parameters": {
"color": 5,
"width": 220,
"height": 420,
"content": "## Add stock to track\n\nYou will add a list of the stocks you need to track here"
},
"typeVersion": 1
},
{
"id": "0c7e5d90-ce9e-456c-9f48-ba6872557467",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1680,
-600
],
"parameters": {
"color": 4,
"width": 340,
"height": 420,
"content": "## Split and set the field names\nThe field name MUST be keyword to match the bright data API"
},
"typeVersion": 1
},
{
"id": "64d932ee-f0b1-458a-a017-505676666c18",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1320,
-600
],
"parameters": {
"color": 2,
"height": 420,
"content": "## Financial Times scraper\nScrap the latest trends in our selected Stock. \n\nSet it to run once"
},
"typeVersion": 1
},
{
"id": "bb55cc08-f262-42c1-9951-00771689495a",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1040,
-680
],
"parameters": {
"color": 4,
"width": 620,
"height": 520,
"content": "## Check the status of the progress and Get results\n\nIf `running` we make it loop until done"
},
"typeVersion": 1
},
{
"id": "9bc67859-d0b7-4d48-84d3-d0b9c90e8ca5",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-700,
-560
],
"parameters": {
"color": 7,
"width": 260,
"height": 260,
"content": "## Get scraping results"
},
"typeVersion": 1
},
{
"id": "9627ec91-d2c4-4076-b39f-9f8be978177b",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-380,
-420
],
"parameters": {
"width": 280,
"height": 280,
"content": "## Aggregate results to pass to AI for our email summary"
},
"typeVersion": 1
},
{
"id": "e01b8ad5-e028-4c81-9162-b27ae75687a3",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-60,
-720
],
"parameters": {
"color": 3,
"width": 520,
"height": 600,
"content": "## Create Draft email and notify admin\n\n\n\nCreate an email summary and notify the user"
},
"typeVersion": 1
},
{
"id": "8a23ca78-36e5-4ce3-b81d-fa62d770aa36",
"name": "Sticky Note7",
"type": "n8n-nodes-base.stickyNote",
"position": [
-380,
-680
],
"parameters": {
"color": 6,
"width": 280,
"height": 240,
"content": "## Save results to G sheets"
},
"typeVersion": 1
},
{
"id": "3f953ffd-4faa-4cd5-bd3a-b3a6d021eebf",
"name": "Gmail1",
"type": "n8n-nodes-base.gmailTool",
"position": [
180,
-260
],
"parameters": {
"sendTo": "user@example.com",
"message": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', `A detailed summary of the stock performance today. Must Look good`, 'string') }}",
"options": {
"appendAttribution": false
},
"subject": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Subject', `Daily Stock report for {date today}`, 'string') }}"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
}
],
"connections": {
"Wait": {
"main": [
[
{
"node": "Get progress",
"type": "main",
"index": 0
}
]
]
},
"Gmail1": {
"ai_tool": [
[
{
"node": "create summary",
"type": "ai_tool",
"index": 0
}
]
]
},
"Switch": {
"main": [
[
{
"node": "Get snapshot + data",
"type": "main",
"index": 0
}
],
[
{
"node": "Wait",
"type": "main",
"index": 0
}
]
]
},
"Aggregate": {
"main": [
[
{
"node": "create summary",
"type": "main",
"index": 0
}
]
]
},
"Split Out": {
"main": [
[
{
"node": "set keyword",
"type": "main",
"index": 0
}
]
]
},
"SAMPLE DATA": {
"main": [
[
{
"node": "Split Out",
"type": "main",
"index": 0
}
]
]
},
"set keyword": {
"main": [
[
{
"node": "Financial times scraper",
"type": "main",
"index": 0
}
]
]
},
"Get progress": {
"main": [
[
{
"node": "Switch",
"type": "main",
"index": 0
}
]
]
},
"Google Sheets": {
"main": [
[]
]
},
"create summary": {
"main": [
[]
]
},
"Schedule Trigger": {
"main": [
[
{
"node": "SAMPLE DATA",
"type": "main",
"index": 0
}
]
]
},
"Get snapshot + data": {
"main": [
[
{
"node": "Google Sheets",
"type": "main",
"index": 0
},
{
"node": "Aggregate",
"type": "main",
"index": 0
}
]
]
},
"Financial times scraper": {
"main": [
[
{
"node": "Get progress",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "create summary",
"type": "ai_languageModel",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
gmailOAuth2googlePalmApigoogleSheetsOAuth2Api
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow makes it easier to keep track of the stocks market and get an email with a summary of the daily highlights on what happened, key insights and trends Define the schedule (days, times, intervals). Replace sample stock data with your desired stock list (ticker, name,…
Source: https://n8n.io/workflows/5305/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
The Multi-Model Agency Content Engine is a high-performance editorial system designed for agencies. It solves the "blank page" problem by alternating between real-world social proof and strategic expe
This workflow automates the complete blog publishing process. It removes manual work from content creation, image generation, category management, and WordPress publishing by using AI and n8n. It help
This project is an automated news publisher for LinkedIn. It uses RSS feeds to fetch news, processes the content with the Gemini API to generate precise summaries, and automatically publishes to Linke
This template is for clinics, hospitals, care teams, and telemedicine providers who need a structured, automated system for post-surgery follow-up. It helps reduce manual workload while ensuring every
This workflow is the AI analysis and alerting engine for a complete social media monitoring system. It's designed to work with data scraped from X (formerly Twitter) using a tool like the Apify Tweet