{
  "id": "TwMXdhHUE109LX6tGivwL",
  "meta": {
    "site": "https://github.com/zengfr/n8n-workflow-all-templates",
    "name": "Generate AI market research reports from NewsAPI and competitor sites to Notion, Sheets and Slack",
    "wechat": "youandme10086",
    "id": 12581,
    "update_time": "2026-02-13"
  },
  "name": "Generate market research reports from news and competitor sites to Notion and Slack",
  "tags": [
    {
      "id": "NbjqMEpKspdxDuZw",
      "name": "AI\u5206\u6790",
      "createdAt": "2026-01-08T00:45:33.090Z",
      "updatedAt": "2026-01-08T00:45:33.090Z"
    },
    {
      "id": "enoTdKtDgzhqWINj",
      "name": "\u5e02\u5834\u30ea\u30b5\u30fc\u30c1",
      "createdAt": "2026-01-08T00:45:33.159Z",
      "updatedAt": "2026-01-08T00:45:33.159Z"
    },
    {
      "id": "jlhq2nWZH3kuZT1V",
      "name": "\u81ea\u52d5\u5316",
      "createdAt": "2026-01-08T00:45:33.131Z",
      "updatedAt": "2026-01-08T00:45:33.131Z"
    }
  ],
  "nodes": [
    {
      "id": "37c68439-80ab-43f2-96fa-f0e3d1fbca27",
      "name": "Error Trigger",
      "type": "n8n-nodes-base.errorTrigger",
      "position": [
        928,
        -800
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "7425fba1-9fc8-49b3-bdd8-5862126b1af5",
      "name": "Main Overview1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1648,
        -1840
      ],
      "parameters": {
        "width": 520,
        "height": 548,
        "content": "## \ud83d\udcca Generate market research reports from news and competitor sites to Notion and Slack\n\n### How it works\nThis workflow automates market and competitive intelligence. It triggers on a schedule to gather industry news via NewsAPI and scrapes data from specified competitor websites. The collected data is merged and processed by OpenAI's GPT-4o to generate a SWOT analysis, market trends, and actionable insights. The final report is archived in Notion and Google Sheets, with a notification sent to Slack.\n\n### Setup steps\n1. **Credentials:** Configure API keys for NewsAPI, OpenAI, Notion, Google Sheets, and Slack.\n2. **Configuration:** Update the 'Research Configuration' node with your specific keywords and competitor URLs.\n3. **Destination:** Create a Notion page and a Google Sheet (with headers: Date, Title, Summary, Tokens) and map their IDs in the respective nodes.\n4. **Test:** Run the workflow to verify the AI analysis and data export functionality."
      },
      "typeVersion": 1
    },
    {
      "id": "fa465f81-ed01-43dc-9394-2df0a1dcf08a",
      "name": "Section ",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -896,
        -1536
      ],
      "parameters": {
        "color": 7,
        "width": 492,
        "height": 336,
        "content": "## 1. Config & Triggers\nSets the schedule and defines search keywords or competitor URLs."
      },
      "typeVersion": 1
    },
    {
      "id": "51100b42-2a10-4a1b-b045-0353d455305d",
      "name": "Section 6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -288,
        -1536
      ],
      "parameters": {
        "color": 7,
        "width": 524,
        "height": 592,
        "content": "## 2. Data Collection\nFetches latest industry news and scrapes competitor site content simultaneously."
      },
      "typeVersion": 1
    },
    {
      "id": "d69f3c56-2d39-448c-9b9c-d3e9c7a54936",
      "name": "Section 7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        -1424
      ],
      "parameters": {
        "color": 7,
        "width": 840,
        "height": 368,
        "content": "## 3. AI Intelligence Layer\nConsolidates raw data, prepares the analysis prompt, and runs the GPT-4o model."
      },
      "typeVersion": 1
    },
    {
      "id": "1a61e1e2-312b-47e1-8142-cfcbb0133a34",
      "name": "Section 8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1200,
        -1520
      ],
      "parameters": {
        "color": 7,
        "width": 640,
        "height": 576,
        "content": "## 4. Multi-Channel Export\nSaves the structured report to Notion/Sheets and alerts the team via Slack."
      },
      "typeVersion": 1
    },
    {
      "id": "66a475b4-f622-4b75-a195-dc3a0236690e",
      "name": "Section 9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        880,
        -912
      ],
      "parameters": {
        "color": 7,
        "width": 540,
        "height": 272,
        "content": "## 5. Error Monitoring\nCatches any API failures and sends an immediate alert to the admin Slack channel."
      },
      "typeVersion": 1
    },
    {
      "id": "8b0da5b7-8ba0-4572-984b-b0bb58debf34",
      "name": "Schedule Trigger1",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -848,
        -1424
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 9
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "8ceba372-f262-4e73-81f8-73ca9e46dfe1",
      "name": "Research Configuration1",
      "type": "n8n-nodes-base.code",
      "position": [
        -528,
        -1424
      ],
      "parameters": {
        "jsCode": "// Define research keywords and competitor URLs\nconst researchConfig = {\n  keywords: [\n    \"AI Marketing Trends 2025\",\n    \"Marketing Automation Innovations\",\n    \"Digital Transformation Case Studies\"\n  ],\n  competitors: [\n    \"https://www.example-competitor1.com\",\n    \"https://www.example-competitor2.com\"\n  ],\n  industry: \"Marketing Technology\",\n  region: \"Global\",\n  timestamp: new Date().toISOString()\n};\n\nreturn [\n  {\n    json: researchConfig\n  }\n];"
      },
      "typeVersion": 2
    },
    {
      "id": "3c095fe2-18ca-4a42-8175-10b5d6245899",
      "name": "Fetch News Data1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -208,
        -1424
      ],
      "parameters": {
        "url": "https://newsapi.org/v2/everything",
        "options": {},
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpQueryAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "q",
              "value": "={{ $json.keywords[0] }}"
            },
            {
              "name": "language",
              "value": "en"
            },
            {
              "name": "sortBy",
              "value": "publishedAt"
            },
            {
              "name": "pageSize",
              "value": "20"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "1da16642-afd5-4e49-9c78-0e378c72e4c8",
      "name": "Scrape Competitor Site1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -208,
        -1136
      ],
      "parameters": {
        "url": "={{ $json.competitors[0] }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "0f406a22-0c9c-4c23-87f3-7aaf93496ce3",
      "name": "Merge Data1",
      "type": "n8n-nodes-base.merge",
      "position": [
        128,
        -1280
      ],
      "parameters": {
        "mode": "combine",
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "1f5aef77-6b7b-4d17-af22-fb2ed34ff3b6",
      "name": "Prepare AI Analysis Prompt1",
      "type": "n8n-nodes-base.code",
      "position": [
        448,
        -1280
      ],
      "parameters": {
        "jsCode": "// Prepare prompt for AI analysis\nconst newsData = $input.all()[0].json;\nconst competitorData = $input.all()[1].json;\n\n// Extract relevant text from news articles\nconst newsArticles = newsData.articles ? \n  newsData.articles.slice(0, 10).map(article => ({\n    title: article.title,\n    description: article.description,\n    content: article.content ? article.content.substring(0, 500) : '',\n    source: article.source?.name || 'Unknown',\n    publishedAt: article.publishedAt\n  })) : [];\n\n// Generate analysis prompt\nconst analysisPrompt = `\nPerform a market analysis for the \"${newsData.industry || 'Marketing Technology'}\" industry based on the following data.\n\n## Collected News (Top 10)\n${newsArticles.map((article, i) => \n  `### Article ${i+1}: ${article.title}\\n` +\n  `Source: ${article.source} | Date: ${article.publishedAt}\\n` +\n  `Summary: ${article.description || article.content}\\n`\n).join('\\n')}\n\n## Instructions\nPlease create a comprehensive market analysis report in Markdown format including:\n\n### 1. SWOT Analysis\n- Strengths, Weaknesses, Opportunities, and Threats (3 points each).\n\n### 2. Market Trends\n- Top 5 trends with their significance.\n\n### 3. Competitor Movements\n- Key observations from current players.\n\n### 4. Action Plan\n- 3 concrete actions for the next 30 days.\n\n### 5. Executive Summary\n- A concise summary under 300 characters.\n`;\n\nreturn [{\n  json: {\n    prompt: analysisPrompt,\n    newsArticles: newsArticles,\n    timestamp: new Date().toISOString(),\n    industry: newsData.industry || 'Marketing Technology'\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "99bc11e7-5bba-4c53-b1b6-1fd06a435435",
      "name": "Execute OpenAI Analysis1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        688,
        -1280
      ],
      "parameters": {
        "url": "https://api.openai.com/v1/chat/completions",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"gpt-4o\",\n  \"messages\": [\n    {\n      \"role\": \"system\",\n      \"content\": \"You are an expert market analyst. Provide detailed, actionable reports based on the provided data.\"\n    },\n    {\n      \"role\": \"user\",\n      \"content\": {{ $json.prompt | quote }}\n    }\n  ],\n  \"temperature\": 0.7,\n  \"max_tokens\": 4000\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "e31ef046-2f5c-457d-8ed4-0fbc57712ca7",
      "name": "Structure Analysis Results1",
      "type": "n8n-nodes-base.code",
      "position": [
        1008,
        -1280
      ],
      "parameters": {
        "jsCode": "// Structure the AI response for downstream nodes\nconst aiResponse = $input.first().json;\nconst analysisText = aiResponse.choices?.[0]?.message?.content || '';\n\nif (!analysisText) {\n  throw new Error('AI analysis result is empty. Check API response.');\n}\n\nconst result = {\n  fullReport: analysisText,\n  timestamp: new Date().toISOString(),\n  metadata: {\n    model: aiResponse.model || 'gpt-4o',\n    tokensUsed: aiResponse.usage?.total_tokens || 0\n  },\n  executiveSummary: analysisText.match(/### 5\\. Executive Summary[\\s\\S]*?\\n([^#]+)/)?.[1]?.trim() || \n                    analysisText.substring(0, 300) + '...',\n  reportTitle: `Market Analysis Report - ${new Date().toLocaleDateString('en-US')}`,\n  generatedAt: new Date().toLocaleString('en-US', { timeZone: 'UTC' })\n};\n\nreturn [{\n  json: result\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "3fe0e2e1-b66c-47e0-b873-e6f8deea40b5",
      "name": "Save Report to Notion1",
      "type": "n8n-nodes-base.notion",
      "position": [
        1328,
        -1392
      ],
      "parameters": {
        "title": "={{ $json.reportTitle }}",
        "pageId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "blockUi": {
          "blockValues": [
            {
              "type": "richText"
            }
          ]
        },
        "options": {
          "icon": {
            "type": "emoji",
            "emoji": "\ud83d\udcca"
          }
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "4d445021-ba67-4550-bc42-303b948f7402",
      "name": "Log Data to Google Sheets1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1328,
        -1152
      ],
      "parameters": {
        "columns": {
          "value": {
            "Date": "={{ $json.generatedAt }}",
            "Summary": "={{ $json.executiveSummary }}",
            "Tokens Used": "={{ $json.metadata.tokensUsed }}",
            "Report Title": "={{ $json.reportTitle }}"
          },
          "mappingMode": "defineBelow"
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "Market Analysis Log"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "9cc8ce74-93fe-4751-9fb6-130142ac8d69",
      "name": "Slack Completion Notification1",
      "type": "n8n-nodes-base.slack",
      "position": [
        1648,
        -1280
      ],
      "parameters": {
        "text": ":chart_with_upwards_trend: **Market Analysis Report Completed**\n\nA new market analysis report has been generated.\n\n**Title**: {{ $json.reportTitle }}\n**Generated At**: {{ $json.generatedAt }}\n\n**Executive Summary**:\n{{ $json.executiveSummary }}\n\n:point_right: Full report is available in Notion.\n:bar_chart: Data log has been updated in Google Sheets.",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "otherOptions": {}
      },
      "typeVersion": 2.2
    },
    {
      "id": "11c8adbd-a781-45f7-92a0-e89f69948eec",
      "name": "Slack Error Notification1",
      "type": "n8n-nodes-base.slack",
      "position": [
        1184,
        -800
      ],
      "parameters": {
        "text": ":warning: **Workflow Error Detected**\n\nThe workflow \"AI Market Research Agent\" encountered an error.\n\n**Error Message**:\n```\n{{ $json.error.message }}\n```\n\n**Node**: {{ $json.error.node }}\n**Time**: {{ $now.toISO() }}\n\nPlease check the execution logs for details.",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "otherOptions": {}
      },
      "typeVersion": 2.2
    }
  ],
  "active": false,
  "settings": {
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "0b0a603d-7130-4756-a2c9-08c75377a177",
  "connections": {
    "Merge Data1": {
      "main": [
        [
          {
            "node": "Prepare AI Analysis Prompt1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Error Trigger": {
      "main": [
        [
          {
            "node": "Slack Error Notification1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch News Data1": {
      "main": [
        [
          {
            "node": "Merge Data1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger1": {
      "main": [
        [
          {
            "node": "Research Configuration1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Report to Notion1": {
      "main": [
        [
          {
            "node": "Slack Completion Notification1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Research Configuration1": {
      "main": [
        [
          {
            "node": "Fetch News Data1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Scrape Competitor Site1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scrape Competitor Site1": {
      "main": [
        [
          {
            "node": "Merge Data1",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Execute OpenAI Analysis1": {
      "main": [
        [
          {
            "node": "Structure Analysis Results1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log Data to Google Sheets1": {
      "main": [
        [
          {
            "node": "Slack Completion Notification1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare AI Analysis Prompt1": {
      "main": [
        [
          {
            "node": "Execute OpenAI Analysis1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structure Analysis Results1": {
      "main": [
        [
          {
            "node": "Save Report to Notion1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Log Data to Google Sheets1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}