This workflow corresponds to n8n.io template #13805 — we link there as the canonical source.
This workflow follows the Google Sheets → HTTP Request 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 →
{
"id": "SWkrv0TTpQ62xQ4p",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "n8n OpenCWL AI \u2014 Business Research & Report Generator",
"tags": [],
"nodes": [
{
"id": "94991161-c848-47e3-9753-93976526625f",
"name": "Main Overview",
"type": "n8n-nodes-base.stickyNote",
"position": [
-16,
-160
],
"parameters": {
"width": 980,
"height": 2288,
"content": "# n8n OpenCWL AI Workflow\n## Automatically Research, Analyze & Generate Smart Business Reports\n\n---\n\n### Description\nThis workflow is a fully automated AI-powered business intelligence agent. It accepts a research topic or company name via webhook, autonomously collects data from multiple live sources (web search, news feeds, financial APIs), runs a multi-stage Claude AI analysis pipeline, and delivers a structured professional business report \u2014 all without human intervention.\n\n---\n\n### What's the Goal?\nTo eliminate the hours analysts spend manually gathering data, switching between tools, and writing reports. This workflow does it all in under 3 minutes:\n- Collects live market and competitor data\n- Pulls recent news and sentiment signals\n- Runs deep AI analysis across all sources\n- Generates a structured executive report with SWOT, risks, and opportunities\n- Delivers the final report via email and saves to Google Drive\n\n---\n\n### Why Does It Matter?\nManual business research is slow, inconsistent, and expensive. This workflow:\n- Saves 4-8 hours of analyst time per report\n- Produces consistent, structured outputs every time\n- Runs on a schedule or on-demand via API\n- Scales to any number of topics or companies\n- Integrates directly into your CRM, Slack, or email\n- Generates billable deliverables for consulting agencies\n\n---\n\n### How It Works\nStage 1 \u2014 INTAKE\nWebhook receives a research request. Set node normalizes all inputs and stores credentials. IF node validates the request has a valid topic.\n\nStage 2 \u2014 DATA COLLECTION (parallel)\nThree HTTP Request nodes run simultaneously:\n- Serper.dev fetches top 10 Google results for the topic\n- NewsAPI pulls the latest 10 news articles from the past 7 days\n- Alpha Vantage fetches financial/market data if a ticker is provided\n\nStage 3 \u2014 DATA PROCESSING\nCode node merges and cleans all collected data. Extracts headlines, snippets, URLs, publication dates, sentiment signals, and key figures into a structured context object ready for AI analysis.\n\nStage 4 \u2014 AI ANALYSIS (3-pass Claude pipeline)\nPass 1 \u2014 Research Synthesis: Claude reads all raw data and extracts key facts, trends, and signals\nPass 2 \u2014 Strategic Analysis: Claude performs SWOT analysis, identifies risks and opportunities\nPass 3 \u2014 Report Generation: Claude writes the final structured executive report in Markdown\n\nStage 5 \u2014 OUTPUT & DELIVERY\nReport is saved to Google Drive as a document. Summary is posted to Slack. Full report is emailed via SendGrid. All metadata is logged to Google Sheets. Webhook returns JSON response.\n\n---\n\n### Configuration Requirements\n- ANTHROPIC_API_KEY \u2014 Claude AI (claude-sonnet-4-20250514)\n- SERPER_API_KEY \u2014 Google Search results (serper.dev, free tier available)\n- NEWSAPI_KEY \u2014 News articles (newsapi.org, free tier available)\n- ALPHA_VANTAGE_KEY \u2014 Financial data (alphavantage.co, free tier available)\n- SENDGRID_API_KEY \u2014 Email delivery\n- SLACK_WEBHOOK_URL \u2014 Slack notifications\n- GOOGLE_DRIVE_FOLDER_ID \u2014 Where to save reports\n- GOOGLE_SHEET_ID \u2014 Report audit log\n\n---\n\n### Setup Guide\nStep 1: Import this workflow into your n8n instance\nStep 2: Open the Set Credentials node and replace all placeholder values with your real API keys\nStep 3: Set your GOOGLE_SHEET_ID in the Log to Sheets node\nStep 4: Set your GOOGLE_DRIVE_FOLDER_ID in the Save to Drive node\nStep 5: Configure your Slack webhook URL in the Notify Slack node\nStep 6: Activate the workflow or trigger manually via POST\n\n### Sample Request\nPOST /webhook/business-report\n{\n \"topic\": \"OpenAI market position 2025\",\n \"company\": \"OpenAI\",\n \"ticker\": \"\",\n \"industry\": \"Artificial Intelligence\",\n \"reportType\": \"competitive_analysis\",\n \"recipientEmail\": \"analyst@yourcompany.com\",\n \"urgency\": \"standard\"\n}\n\n### Report Types Supported\n- competitive_analysis\n- market_research\n- industry_overview\n- company_profile\n- investment_brief"
},
"typeVersion": 1
},
{
"id": "359f8aa7-8eb8-4538-a918-14253ba0de5d",
"name": "Stage 1 Label",
"type": "n8n-nodes-base.stickyNote",
"position": [
1072,
624
],
"parameters": {
"color": 5,
"width": 560,
"height": 484,
"content": "## Stage 1 \u2014 Request Intake & Validation\n\nWebhook accepts POST with topic, company, ticker, industry, and report type. Set node stores all API keys and normalizes input fields. IF node checks the topic is not empty \u2014 if invalid it returns a 400 error immediately, preventing wasted API calls downstream."
},
"typeVersion": 1
},
{
"id": "8ae3f05f-1114-4ee5-98a1-92868817b105",
"name": "Stage 2 Label",
"type": "n8n-nodes-base.stickyNote",
"position": [
1664,
240
],
"parameters": {
"color": 3,
"width": 244,
"height": 1076,
"content": "## Stage 2 \u2014 Parallel Data Collection\n\nAll three HTTP Request nodes fire in parallel from the Validate Input node. Serper returns top 10 organic Google results. NewsAPI returns latest 10 articles from past 7 days. Alpha Vantage returns company overview and key financial metrics. All use continueOnFail so a missing API key never breaks the flow."
},
"typeVersion": 1
},
{
"id": "afb09da8-c83c-4cdb-826a-b8d65f01b3dc",
"name": "Stage 3 Label",
"type": "n8n-nodes-base.stickyNote",
"position": [
1952,
192
],
"parameters": {
"color": 6,
"width": 182,
"height": 788,
"content": "## Stage 3 \u2014 Data Merge & Processing\n\nPulls results from all three collection nodes. Extracts and structures: top search results with titles/snippets/URLs, news articles with dates and sources, financial metrics and company overview. Builds a clean context object passed to the AI pipeline."
},
"typeVersion": 1
},
{
"id": "b352c114-4ee7-4e5d-901c-a25cc6c7dbbe",
"name": "Stage 4 Label",
"type": "n8n-nodes-base.stickyNote",
"position": [
2176,
432
],
"parameters": {
"color": 4,
"width": 1060,
"height": 564,
"content": "## Stage 4 \u2014 3-Pass Claude AI Analysis Pipeline\n\nPass 1 reads all raw data and extracts key facts, market trends, competitive signals, and sentiment. Pass 2 takes Pass 1 output and performs deep SWOT analysis with risk scoring. Pass 3 takes both previous outputs and writes the final structured executive report in clean Markdown. Each pass builds on the previous \u2014 output quality increases with each stage."
},
"typeVersion": 1
},
{
"id": "ba9be337-d395-42f1-8669-8e290da12313",
"name": "Stage 5 Label",
"type": "n8n-nodes-base.stickyNote",
"position": [
3296,
368
],
"parameters": {
"color": 3,
"width": 880,
"height": 980,
"content": "## Stage 5 \u2014 Multi-Channel Delivery & Logging\n\nAll four output nodes run in parallel. Google Drive saves the Markdown report as a file. Slack posts an executive summary with key metrics. SendGrid emails the full report to the recipient. Google Sheets logs all metadata for audit trail. Final webhook response returns JSON with report preview and all delivery statuses."
},
"typeVersion": 1
},
{
"id": "32750ee8-9409-4814-b104-143e5b8fa096",
"name": "Receive Research Request",
"type": "n8n-nodes-base.webhook",
"position": [
1088,
880
],
"parameters": {
"path": "business-report",
"options": {},
"httpMethod": "POST",
"responseMode": "responseNode"
},
"typeVersion": 2
},
{
"id": "72569d52-0a95-4c67-893f-7e361c157681",
"name": "Set Credentials and Config",
"type": "n8n-nodes-base.set",
"position": [
1312,
880
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "c1",
"name": "topic",
"type": "string",
"value": "={{ $json.body.topic || $json.topic || '' }}"
},
{
"id": "c2",
"name": "company",
"type": "string",
"value": "={{ $json.body.company || $json.company || '' }}"
},
{
"id": "c3",
"name": "ticker",
"type": "string",
"value": "={{ $json.body.ticker || $json.ticker || '' }}"
},
{
"id": "c4",
"name": "industry",
"type": "string",
"value": "={{ $json.body.industry || $json.industry || 'Technology' }}"
},
{
"id": "c5",
"name": "reportType",
"type": "string",
"value": "={{ $json.body.reportType || $json.reportType || 'competitive_analysis' }}"
},
{
"id": "c6",
"name": "recipientEmail",
"type": "string",
"value": "={{ $json.body.recipientEmail || $json.recipientEmail || '' }}"
},
{
"id": "c7",
"name": "reportId",
"type": "string",
"value": "={{ 'RPT-' + Date.now() }}"
},
{
"id": "c8",
"name": "requestedAt",
"type": "string",
"value": "={{ new Date().toISOString() }}"
},
{
"id": "c9",
"name": "ANTHROPIC_KEY",
"type": "string",
"value": "YOUR_ANTHROPIC_API_KEY"
},
{
"id": "c10",
"name": "SERPER_KEY",
"type": "string",
"value": "YOUR_SERPER_API_KEY"
},
{
"id": "c11",
"name": "NEWSAPI_KEY",
"type": "string",
"value": "YOUR_NEWSAPI_KEY"
},
{
"id": "c12",
"name": "ALPHAV_KEY",
"type": "string",
"value": "YOUR_ALPHAVANTAGE_KEY"
},
{
"id": "c13",
"name": "SENDGRID_KEY",
"type": "string",
"value": "YOUR_SENDGRID_API_KEY"
},
{
"id": "c14",
"name": "SLACK_WEBHOOK",
"type": "string",
"value": "YOUR_SLACK_WEBHOOK_URL"
},
{
"id": "c15",
"name": "DRIVE_FOLDER_ID",
"type": "string",
"value": "YOUR_GOOGLE_DRIVE_FOLDER_ID"
},
{
"id": "c16",
"name": "SHEET_ID",
"type": "string",
"value": "YOUR_GOOGLE_SHEET_ID"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "abc548ae-842d-4d13-bc75-2a2264aa0e80",
"name": "Validate Input",
"type": "n8n-nodes-base.if",
"position": [
1536,
880
],
"parameters": {
"options": {},
"conditions": {
"options": {
"leftValue": "",
"caseSensitive": false,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"operator": {
"type": "string",
"operation": "notEmpty",
"singleValue": true
},
"leftValue": "={{ $json.topic }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "39f061a5-3f17-4037-8b92-f2169005c249",
"name": "Return Validation Error",
"type": "n8n-nodes-base.respondToWebhook",
"position": [
1760,
976
],
"parameters": {
"options": {
"responseCode": 400
},
"respondWith": "json",
"responseBody": "={ \"success\": false, \"error\": \"Missing required field: topic\" }"
},
"typeVersion": 1.1
},
{
"id": "69656398-2487-4063-8ed5-c5849a89e3a1",
"name": "Search Google via Serper",
"type": "n8n-nodes-base.httpRequest",
"position": [
1760,
592
],
"parameters": {
"url": "https://google.serper.dev/search",
"method": "POST",
"options": {},
"jsonBody": "={{ JSON.stringify({ q: $json.topic + ' ' + $json.company + ' 2025', num: 10, gl: 'us', hl: 'en' }) }}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"headerParameters": {
"parameters": [
{
"name": "X-API-KEY",
"value": "={{ $json.SERPER_KEY }}"
},
{
"name": "Content-Type",
"value": "application/json"
}
]
}
},
"typeVersion": 4.2,
"continueOnFail": true
},
{
"id": "1f40338c-a4c4-489c-9a2e-ecf67c00f984",
"name": "Fetch News Articles",
"type": "n8n-nodes-base.httpRequest",
"position": [
1760,
784
],
"parameters": {
"url": "https://newsapi.org/v2/everything",
"options": {},
"sendQuery": true,
"sendHeaders": true,
"queryParameters": {
"parameters": [
{
"name": "q",
"value": "={{ $('Set Credentials and Config').first().json.topic }}"
},
{
"name": "language",
"value": "en"
},
{
"name": "sortBy",
"value": "publishedAt"
},
{
"name": "pageSize",
"value": "10"
},
{
"name": "from",
"value": "={{ new Date(Date.now()-7*24*60*60*1000).toISOString().split('T')[0] }}"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "X-Api-Key",
"value": "={{ $('Set Credentials and Config').first().json.NEWSAPI_KEY }}"
}
]
}
},
"typeVersion": 4.2,
"continueOnFail": true
},
{
"id": "63ce8b8c-cccf-4e92-a9cb-e588036a134e",
"name": "Fetch Market Data",
"type": "n8n-nodes-base.httpRequest",
"position": [
1760,
1168
],
"parameters": {
"url": "https://www.alphavantage.co/query",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "function",
"value": "OVERVIEW"
},
{
"name": "symbol",
"value": "={{ $('Set Credentials and Config').first().json.ticker || 'IBM' }}"
},
{
"name": "apikey",
"value": "={{ $('Set Credentials and Config').first().json.ALPHAV_KEY }}"
}
]
}
},
"typeVersion": 4.2,
"continueOnFail": true
},
{
"id": "bd083614-2bfd-40d6-8c48-d3bb82b4b2af",
"name": "Merge and Clean Data",
"type": "n8n-nodes-base.code",
"position": [
1984,
784
],
"parameters": {
"jsCode": "\nvar cfg = $('Set Credentials and Config').first().json;\nvar serp = $('Search Google via Serper').first().json;\nvar news = $('Fetch News Articles').first().json;\nvar market = $('Fetch Market Data').first().json;\n\n// --- Web search results ---\nvar searchResults = [];\ntry {\n (serp.organic || []).slice(0, 8).forEach(function(r) {\n searchResults.push({\n title: r.title || '',\n snippet: r.snippet || '',\n url: r.link || '',\n source: (r.link || '').replace(/https?:\\/\\/(www\\.)?/,'').split('/')[0]\n });\n });\n} catch(e) { searchResults = [{ title:'Search unavailable', snippet:'', url:'', source:'' }]; }\n\n// --- News articles ---\nvar newsArticles = [];\ntry {\n ((news.articles) || []).slice(0, 8).forEach(function(a) {\n newsArticles.push({\n title: a.title || '',\n description: a.description || '',\n source: (a.source && a.source.name) ? a.source.name : '',\n publishedAt: a.publishedAt || '',\n url: a.url || ''\n });\n });\n} catch(e) { newsArticles = [{ title:'News unavailable', description:'', source:'', publishedAt:'', url:'' }]; }\n\n// --- Financial / market data ---\nvar financialData = {};\ntry {\n if (market && market.Symbol) {\n financialData = {\n symbol: market.Symbol || '',\n name: market.Name || '',\n sector: market.Sector || '',\n industry: market.Industry || '',\n marketCap: market.MarketCapitalization || '',\n peRatio: market.PERatio || '',\n eps: market.EPS || '',\n revenue: market.RevenueTTM || '',\n profitMargin: market.ProfitMargin || '',\n week52High: market['52WeekHigh'] || '',\n week52Low: market['52WeekLow'] || '',\n description: (market.Description || '').substring(0, 600)\n };\n } else {\n financialData = { note: 'No ticker provided or financial data unavailable' };\n }\n} catch(e) { financialData = { note: 'Financial data parse error' }; }\n\n// --- Build context summary for AI ---\nvar searchContext = searchResults.map(function(r, i) {\n return (i+1) + '. ' + r.title + '\\n ' + r.snippet + '\\n Source: ' + r.source;\n}).join('\\n\\n');\n\nvar newsContext = newsArticles.map(function(a, i) {\n return (i+1) + '. [' + a.source + '] ' + a.title + ' (' + (a.publishedAt||'').substring(0,10) + ')\\n ' + a.description;\n}).join('\\n\\n');\n\nvar financialContext = JSON.stringify(financialData, null, 2);\n\nreturn [{ json: {\n reportId: cfg.reportId,\n topic: cfg.topic,\n company: cfg.company,\n ticker: cfg.ticker,\n industry: cfg.industry,\n reportType: cfg.reportType,\n recipientEmail: cfg.recipientEmail,\n requestedAt: cfg.requestedAt,\n ANTHROPIC_KEY: cfg.ANTHROPIC_KEY,\n SENDGRID_KEY: cfg.SENDGRID_KEY,\n SLACK_WEBHOOK: cfg.SLACK_WEBHOOK,\n DRIVE_FOLDER_ID: cfg.DRIVE_FOLDER_ID,\n SHEET_ID: cfg.SHEET_ID,\n searchResults: searchResults,\n newsArticles: newsArticles,\n financialData: financialData,\n searchContext: searchContext,\n newsContext: newsContext,\n financialContext: financialContext,\n totalSources: searchResults.length + newsArticles.length,\n dataCollectedAt: new Date().toISOString()\n}}];\n"
},
"typeVersion": 2
},
{
"id": "e2f434e1-ee59-4ecd-99b5-5b1b8f67fd3a",
"name": "Claude Pass 1 Research Synthesis",
"type": "n8n-nodes-base.httpRequest",
"position": [
2208,
784
],
"parameters": {
"url": "https://api.anthropic.com/v1/messages",
"method": "POST",
"options": {},
"jsonBody": "={{ JSON.stringify({ model: \"claude-sonnet-4-20250514\", max_tokens: 2000, system: \"You are a senior business intelligence analyst with expertise in market research, competitive analysis, and strategic consulting. Extract and synthesize key insights from raw data. Be specific, factual, and cite sources.\", messages: [{ role: \"user\", content: \"You are analyzing: \" + $json.topic + \"\\nCompany: \" + ($json.company || \"N/A\") + \"\\nIndustry: \" + $json.industry + \"\\nReport Type: \" + $json.reportType + \"\\n\\n=== WEB SEARCH RESULTS ===\\n\" + $json.searchContext + \"\\n\\n=== LATEST NEWS (past 7 days) ===\\n\" + $json.newsContext + \"\\n\\n=== FINANCIAL DATA ===\\n\" + $json.financialContext + \"\\n\\nYour task - Research Synthesis Pass:\\n1. KEY FACTS: List 8-10 most important verified facts from the data\\n2. MARKET TRENDS: Identify 4-5 significant trends affecting this topic\\n3. COMPETITIVE SIGNALS: Note any competitor mentions or market positioning clues\\n4. SENTIMENT ANALYSIS: Assess overall market/news sentiment (Positive/Neutral/Negative) with evidence\\n5. DATA GAPS: Note what important information is missing\\n6. CONFIDENCE LEVEL: Rate your confidence in this analysis (High/Medium/Low) with reason\\n\\nBe concise and data-driven. No fluff.\" }] }) }}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"headerParameters": {
"parameters": [
{
"name": "x-api-key",
"value": "={{ $json.ANTHROPIC_KEY }}"
},
{
"name": "anthropic-version",
"value": "2023-06-01"
},
{
"name": "content-type",
"value": "application/json"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "c92ca88d-e433-472f-8b75-3d218acea6e3",
"name": "Extract Pass 1 Output",
"type": "n8n-nodes-base.code",
"position": [
2432,
784
],
"parameters": {
"jsCode": "\nvar raw = $('Claude Pass 1 Research Synthesis').first().json;\nvar prev = $('Merge and Clean Data').first().json;\n\nvar pass1Text = '';\ntry {\n if (raw.content && Array.isArray(raw.content)) {\n pass1Text = raw.content.map(function(b){ return b.text || ''; }).join('\\n');\n } else {\n pass1Text = JSON.stringify(raw);\n }\n} catch(e) { pass1Text = 'Pass 1 error: ' + e.message; }\n\nvar result = JSON.parse(JSON.stringify(prev));\nresult.pass1Output = pass1Text;\nresult.pass1Tokens = (raw.usage && raw.usage.output_tokens) ? raw.usage.output_tokens : 0;\nresult.pass1CompletedAt = new Date().toISOString();\nreturn [{ json: result }];\n"
},
"typeVersion": 2
},
{
"id": "33b855af-bf11-44a6-8444-e3c08b8bbd21",
"name": "Claude Pass 2 Strategic SWOT",
"type": "n8n-nodes-base.httpRequest",
"position": [
2864,
784
],
"parameters": {
"url": "https://api.anthropic.com/v1/messages",
"method": "POST",
"options": {},
"jsonBody": "={{ JSON.stringify({ model: \"claude-sonnet-4-20250514\", max_tokens: 2000, system: \"You are a strategic management consultant with expertise in SWOT analysis, competitive strategy, and risk assessment. Build on prior research to deliver actionable strategic insights.\", messages: [{ role: \"user\", content: \"Topic: \" + $json.topic + \"\\nCompany: \" + ($json.company || \"N/A\") + \"\\nIndustry: \" + $json.industry + \"\\n\\n=== RESEARCH SYNTHESIS (Pass 1 Output) ===\\n\" + $json.pass1Output + \"\\n\\nYour task - Strategic Analysis Pass:\\n\\nSWOT ANALYSIS:\\nStrengths (3-4 points with evidence):\\nWeaknesses (3-4 points with evidence):\\nOpportunities (3-4 points with market data):\\nThreats (3-4 points with risk level: High/Medium/Low):\\n\\nRISK MATRIX:\\nList top 5 risks. For each: Risk Name | Probability (H/M/L) | Impact (H/M/L) | Mitigation Strategy\\n\\nSTRATEGIC OPPORTUNITIES:\\nTop 3 specific, actionable opportunities with estimated value or impact\\n\\nCOMPETITIVE POSITION:\\nRate market position: Leader / Challenger / Follower / Niche\\nKey differentiators and vulnerabilities\\n\\nOVERALL STRATEGIC SCORE: X/10 with 2-sentence justification\" }] }) }}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"headerParameters": {
"parameters": [
{
"name": "x-api-key",
"value": "={{ $json.ANTHROPIC_KEY }}"
},
{
"name": "anthropic-version",
"value": "2023-06-01"
},
{
"name": "content-type",
"value": "application/json"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "3bc64c52-b1bd-412d-ba89-78f27f2d97ae",
"name": "Extract Pass 2 Output",
"type": "n8n-nodes-base.code",
"position": [
3088,
784
],
"parameters": {
"jsCode": "\nvar raw = $('Claude Pass 2 Strategic SWOT').first().json;\nvar prev = $('Extract Pass 1 Output').first().json;\n\nvar pass2Text = '';\ntry {\n if (raw.content && Array.isArray(raw.content)) {\n pass2Text = raw.content.map(function(b){ return b.text || ''; }).join('\\n');\n } else {\n pass2Text = JSON.stringify(raw);\n }\n} catch(e) { pass2Text = 'Pass 2 error: ' + e.message; }\n\nvar result = JSON.parse(JSON.stringify(prev));\nresult.pass2Output = pass2Text;\nresult.pass2Tokens = (raw.usage && raw.usage.output_tokens) ? raw.usage.output_tokens : 0;\nresult.pass2CompletedAt = new Date().toISOString();\nreturn [{ json: result }];\n"
},
"typeVersion": 2
},
{
"id": "16641beb-333a-4b89-9166-13b2c30aad88",
"name": "Claude Pass 3 Write Final Report",
"type": "n8n-nodes-base.httpRequest",
"position": [
3312,
784
],
"parameters": {
"url": "https://api.anthropic.com/v1/messages",
"method": "POST",
"options": {},
"jsonBody": "={{ JSON.stringify({ model: \"claude-sonnet-4-20250514\", max_tokens: 4000, system: \"You are a senior business report writer at a top-tier consulting firm (McKinsey/BCG level). Write clear, authoritative, well-structured business reports in Markdown. Every claim must be grounded in the provided research. Use professional language. No filler sentences.\", messages: [{ role: \"user\", content: \"Write a complete professional business report.\\n\\nTOPIC: \" + $json.topic + \"\\nCOMPANY: \" + ($json.company || \"N/A\") + \"\\nINDUSTRY: \" + $json.industry + \"\\nREPORT TYPE: \" + $json.reportType + \"\\nDATE: \" + new Date().toLocaleDateString(\"en-US\", {year:\"numeric\",month:\"long\",day:\"numeric\"}) + \"\\nREPORT ID: \" + $json.reportId + \"\\n\\n=== RESEARCH DATA (Pass 1) ===\\n\" + $json.pass1Output + \"\\n\\n=== STRATEGIC ANALYSIS (Pass 2) ===\\n\" + $json.pass2Output + \"\\n\\nWrite the full report in this exact Markdown structure:\\n\\n# [Report Title]\\n**Report ID:** [id] | **Date:** [date] | **Type:** [type]\\n\\n---\\n\\n## Executive Summary\\n[3-4 sentence high-impact summary. Lead with the most important finding.]\\n\\n## 1. Market Overview\\n[Market size, growth rate, key dynamics \u2014 3-4 paragraphs]\\n\\n## 2. Key Findings\\n[6-8 numbered findings, each 2-3 sentences with supporting data]\\n\\n## 3. Competitive Landscape\\n[Market positioning, key players, competitive dynamics]\\n\\n## 4. SWOT Analysis\\n### Strengths\\n[bulleted list]\\n### Weaknesses\\n[bulleted list]\\n### Opportunities\\n[bulleted list]\\n### Threats\\n[bulleted list]\\n\\n## 5. Risk Assessment\\n[Risk matrix from analysis \u2014 format as table]\\n\\n## 6. Strategic Recommendations\\n[3-5 specific, actionable recommendations with priority levels]\\n\\n## 7. Outlook & Forecast\\n[12-month and 3-year outlook]\\n\\n## 8. Data Sources\\n[List the sources used]\\n\\n---\\n*Report generated by AI Research Agent | \" + new Date().toISOString() + \"*\\n\\nEND_REPORT_TITLE: [write the exact report title here on this line]\\nEND_REPORT_SUMMARY: [write the executive summary in 2 sentences here on this line]\\nEND_REPORT_SCORE: [write a number 1-100 representing overall research quality]\" }] }) }}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"headerParameters": {
"parameters": [
{
"name": "x-api-key",
"value": "={{ $json.ANTHROPIC_KEY }}"
},
{
"name": "anthropic-version",
"value": "2023-06-01"
},
{
"name": "content-type",
"value": "application/json"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "82ba316a-8c36-40fb-964e-ef169379ced3",
"name": "Format Final Report Package",
"type": "n8n-nodes-base.code",
"position": [
3536,
784
],
"parameters": {
"jsCode": "\nvar raw = $('Claude Pass 3 Write Final Report').first().json;\nvar prev = $('Extract Pass 2 Output').first().json;\n\nvar reportMarkdown = '';\ntry {\n if (raw.content && Array.isArray(raw.content)) {\n reportMarkdown = raw.content.map(function(b){ return b.text || ''; }).join('\\n');\n } else {\n reportMarkdown = JSON.stringify(raw);\n }\n} catch(e) { reportMarkdown = 'Report generation error: ' + e.message; }\n\n// Extract metadata lines\nvar reportTitle = prev.topic + ' \u2014 Business Report';\nvar reportSummary = '';\nvar reportScore = 80;\ntry {\n var titleMatch = reportMarkdown.match(/END_REPORT_TITLE:\\s*(.+)/);\n if (titleMatch) reportTitle = titleMatch[1].trim();\n var summaryMatch = reportMarkdown.match(/END_REPORT_SUMMARY:\\s*(.+)/);\n if (summaryMatch) reportSummary = summaryMatch[1].trim();\n var scoreMatch = reportMarkdown.match(/END_REPORT_SCORE:\\s*(\\d+)/);\n if (scoreMatch) reportScore = parseInt(scoreMatch[1]);\n} catch(e) {}\n\n// Strip the trailing metadata lines from the body\nvar cleanReport = reportMarkdown\n .replace(/END_REPORT_TITLE:.+/g, '')\n .replace(/END_REPORT_SUMMARY:.+/g, '')\n .replace(/END_REPORT_SCORE:.+/g, '')\n .trim();\n\nvar totalTokens = (prev.pass1Tokens || 0) + (prev.pass2Tokens || 0) + ((raw.usage && raw.usage.output_tokens) ? raw.usage.output_tokens : 0);\n\nvar result = JSON.parse(JSON.stringify(prev));\nresult.reportMarkdown = cleanReport;\nresult.reportTitle = reportTitle;\nresult.reportSummary = reportSummary;\nresult.reportScore = reportScore;\nresult.totalTokens = totalTokens;\nresult.totalSources = prev.totalSources || 0;\nresult.completedAt = new Date().toISOString();\nresult.reportPreview = cleanReport.substring(0, 800);\n\nreturn [{ json: result }];\n"
},
"typeVersion": 2
},
{
"id": "93198fc0-4fa0-4eda-af3e-96442329ca7f",
"name": "Save Report to Google Drive",
"type": "n8n-nodes-base.httpRequest",
"position": [
3760,
592
],
"parameters": {
"url": "https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart",
"body": "={{ '--boundary123\\r\\nContent-Type: application/json\\r\\n\\r\\n' + JSON.stringify({ name: $json.reportId + '-' + $json.topic.substring(0,40).replace(/[^a-z0-9]/gi,'-') + '.md', parents: [$json.DRIVE_FOLDER_ID], mimeType: 'text/markdown' }) + '\\r\\n--boundary123\\r\\nContent-Type: text/markdown\\r\\n\\r\\n' + $json.reportMarkdown + '\\r\\n--boundary123--' }}",
"method": "POST",
"options": {},
"sendBody": true,
"sendHeaders": true,
"specifyBody": "string",
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "Bearer YOUR_TOKEN_HERE"
},
{
"name": "Content-Type",
"value": "multipart/related; boundary=boundary123"
}
]
}
},
"typeVersion": 4.2,
"continueOnFail": true
},
{
"id": "f0475039-82f5-43d9-8b1c-de945a9c16bd",
"name": "Post Summary to Slack",
"type": "n8n-nodes-base.httpRequest",
"position": [
3760,
784
],
"parameters": {
"url": "={{ $json.SLACK_WEBHOOK }}",
"method": "POST",
"options": {},
"jsonBody": "={{ JSON.stringify({ text: \":bar_chart: *New Business Report Ready*\", blocks: [{ type: \"header\", text: { type: \"plain_text\", text: \"Business Report: \" + $json.topic } }, { type: \"section\", fields: [{ type: \"mrkdwn\", text: \"*Report ID:*\\n\" + $json.reportId }, { type: \"mrkdwn\", text: \"*Type:*\\n\" + $json.reportType }, { type: \"mrkdwn\", text: \"*Industry:*\\n\" + $json.industry }, { type: \"mrkdwn\", text: \"*Research Score:*\\n\" + $json.reportScore + \"/100\" }, { type: \"mrkdwn\", text: \"*Sources Used:*\\n\" + $json.totalSources }, { type: \"mrkdwn\", text: \"*AI Tokens Used:*\\n\" + $json.totalTokens }] }, { type: \"section\", text: { type: \"mrkdwn\", text: \"*Executive Summary*\\n\" + ($json.reportSummary || \"Report generated successfully.\") } }, { type: \"divider\" }, { type: \"context\", elements: [{ type: \"mrkdwn\", text: \"Generated at \" + $json.completedAt + \" by n8n OpenCWL AI Agent\" }] }] }) }}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
}
},
"typeVersion": 4.2,
"continueOnFail": true
},
{
"id": "9c44c599-faff-490b-b3e1-515f61f27812",
"name": "Email Full Report via SendGrid",
"type": "n8n-nodes-base.httpRequest",
"position": [
3760,
976
],
"parameters": {
"url": "https://api.sendgrid.com/v3/mail/send",
"method": "POST",
"options": {},
"jsonBody": "={{ JSON.stringify({ personalizations: [{ to: [{ email: $json.recipientEmail || \"analyst@yourcompany.com\" }] }], from: { email: \"reports@youragency.com\", name: \"AI Research Agent\" }, subject: \"[\" + $json.reportId + \"] \" + $json.reportTitle, content: [{ type: \"text/plain\", value: $json.reportMarkdown }] }) }}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "={{ 'Bearer ' + $json.SENDGRID_KEY }}"
},
{
"name": "Content-Type",
"value": "application/json"
}
]
}
},
"typeVersion": 4.2,
"continueOnFail": true
},
{
"id": "3248fbea-4d66-401f-8fc1-8acc98fd061b",
"name": "Log to Google Sheets",
"type": "n8n-nodes-base.googleSheets",
"position": [
3760,
1168
],
"parameters": {
"columns": {
"value": {},
"schema": [],
"mappingMode": "autoMapInputData",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "name",
"value": "Report Log"
},
"documentId": {
"__rl": true,
"mode": "id",
"value": "={{ $json.SHEET_ID }}"
},
"authentication": "serviceAccount"
},
"credentials": {
"googleApi": {
"name": "<your credential>"
}
},
"typeVersion": 4.5,
"continueOnFail": true
},
{
"id": "3b730031-9bf9-4532-bf94-404a00b1652e",
"name": "Return Report Response",
"type": "n8n-nodes-base.respondToWebhook",
"position": [
3984,
784
],
"parameters": {
"options": {
"responseCode": 200
},
"respondWith": "json",
"responseBody": "={{ JSON.stringify({ success: true, reportId: $json.reportId, reportTitle: $json.reportTitle, reportType: $json.reportType, topic: $json.topic, company: $json.company, industry: $json.industry, researchScore: $json.reportScore, totalSources: $json.totalSources, totalTokens: $json.totalTokens, executiveSummary: $json.reportSummary, reportPreview: $json.reportPreview, completedAt: $json.completedAt, deliveryChannels: [\"google_drive\", \"slack\", \"email\", \"google_sheets\"] }) }}"
},
"typeVersion": 1.1
},
{
"id": "79a6a4f4-2760-4152-9fa1-bf261c55a6a2",
"name": "Wait For Process",
"type": "n8n-nodes-base.wait",
"position": [
2640,
784
],
"parameters": {},
"typeVersion": 1.1
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "a644739e-1957-4d24-aedc-f88851ca51c5",
"connections": {
"Validate Input": {
"main": [
[
{
"node": "Search Google via Serper",
"type": "main",
"index": 0
},
{
"node": "Fetch News Articles",
"type": "main",
"index": 0
},
{
"node": "Fetch Market Data",
"type": "main",
"index": 0
}
],
[
{
"node": "Return Validation Error",
"type": "main",
"index": 0
}
]
]
},
"Wait For Process": {
"main": [
[
{
"node": "Claude Pass 2 Strategic SWOT",
"type": "main",
"index": 0
}
]
]
},
"Fetch Market Data": {
"main": [
[
{
"node": "Merge and Clean Data",
"type": "main",
"index": 0
}
]
]
},
"Fetch News Articles": {
"main": [
[
{
"node": "Merge and Clean Data",
"type": "main",
"index": 0
}
]
]
},
"Log to Google Sheets": {
"main": [
[
{
"node": "Return Report Response",
"type": "main",
"index": 0
}
]
]
},
"Merge and Clean Data": {
"main": [
[
{
"node": "Claude Pass 1 Research Synthesis",
"type": "main",
"index": 0
}
]
]
},
"Extract Pass 1 Output": {
"main": [
[
{
"node": "Wait For Process",
"type": "main",
"index": 0
}
]
]
},
"Extract Pass 2 Output": {
"main": [
[
{
"node": "Claude Pass 3 Write Final Report",
"type": "main",
"index": 0
}
]
]
},
"Post Summary to Slack": {
"main": [
[
{
"node": "Return Report Response",
"type": "main",
"index": 0
}
]
]
},
"Receive Research Request": {
"main": [
[
{
"node": "Set Credentials and Config",
"type": "main",
"index": 0
}
]
]
},
"Search Google via Serper": {
"main": [
[
{
"node": "Merge and Clean Data",
"type": "main",
"index": 0
}
]
]
},
"Set Credentials and Config": {
"main": [
[
{
"node": "Validate Input",
"type": "main",
"index": 0
}
]
]
},
"Format Final Report Package": {
"main": [
[
{
"node": "Save Report to Google Drive",
"type": "main",
"index": 0
},
{
"node": "Post Summary to Slack",
"type": "main",
"index": 0
},
{
"node": "Email Full Report via SendGrid",
"type": "main",
"index": 0
},
{
"node": "Log to Google Sheets",
"type": "main",
"index": 0
}
]
]
},
"Save Report to Google Drive": {
"main": [
[
{
"node": "Return Report Response",
"type": "main",
"index": 0
}
]
]
},
"Claude Pass 2 Strategic SWOT": {
"main": [
[
{
"node": "Extract Pass 2 Output",
"type": "main",
"index": 0
}
]
]
},
"Email Full Report via SendGrid": {
"main": [
[
{
"node": "Return Report Response",
"type": "main",
"index": 0
}
]
]
},
"Claude Pass 1 Research Synthesis": {
"main": [
[
{
"node": "Extract Pass 1 Output",
"type": "main",
"index": 0
}
]
]
},
"Claude Pass 3 Write Final Report": {
"main": [
[
{
"node": "Format Final Report Package",
"type": "main",
"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.
googleApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow is a fully automated AI-powered business intelligence agent. It accepts a research topic or company name via webhook, autonomously collects data from multiple live sources (web search, news feeds, financial APIs), runs a multi-stage Claude AI analysis pipeline, and…
Source: https://n8n.io/workflows/13805/ — 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.
[SANTOBET] FLUXO TODO - BACKUP. Uses googleSheets, httpRequest, googleSheetsTrigger. Webhook trigger; 57 nodes.
FLUXO DISPARO DATA E HORA. Uses itemLists, googleSheets, httpRequest. Webhook trigger; 48 nodes.
This workflow allows you to accept online payments via YooKassa and log both orders and transactions in Google Sheets — all without writing a single line of code. It supports full payment flow: produc
Transform your n8n instance management with this advanced automation system featuring artificial intelligence-driven workflow selection. This template provides comprehensive maintenance operations wit
Nexus_v6(ล่าสุดจริงๆ)ล่าสุดไกไก. Uses googleSheets, httpRequest. Webhook trigger; 41 nodes.