N
n8n Store
Workflow Market
Stock Market Daily Digest with Bright Data Scraping & Gemini AI Email Reports

Stock Market Daily Digest with Bright Data Scraping & Gemini AI Email Reports

by imperolq0 views

Description

Categories

🤖 AI & Machine Learning

Nodes Used

n8n-nodes-base.setn8n-nodes-base.setn8n-nodes-base.waitn8n-nodes-base.switchn8n-nodes-base.splitOutn8n-nodes-base.aggregaten8n-nodes-base.gmailTooln8n-nodes-base.stickyNoten8n-nodes-base.stickyNoten8n-nodes-base.stickyNote
PriceFree
Views0
Last Updated11/28/2025
workflow.json
{
  "meta": {
    "instanceId": "db80165df40cb07c0377167c050b3f9ab0b0fb04f0e8cae0dc53f5a8527103ca",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "e27afbc7-8cae-44b6-b506-474bb2692f08",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        -640,
        -300
      ],
      "webhookId": "cf27222d-20db-4ba5-bd4c-e6ca05efd4d7",
      "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_BRIGHTDATA_API_KEY"
            }
          ]
        }
      },
      "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\": \"≈ $3.6T\"\n  },\n  {\n    \"ticker\": \"MSFT\",\n    \"name\": \"Microsoft Corporation\",\n    \"market_cap\": \"≈ $3.6T\"\n  },\n  {\n    \"ticker\": \"AAPL\",\n    \"name\": \"Apple Inc.\",\n    \"market_cap\": \"≈ $3.0T\"\n  },\n  {\n    \"ticker\": \"AMZN\",\n    \"name\": \"Amazon.com Inc.\",\n    \"market_cap\": \"≈ $2.2T\"\n  },\n  {\n    \"ticker\": \"GOOGL\",\n    \"name\": \"Alphabet Inc.\",\n    \"market_cap\": \"≈ $1.9T\"\n  },\n  {\n    \"ticker\": \"META\",\n    \"name\": \"Meta Platforms Inc.\",\n    \"market_cap\": \"≈ $1.5T\"\n  },\n  {\n    \"ticker\": \"BRK.B\",\n    \"name\": \"Berkshire Hathaway Inc.\",\n    \"market_cap\": \"≈ $1.1T\"\n  },\n  {\n    \"ticker\": \"TSLA\",\n    \"name\": \"Tesla Inc.\",\n    \"market_cap\": \"≈ $830B\"\n  },\n  {\n    \"ticker\": \"UNH\",\n    \"name\": \"UnitedHealth Group Inc.\",\n    \"market_cap\": \"≈ $450B\"\n  },\n  {\n    \"ticker\": \"JNJ\",\n    \"name\": \"Johnson & Johnson\",\n    \"market_cap\": \"≈ $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_BRIGHTDATA_API_KEY"
            }
          ]
        }
      },
      "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_BRIGHTDATA_API_KEY"
            }
          ]
        }
      },
      "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": {
          "id": "ZAI2a6Qt80kX5a9s",
          "name": "Google Sheets account✅ "
        }
      },
      "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": {
          "id": "Xp5T9q3YYxBIw2nd",
          "name": "Google Gemini(PaLM) Api account✅"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ef5165a4-0452-4b20-b2fa-994429f3bc5b",
      "name": "create summary",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        0,
        -480
      ],
      "parameters": {
        "text": "=\n\n## 📤 SYSTEM PROMPT: Daily Stock Summary Email Generator (for n8n AI Agent)\n\n````markdown\n## 🎯 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** – ready to send via n8n’s email nodes.\n\n---\n\n## 📥 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’s data: =\n\n```\n\n{{ $json.data.toJsonString() }}\n\n```\n\n---\n\n## ✅ 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–5 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## ✨ 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: 🟢 Positive, 🟡 Neutral, 🔴 Negative\n* Footer: “Generated automatically by your AI-powered stock monitor”\n\n---\n\n## ⚠️ 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## 📬 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
      ],
      "webhookId": "fe4a416a-43f3-4ad1-80c8-51f1de4c2343",
      "parameters": {
        "sendTo": "[email protected]",
        "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": {
          "id": "8PS0qVYNzZvoWNA7",
          "name": "phoenix✅"
        }
      },
      "typeVersion": 2.1
    }
  ],
  "pinData": {
    "Financial times scraper": [
      {
        "snapshot_id": "s_mcbvdqgz1avn39assa"
      },
      {
        "snapshot_id": "s_mcbvdqht249242mqlq"
      },
      {
        "snapshot_id": "s_mcbvdqg4px7h201w9"
      },
      {
        "snapshot_id": "s_mcbvdqh4ci8ij15d1"
      },
      {
        "snapshot_id": "s_mcbvdqgs12legdw0a2"
      },
      {
        "snapshot_id": "s_mcbvdqhpqyr6tf8q"
      },
      {
        "snapshot_id": "s_mcbvdqgu1ti5q0ginr"
      },
      {
        "snapshot_id": "s_mcbvdqi21uyjc3tefw"
      },
      {
        "snapshot_id": "s_mcbvdqgzp73zxysyr"
      },
      {
        "snapshot_id": "s_mcbvdqgi2f3l95krzm"
      }
    ]
  },
  "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
          }
        ]
      ]
    }
  }
}

相关工作流