{
  "nodes": [
    {
      "id": "87c66204-83f8-44ec-88a8-dc0678e594a3",
      "name": "Groq Chat Model2",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        13600,
        4960
      ],
      "parameters": {
        "model": "llama-3.3-70b-versatile",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "8a9f9faa-577f-41df-baa6-398fd4ddb67f",
      "name": "Schedule Trigger2",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        11968,
        4784
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 7
            }
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "bff36b83-a717-4e88-a074-e0d7e03d0701",
      "name": "Define News Categories1",
      "type": "n8n-nodes-base.set",
      "position": [
        12224,
        4784
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "aa010cf6-07c0-42b8-9ced-d90754afe55e",
              "name": "Global_Top_News",
              "type": "string",
              "value": "http://feeds.bbci.co.uk/news/rss.xml"
            },
            {
              "id": "7cca6ba3-2e74-4233-9cf8-6238a78e6016",
              "name": "Global_Business_News",
              "type": "string",
              "value": "http://feeds.bbci.co.uk/news/business/rss.xml"
            },
            {
              "id": "11948465-2098-421c-a989-5e4d693b3ea9",
              "name": "Finance_News",
              "type": "string",
              "value": "https://feeds.bloomberg.com/markets/news.rss"
            },
            {
              "id": "effbea38-36d1-4660-8e8d-5f0f254c11eb",
              "name": "Technological_News",
              "type": "string",
              "value": "https://techcrunch.com/feed/"
            },
            {
              "id": "2f08a520-7217-419c-8088-e28a77eca312",
              "name": "Tech_Trend_News",
              "type": "string",
              "value": "https://www.theverge.com/rss/index.xml"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "7cc1a441-e081-4f99-ae1d-04f8792b8b3e",
      "name": "Prepare RSS Feed List1",
      "type": "n8n-nodes-base.code",
      "position": [
        12480,
        4784
      ],
      "parameters": {
        "jsCode": "const data = $input.first().json;\n\nconst result = Object.entries(data).map(([key, value]) => {\n  return {\n    json: {\n      Rss_Feed: value\n    }\n  };\n});\n\nreturn result;"
      },
      "typeVersion": 2
    },
    {
      "id": "ca8e917e-cb0e-40ef-b8cb-756e66edb099",
      "name": "Loop Through RSS Feeds1",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        12736,
        4784
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "dde76c1e-2e29-46a2-8c02-1491084c1eaf",
      "name": "Fetch RSS Articles1",
      "type": "n8n-nodes-base.rssFeedRead",
      "position": [
        12944,
        4880
      ],
      "parameters": {
        "url": "={{ $json.Rss_Feed }}",
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "f32a01ab-4818-4b1f-80a1-35c6a213f174",
      "name": "Filter Latest 10 Articles1",
      "type": "n8n-nodes-base.code",
      "position": [
        13136,
        4880
      ],
      "parameters": {
        "jsCode": "// Get all incoming items\nconst allItems = $input.all();\n\n// Sort by latest date\nallItems.sort((a, b) => {\n  return new Date(b.json.isoDate).getTime() - new Date(a.json.isoDate).getTime();\n});\n\n// Return top 10\nreturn allItems.slice(0, 10);"
      },
      "typeVersion": 2
    },
    {
      "id": "3c1bdd0a-e8b1-4b1e-b781-cdefbe162594",
      "name": "Merge All RSS Articles1",
      "type": "n8n-nodes-base.code",
      "position": [
        13344,
        4768
      ],
      "parameters": {
        "jsCode": "const articles = $input.all().map(item => ({\n  title: item.json.title,\n  link: item.json.link,\n  pubDate: item.json.pubDate\n}));\n\nreturn [\n  {\n    json: {\n      articles\n    }\n  }\n];"
      },
      "typeVersion": 2
    },
    {
      "id": "6bc7cdaf-1791-46f2-b143-4c41c15e6218",
      "name": "Format News For Slack Message1",
      "type": "n8n-nodes-base.code",
      "position": [
        13936,
        4768
      ],
      "parameters": {
        "jsCode": "const text = $json.output;\n\n// find JSON array inside the text\nconst match = text.match(/\\[[\\s\\S]*\\]/);\n\nif (!match) {\n  throw new Error(\"No JSON array found in AI output\");\n}\n\n// parse JSON\nconst articles = JSON.parse(match[0]);\n\n// return each article as separate item\nreturn articles.map(article => ({\n  json: article\n}));"
      },
      "typeVersion": 2
    },
    {
      "id": "70f4f32a-485b-4273-9ca5-204f476fe9f0",
      "name": "Post News Digest to Slack1",
      "type": "n8n-nodes-base.slack",
      "position": [
        14176,
        4768
      ],
      "parameters": {
        "text": "={{\n(() => {\nconst today = new Date();\nconst formattedDate =\nString(today.getDate()).padStart(2,'0') + '-' +\nString(today.getMonth()+1).padStart(2,'0') + '-' +\ntoday.getFullYear();\n\nreturn `\ud83c\udf0d *Daily Global News Digest - ${formattedDate}*\n\n\ud83d\udcf0 Here are today's most important global news:\n\n` + $input.all().map(item =>\n`\ud83d\udd39 *${item.json.title}*\n\n${item.json.Description}\n\n<${item.json.url}|Read Full Article>`\n  ).join('\\n\\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\\n\\n');\n})()\n}}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "typeVersion": 2.4
    },
    {
      "id": "f66a162c-13f3-4b4a-8b55-b9308cee1573",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        11024,
        4320
      ],
      "parameters": {
        "width": 784,
        "height": 864,
        "content": "# Daily RSS News Digest to Slack\n\nThis workflow automatically collects global news from multiple RSS feeds, selects the most important stories using AI, and posts a clean daily news digest to a Slack channel.\n\nThe automation runs every morning, gathers the latest articles from different news categories, and uses AI to identify the stories that have the greatest global impact.\n\nThe final curated news digest is then formatted and delivered directly to a Slack channel for easy reading by the team.\n\n## How it works\nStep 1: The workflow runs on a scheduled trigger every morning.\n\nStep 2: A list of RSS feeds from different news categories (such as global news, finance, technology, and tech trends) is prepared.\n\nStep 3: The workflow loops through each RSS feed and retrieves the latest articles.\n\nStep 4: The articles are sorted by publication date so that only the most recent news is considered.\n\nStep 5: All collected articles are merged into a single dataset.\n\nStep 6: An AI agent analyzes the list of articles and selects the most globally impactful stories based on topics like global politics, economic events, technological developments, and major world events.\n\nStep 7: The selected stories are formatted into a readable news digest.\n\nStep 8: The final digest is automatically posted to a Slack channel.\n\n## Setup steps\n1. Configure the Slack credentials and select the channel where the news digest should be posted.\n2. Add or modify the RSS feed URLs if you want to change the news sources.\n3. Configure the AI model credentials.\n4. Review and adjust the AI prompt if needed.\n5. Activate the workflow.\n\nOnce activated, the workflow will automatically deliver an AI-curated global news digest to Slack every morning."
      },
      "typeVersion": 1
    },
    {
      "id": "c6a7fff9-1988-4737-a49e-bdbf105474f1",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        11840,
        4320
      ],
      "parameters": {
        "color": 7,
        "width": 800,
        "height": 864,
        "content": "# Step 1 \u2013 Workflow Trigger & RSS Feed Preparation\n\nRuns every morning and prepares the list of RSS feeds that will be used to collect news articles from multiple categories."
      },
      "typeVersion": 1
    },
    {
      "id": "f3d25a98-e663-4b35-bf1d-e5d0ee3f1270",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        12672,
        4320
      ],
      "parameters": {
        "color": 7,
        "width": 816,
        "height": 864,
        "content": "# Step 2 \u2013 RSS Article Collection & Processing\n\nLoops through each RSS feed, fetches the latest articles, filters recent ones, and merges them into a single dataset."
      },
      "typeVersion": 1
    },
    {
      "id": "a1b45760-5b23-459f-a81d-1dea2f2fea86",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        13520,
        4320
      ],
      "parameters": {
        "color": 7,
        "width": 848,
        "height": 864,
        "content": "# Step 3 \u2013 AI News Selection & Slack Delivery\n\nAI analyzes the collected articles, selects the most globally impactful stories, and posts the final news digest to Slack."
      },
      "typeVersion": 1
    },
    {
      "id": "cc80a7d0-dbdf-47b0-8342-9329a19129cf",
      "name": "AI Agent2",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        13600,
        4768
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    }
  ],
  "connections": {
    "AI Agent2": {
      "main": [
        [
          {
            "node": "Format News For Slack Message1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Groq Chat Model2": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent2",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger2": {
      "main": [
        [
          {
            "node": "Define News Categories1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch RSS Articles1": {
      "main": [
        [
          {
            "node": "Filter Latest 10 Articles1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare RSS Feed List1": {
      "main": [
        [
          {
            "node": "Loop Through RSS Feeds1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Define News Categories1": {
      "main": [
        [
          {
            "node": "Prepare RSS Feed List1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Through RSS Feeds1": {
      "main": [
        [
          {
            "node": "Merge All RSS Articles1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Fetch RSS Articles1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge All RSS Articles1": {
      "main": [
        [
          {
            "node": "AI Agent2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Latest 10 Articles1": {
      "main": [
        [
          {
            "node": "Loop Through RSS Feeds1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format News For Slack Message1": {
      "main": [
        [
          {
            "node": "Post News Digest to Slack1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}