{
  "name": "Daily News Digest to Telegram",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [{"field": "cronExpression", "expression": "0 8 * * *"}]
        }
      },
      "id": "a1b2c3d4-0001-4000-a001-100000000001",
      "name": "Every Day 8AM",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [250, 300]
    },
    {
      "parameters": {
        "url": "https://vnexpress.net/rss/tin-moi-nhat.rss",
        "options": {}
      },
      "id": "a1b2c3d4-0002-4000-a002-200000000002",
      "name": "RSS VnExpress",
      "type": "n8n-nodes-base.rssFeedRead",
      "typeVersion": 1,
      "position": [500, 150]
    },
    {
      "parameters": {
        "url": "https://tuoitre.vn/rss/tin-moi-nhat.rss",
        "options": {}
      },
      "id": "a1b2c3d4-0003-4000-a003-300000000003",
      "name": "RSS Tuoi Tre",
      "type": "n8n-nodes-base.rssFeedRead",
      "typeVersion": 1,
      "position": [500, 300]
    },
    {
      "parameters": {
        "url": "https://thanhnien.vn/rss/home.rss",
        "options": {}
      },
      "id": "a1b2c3d4-0004-4000-a004-400000000004",
      "name": "RSS Thanh Nien",
      "type": "n8n-nodes-base.rssFeedRead",
      "typeVersion": 1,
      "position": [500, 450]
    },
    {
      "parameters": {
        "mode": "combine",
        "combineBy": "combineAll",
        "options": {}
      },
      "id": "a1b2c3d4-0005-4000-a005-500000000005",
      "name": "Merge All News",
      "type": "n8n-nodes-base.merge",
      "typeVersion": 2.1,
      "position": [750, 300]
    },
    {
      "parameters": {
        "model": "gpt-4o-mini",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a Vietnamese news editor. Given a list of news headlines and summaries, create a concise daily digest in Vietnamese. Pick the top 5 most important stories. Format each with a numbered list, headline in bold, and a 1-sentence summary. Keep it under 500 words."
            },
            {
              "role": "user",
              "content": "={{ $json.all.map(item => `- ${item.title}: ${item.contentSnippet || ''}`).join('\\n') }}"
            }
          ]
        },
        "options": {
          "maxTokens": 1000,
          "temperature": 0.5
        }
      },
      "id": "a1b2c3d4-0006-4000-a006-600000000006",
      "name": "OpenAI Summarize",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.2,
      "position": [1000, 300]
    },
    {
      "parameters": {
        "chatId": "your-chat-id",
        "text": "=📰 *Tin tuc sang nay - {{ new Date().toLocaleDateString('vi-VN') }}*\n\n{{ $json.choices[0].message.content }}",
        "additionalFields": {
          "parse_mode": "Markdown"
        }
      },
      "id": "a1b2c3d4-0007-4000-a007-700000000007",
      "name": "Send to Telegram",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [1250, 300]
    }
  ],
  "connections": {
    "Every Day 8AM": {
      "main": [
        [
          {"node": "RSS VnExpress", "type": "main", "index": 0},
          {"node": "RSS Tuoi Tre", "type": "main", "index": 0},
          {"node": "RSS Thanh Nien", "type": "main", "index": 0}
        ]
      ]
    },
    "RSS VnExpress": {
      "main": [[{"node": "Merge All News", "type": "main", "index": 0}]]
    },
    "RSS Tuoi Tre": {
      "main": [[{"node": "Merge All News", "type": "main", "index": 1}]]
    },
    "RSS Thanh Nien": {
      "main": [[{"node": "Merge All News", "type": "main", "index": 0}]]
    },
    "Merge All News": {
      "main": [[{"node": "OpenAI Summarize", "type": "main", "index": 0}]]
    },
    "OpenAI Summarize": {
      "main": [[{"node": "Send to Telegram", "type": "main", "index": 0}]]
    }
  },
  "settings": {"executionOrder": "v1"},
  "staticData": null,
  "tags": []
}
