毎日のAI駆動型世界サイエンス分析(GDELT、NewsAPI、Discord)

上級

これはMarket Research, AI Summarization分野の自動化ワークフローで、18個のノードを含みます。主にCode, Merge, Discord, HttpRequest, Agentなどのノードを使用。 Gemini AI、GDELT、NewsAPI、Discord を使用した毎日のグローバル トレンド分析

前提条件
  • Discord Bot Token または Webhook
  • ターゲットAPIの認証情報が必要な場合あり
  • Google Gemini API Key

カテゴリー

ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "id": "CJ1U1W5OJOhprfl5",
  "meta": {
    "instanceId": "c4eae34af81eeff658410c97c38d8a485e4c73ba5cea5b25eef189aa5e5a73b9",
    "templateCredsSetupCompleted": true
  },
  "name": "Daily AI-Powered Global Trend Analysis with GDELT, NewsAPI & Discord",
  "tags": [],
  "nodes": [
    {
      "id": "1938bff0-f1e4-4bf2-9b40-66bbe5335c5e",
      "name": "Hacker News (Free)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        48,
        416
      ],
      "parameters": {
        "url": "https://hn.algolia.com/api/v1/search?query=startup%20OR%20trend&tags=story&hitsPerPage=10",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "0a470151-ffe3-4cd1-a0f5-14333d7d2d5e",
      "name": "トレンドデータのフォーマット",
      "type": "n8n-nodes-base.code",
      "position": [
        608,
        416
      ],
      "parameters": {
        "jsCode": "// Combine & normalize data from GDELT, Hacker News, and NewsAPI\n\nconst mergedData = [];\n\nfor (const item of items) {\n\n  // --- GDELT ---\n  if (item.json.articles && Array.isArray(item.json.articles)) {\n    for (const article of item.json.articles) {\n      let publishedAt = '';\n\n      if (article.seendate) {\n        try {\n          // Convert 20250909T101500Z → 2025-09-09T10:15:00Z\n          const clean = article.seendate.replace(\n            /(\\d{4})(\\d{2})(\\d{2})T(\\d{2})(\\d{2})(\\d{2})Z/,\n            '$1-$2-$3T$4:$5:$6Z'\n          );\n          publishedAt = new Date(clean).toISOString();\n        } catch {\n          publishedAt = new Date().toISOString(); // fallback\n        }\n      } else {\n        publishedAt = new Date().toISOString(); // fallback for missing date\n      }\n\n      mergedData.push({\n        source: article.domain || 'GDELT',\n        title: article.title || '',\n        url: article.url || '',\n        image: article.socialimage || '',\n        publishedAt,\n        language: article.language || 'Unknown',\n        country: article.sourcecountry || 'Unknown',\n      });\n    }\n  }\n\n  // --- Hacker News ---\n  else if (item.json.hits && Array.isArray(item.json.hits)) {\n    for (const hit of item.json.hits) {\n      mergedData.push({\n        source: 'Hacker News',\n        title: hit.title || hit.story_title || '',\n        url: hit.url || hit.story_url || '',\n        image: '',\n        publishedAt: hit.created_at || new Date().toISOString(),\n        language: 'English',\n        country: 'Global',\n      });\n    }\n  }\n\n  // --- NewsAPI ---\n  else if (item.json.status === 'ok' && item.json.articles) {\n    for (const article of item.json.articles) {\n      mergedData.push({\n        source: article.source?.name || 'NewsAPI',\n        title: article.title || '',\n        url: article.url || '',\n        image: article.urlToImage || '',\n        publishedAt: article.publishedAt || new Date().toISOString(),\n        language: 'English',\n        country: '',\n      });\n    }\n  }\n}\n\n// Sort by date (newest first)\nmergedData.sort((a, b) => new Date(b.publishedAt) - new Date(a.publishedAt));\n\nreturn [\n  {\n    json: {\n      total_articles: mergedData.length,\n      extracted_at: new Date().toISOString(),\n      articles: mergedData,\n    },\n  },\n];"
      },
      "typeVersion": 1
    },
    {
      "id": "edad7cfc-30b8-4451-a95b-266d5417681c",
      "name": "AI出力の解析",
      "type": "n8n-nodes-base.code",
      "position": [
        1360,
        416
      ],
      "parameters": {
        "jsCode": "const data = $json.output;\n\nreturn {\n  content: `🧭 **Global Trend Summary**\n${data.trend_summary}\n\n🌍 **Emerging Topics**\n${data.emerging_topics.map(t => `• ${t}`).join('\\n')}\n\n📍 **Regional Insights**\n${data.regional_insights.map(r => `- ${r}`).join('\\n')}\n\n📰 **Notable Mentions**\n${data.notable_mentions.map(n => `• *${n.title}* (${n.source})`).join('\\n')}`\n};"
      },
      "typeVersion": 1
    },
    {
      "id": "34144db3-1b89-4934-b35d-fba1b8d59476",
      "name": "マージ",
      "type": "n8n-nodes-base.merge",
      "position": [
        352,
        400
      ],
      "parameters": {
        "numberInputs": 3
      },
      "typeVersion": 3.2
    },
    {
      "id": "48f89c07-e60c-4bf7-a333-3ce297bea0f5",
      "name": "AIエージェント",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        896,
        416
      ],
      "parameters": {
        "text": "=You are given aggregated trend data from multiple APIs — GDELT Global Events, Hacker News, and NewsAPI.\n\nAnalyze the data and generate the following insights:\n\t1.\t📰 Top 5 Emerging Topics — Identify five recurring keywords or entities that appear across multiple sources.\n\t2.\t📈 Trend Summary — Write a concise summary (100–150 words) explaining what’s trending globally and why it matters.\n\t3.\t🌍 Regional Insights — Highlight 2–3 countries or regions showing notable activity or sentiment.\n\t4.\t🔥 Notable Mentions — List three interesting or viral article titles with their source names.\n\nUse the dataset below to extract your insights:\n{{ $json.articles }}",
        "options": {
          "systemMessage": "You are a global trend intelligence AI Agent that analyzes real-time multi-source data from news, events, and discussions.\nYour goal is to detect key insights, emerging trends, and unusual patterns from the aggregated dataset.\nFocus on clarity, synthesis, and relevance.\nAlways provide short, structured, and useful outputs that could be used in automated Telegram or Discord alerts.\nBe concise but insightful."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "bfdd1b07-2efc-4843-96f2-53f7d35e267b",
      "name": "メッセージ送信",
      "type": "n8n-nodes-base.discord",
      "position": [
        1680,
        416
      ],
      "webhookId": "f4b13acf-2830-4265-a4df-750c59a31a35",
      "parameters": {
        "content": "={{ $json.content }}",
        "guildId": {
          "__rl": true,
          "mode": "list",
          "value": "1280652666577354803",
          "cachedResultUrl": "https://discord.com/channels/1280652666577354803",
          "cachedResultName": "Renz's server"
        },
        "options": {},
        "resource": "message",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "1280652667408089210",
          "cachedResultUrl": "https://discord.com/channels/1280652666577354803/1280652667408089210",
          "cachedResultName": "general"
        }
      },
      "credentials": {
        "discordBotApi": {
          "id": "9ivVgYWgpq4MNHqd",
          "name": "Discord Bot Token"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "6e2ac3b5-d2c9-4ac9-97e5-28e45be4ab06",
      "name": "GDELT Global Event",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        48,
        224
      ],
      "parameters": {
        "url": "https://api.gdeltproject.org/api/v2/doc/doc?query=crypto&format=json",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "1206f8c8-2690-4c87-a1d7-c73a447caa13",
      "name": "NewsAPI (Free)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        48,
        608
      ],
      "parameters": {
        "url": "=https://newsapi.org/v2/everything",
        "options": {},
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "q",
              "value": "crypto OR bitcoin OR ethereum OR solana OR defi OR nft OR blockchain OR web3 OR altcoin OR etf OR regulation"
            },
            {
              "name": "language",
              "value": "en"
            },
            {
              "name": "sortBy",
              "value": "publishedAt"
            },
            {
              "name": "pageSize",
              "value": "10"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "dX3eyicfCIeMJzdO",
          "name": "News API"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "18f96256-9b5f-4f96-b309-1c9a0bd30b24",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1040,
        608
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"emerging_topics\": [\n    \"crypto regulation\",\n    \"AI funding\",\n    \"energy infrastructure\",\n    \"stablecoins\",\n    \"startup innovation\"\n  ],\n  \"trend_summary\": \"Global markets are seeing a renewed surge in crypto and AI-driven technologies. Stablecoins and digital asset regulation are trending across US and EU outlets, while emerging markets like Indonesia and UAE show major growth in digital finance adoption.\",\n  \"regional_insights\": [\n    \"UAE is positioning itself as a top crypto hub for investors.\",\n    \"Turkey and Germany show high media coverage on digital asset policies.\"\n  ],\n  \"notable_mentions\": [\n    {\n      \"title\": \"Crypto Markets Today: BTC Reclaims $111K, ETH Tops $4K After Last Week’s Sell-Off\",\n      \"source\": \"Biztoc\"\n    },\n    {\n      \"title\": \"USA Rare Earth Stock Jumps. Why This Analyst Says Buy Now\",\n      \"source\": \"Barron’s\"\n    },\n    {\n      \"title\": \"Show HN: A Tool to Analyze Hacker News Sentiment on Any Term in Seconds\",\n      \"source\": \"Hacker News\"\n    }\n  ]\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "a2da9ace-be72-4606-a7e1-ea2a9cc3c2ca",
      "name": "6時間ごと",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -176,
        416
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 8
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "ba6521d0-aa4a-4aad-bf35-a57cda7d5cc3",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        896,
        608
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "id": "rJzDGbm8eDazr9g5",
          "name": "Google Gemini API"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "5e8548ef-605a-4edf-8868-6ced47b35efb",
      "name": "付箋",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -272,
        144
      ],
      "parameters": {
        "width": 192,
        "height": 624,
        "content": "### Schedule Trigger\nRuns automatically every 6 hours (modifiable).  \nThis node initiates the entire workflow — pulling the latest global data from all three APIs (GDELT, Hacker News, NewsAPI).  \nAdjust the frequency to 12h or 24h if you prefer slower data cycles.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "9ed12aac-21ef-41de-96d5-90fc54b59413",
      "name": "付箋1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -72,
        -288
      ],
      "parameters": {
        "color": 2,
        "width": 336,
        "height": 1056,
        "content": "### GDELT Global Media Feed\nFetches real-time global event data from GDELT’s open intelligence API.  \nCaptures signals from global media, politics, and social activity related to your keyword (default: “crypto”).  \nNo authentication required.\n\n### Hacker News Trending Insights\nPulls trending stories from Hacker News using the Algolia API.  \nFocuses on discussions around startups, AI, and innovation — perfect for capturing early tech sentiment.  \nNo authentication required.\n\n### NewsAPI Global Headlines\nFetches major global news headlines filtered by key topics such as “crypto”, “AI”, “web3”, etc.  \nProvides structured JSON with title, URL, and publication date.  \nRequires your **NewsAPI key** (set in credentials).\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "df85c7c8-343f-46b8-aff5-f6b81b074981",
      "name": "付箋2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        272,
        192
      ],
      "parameters": {
        "color": 3,
        "width": 246,
        "height": 576,
        "content": "### Data Merger\nCombines outputs from GDELT, Hacker News, and NewsAPI into one unified data stream.  \nPrepares the aggregated dataset for cleaning and normalization.  \nEnsures all sources are processed together for the AI agent.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "02912617-8441-446f-a575-3d9318efc730",
      "name": "付箋3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        528,
        160
      ],
      "parameters": {
        "color": 4,
        "height": 608,
        "content": "### Data Normalization & Structuring\nCleans, merges, and formats raw article data into a standardized JSON schema:\n- Title, URL, Source, Country, PublishedAt, etc.\n- Removes duplicates and aligns timestamps.\nThis ensures the AI receives consistent, readable input.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "8ea786aa-cfc4-42c9-bd20-40287e4b4101",
      "name": "付箋4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        784,
        -192
      ],
      "parameters": {
        "color": 5,
        "width": 448,
        "height": 960,
        "content": "### Global Trend Intelligence Agent\nUses your connected **LLM (Gemini or OpenAI)** to analyze the cleaned dataset.  \nExtracts:\n- Top 5 Emerging Topics  \n- Concise 100–150 word Global Summary  \n- Regional Insights  \n- Notable Mentions  \n\nActs as the core analytical brain of the workflow.\n\n### Gemini AI Engine\nPrimary LLM model that powers the Trend Analyzer Agent.  \nYou can swap this with OpenAI or Anthropic models for different tone or reasoning styles.  \nCredential: “Google Gemini API”.\n\n### JSON Output Schema\nDefines how the AI’s response should be structured and validated.  \nGuarantees consistent output fields:\n- emerging_topics  \n- trend_summary  \n- regional_insights  \n- notable_mentions  \nPrevents malformed AI responses.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "0f01e4b5-4d8e-4849-9c45-d69556bf6f35",
      "name": "付箋5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1248,
        240
      ],
      "parameters": {
        "color": 6,
        "width": 320,
        "height": 528,
        "content": "### Discord Message Formatter\nTransforms the AI-generated JSON into a styled Discord message format.  \nAdds emojis, sections, and headlines for readability.  \nPrepares the final text for posting to your Discord server.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "9bc701ff-5d8e-4ca9-a85f-d111ea4ec579",
      "name": "付箋6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1584,
        208
      ],
      "parameters": {
        "color": 7,
        "width": 288,
        "height": 560,
        "content": "### Discord Auto-Poster\nDelivers the formatted AI insights directly to your chosen Discord channel.  \nConfigured via Webhook or Bot Token.  \nDefault channel: #general  \nThis is the final delivery node — your AI-curated global summary goes live here.\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "196f94af-b608-4e84-855c-db88a5495885",
  "connections": {
    "34144db3-1b89-4934-b35d-fba1b8d59476": {
      "main": [
        [
          {
            "node": "0a470151-ffe3-4cd1-a0f5-14333d7d2d5e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "48f89c07-e60c-4bf7-a333-3ce297bea0f5": {
      "main": [
        [
          {
            "node": "edad7cfc-30b8-4451-a95b-266d5417681c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a2da9ace-be72-4606-a7e1-ea2a9cc3c2ca": {
      "main": [
        [
          {
            "node": "1938bff0-f1e4-4bf2-9b40-66bbe5335c5e",
            "type": "main",
            "index": 0
          },
          {
            "node": "1206f8c8-2690-4c87-a1d7-c73a447caa13",
            "type": "main",
            "index": 0
          },
          {
            "node": "6e2ac3b5-d2c9-4ac9-97e5-28e45be4ab06",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1206f8c8-2690-4c87-a1d7-c73a447caa13": {
      "main": [
        [
          {
            "node": "34144db3-1b89-4934-b35d-fba1b8d59476",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "edad7cfc-30b8-4451-a95b-266d5417681c": {
      "main": [
        [
          {
            "node": "bfdd1b07-2efc-4843-96f2-53f7d35e267b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0a470151-ffe3-4cd1-a0f5-14333d7d2d5e": {
      "main": [
        [
          {
            "node": "48f89c07-e60c-4bf7-a333-3ce297bea0f5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6e2ac3b5-d2c9-4ac9-97e5-28e45be4ab06": {
      "main": [
        [
          {
            "node": "34144db3-1b89-4934-b35d-fba1b8d59476",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1938bff0-f1e4-4bf2-9b40-66bbe5335c5e": {
      "main": [
        [
          {
            "node": "34144db3-1b89-4934-b35d-fba1b8d59476",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "ba6521d0-aa4a-4aad-bf35-a57cda7d5cc3": {
      "ai_languageModel": [
        [
          {
            "node": "48f89c07-e60c-4bf7-a333-3ce297bea0f5",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "18f96256-9b5f-4f96-b309-1c9a0bd30b24": {
      "ai_outputParser": [
        [
          {
            "node": "48f89c07-e60c-4bf7-a333-3ce297bea0f5",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

このワークフローの使い方は?

上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。

このワークフローはどんな場面に適していますか?

上級 - 市場調査, AI要約

有料ですか?

このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。

ワークフロー情報
難易度
上級
ノード数18
カテゴリー2
ノードタイプ9
難易度説明

上級者向け、16ノード以上の複雑なワークフロー

作成者

Automation expert and founder of AFK Crypto with over 5 years of experience in crypto automations.

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34