{
  "name": "Daily Brief, checkpoint 3 (news)",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 7
            }
          ]
        }
      },
      "id": "cff91e97-31a4-43c7-9b7b-d22f570281aa",
      "name": "Every morning at 7",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        2256,
        1808
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "719f0d54-0488-4e76-8cba-bb5f7995e2a5",
              "name": "topics",
              "value": "AI agents, Gemini, n8n",
              "type": "string"
            },
            {
              "id": "f38fa2e0-0400-4d90-8f03-c7e6070f38f7",
              "name": "city",
              "value": "Paderborn",
              "type": "string"
            },
            {
              "id": "9f3683b7-8e56-4b76-9954-dd8153aa9b78",
              "name": "latitude",
              "value": 51.72,
              "type": "number"
            },
            {
              "id": "90c309bb-5bb1-4f8b-ade7-289f3367b804",
              "name": "longitude",
              "value": 8.76,
              "type": "number"
            },
            {
              "id": "a0e765cf-a0c3-43cb-9924-cd63c710cac8",
              "name": "email",
              "value": "you@example.com",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "bcca6001-069b-447d-a93a-ca5f987b5608",
      "name": "My settings",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        2480,
        1808
      ]
    },
    {
      "parameters": {
        "url": "=https://api.open-meteo.com/v1/forecast?latitude={{ $('My settings').first().json.latitude }}&longitude={{ $('My settings').first().json.longitude }}&daily=temperature_2m_max,temperature_2m_min,precipitation_probability_max&timezone=auto&forecast_days=1",
        "options": {}
      },
      "id": "85f5c0ad-12f2-4cbf-ab0e-6da209a85a02",
      "name": "Get weather",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        2704,
        1808
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "e425d589-7c8f-44ec-831a-bf8eafabb7c8",
              "name": "temp_min",
              "value": "={{ $json.daily.temperature_2m_min[0] }}",
              "type": "number"
            },
            {
              "id": "acefaaae-c2da-4701-9519-c0a6d2a1c11f",
              "name": "temp_max",
              "value": "={{ $json.daily.temperature_2m_max[0] }}",
              "type": "number"
            },
            {
              "id": "5e1caa3f-6985-467f-9002-a498bba17eda",
              "name": "rain_chance",
              "value": "={{ $json.daily.precipitation_probability_max[0] }}",
              "type": "number"
            },
            {
              "id": "7efe963e-ab39-4f98-a039-edafe0b64074",
              "name": "summary",
              "value": "={{ $json.daily.temperature_2m_min[0] }} to {{ $json.daily.temperature_2m_max[0] }} °C, {{ $json.daily.precipitation_probability_max[0] }}% chance of rain",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "13c33377-e87e-4358-8a55-27ad3ef3adde",
      "name": "Format weather",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        2928,
        1808
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "0b58d2e0-cb7b-4257-ab3e-ace25cbd69e0",
              "leftValue": "={{ $json.rain_chance }}",
              "rightValue": 50,
              "operator": {
                "type": "number",
                "operation": "gt"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "fc8fb1ce-3539-4c10-9314-868fd59abd73",
      "name": "Rain over 50%?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        3136,
        1808
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "7530c764-d124-467a-834d-72fc8cd628fc",
              "name": "umbrella_note",
              "value": "☔ Take an umbrella today.",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "b76effec-ef04-4979-a1e4-c917a38b9076",
      "name": "Umbrella note",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        3360,
        1648
      ]
    },
    {
      "parameters": {
        "url": "=https://news.google.com/rss/search?q={{ encodeURIComponent($('My settings').first().json.topics.split(',').map(t => '\"' + t.trim() + '\"').join(' OR ') + ' when:1d') }}&hl=en-US&gl=US&ceid=US:en",
        "options": {}
      },
      "id": "9f9d4a44-a5e2-47c4-bb45-2295fc4c2d74",
      "name": "Google News",
      "type": "n8n-nodes-base.rssFeedRead",
      "typeVersion": 1.1,
      "position": [
        3584,
        1808
      ]
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=Write my morning brief for today, {{ $now.toFormat('cccc, d LLLL') }}.\n\nWeather in {{ $('My settings').first().json.city }}: {{ $('Format weather').first().json.summary }}\n\nNews on my topics from Google News:\n{{ $('Google News').all().slice(0, 15).map(item => '- ' + item.json.title + ' (' + item.json.link + ')').join('\\n') }}\n\nAlso check the Hacker News front page with your tool and include stories that fit my interests.",
        "options": {
          "systemMessage": "=You are my personal morning briefing assistant.\nMy interests: {{ $('My settings').first().json.topics }}.\n\nWrite a short brief in plain text, no Markdown:\n1. One line on today's weather.\n2. The 3 to 5 most relevant stories for my interests, each with one sentence and its link.\n\nOnly use stories from the news list in the message or from your tools.\nNever use your own knowledge for news. If there are no stories, write only the weather line.\nKeep the brief under 200 words."
        }
      },
      "id": "dc132931-4af4-4e30-990e-949f4e9da315",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.8,
      "position": [
        3808,
        1808
      ],
      "executeOnce": true
    },
    {
      "parameters": {
        "modelName": "models/gemini-3.5-flash-lite",
        "options": {}
      },
      "id": "b707b7ca-d318-4249-9e67-115216e4aba0",
      "name": "Gemini",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1,
      "position": [
        3808,
        2048
      ]
    },
    {
      "parameters": {
        "toolDescription": "Returns the current Hacker News front page stories (title, url, points) as JSON.",
        "url": "https://hn.algolia.com/api/v1/search?tags=front_page&hitsPerPage=10&attributesToRetrieve=title,url,points&attributesToHighlight=%5B%5D",
        "options": {}
      },
      "id": "d9df4f67-79d1-4301-8d4b-79fd386861e9",
      "name": "Hacker News",
      "type": "n8n-nodes-base.httpRequestTool",
      "typeVersion": 4.2,
      "position": [
        3952,
        2048
      ]
    },
    {
      "parameters": {
        "content": "## 1. Settings and weather\nYour topics, city and email in one place. Then: get the weather, cut the JSON down, check for rain.",
        "height": 628,
        "width": 1296,
        "color": 7
      },
      "id": "3ad8d526-c38d-4498-b64c-c06fd62bbda8",
      "name": "Stage 1",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        2192,
        1568
      ]
    },
    {
      "parameters": {
        "content": "## 3. News\nGoogle News (fixed) and Hacker News (a tool the agent can call).",
        "height": 640,
        "width": 200,
        "color": 6
      },
      "id": "78e0ee17-a333-4828-8c27-49e97c489655",
      "name": "Stage 3",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        3520,
        1568
      ]
    },
    {
      "parameters": {
        "content": "## 2. The agent\nGemini writes the brief.",
        "height": 640,
        "width": 364,
        "color": 5
      },
      "id": "c48ca4d0-ae8a-44c3-a540-30f031d1a6c5",
      "name": "Stage 2",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        3744,
        1568
      ]
    }
  ],
  "pinData": {},
  "connections": {
    "Every morning at 7": {
      "main": [
        [
          {
            "node": "My settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get weather": {
      "main": [
        [
          {
            "node": "Format weather",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format weather": {
      "main": [
        [
          {
            "node": "Rain over 50%?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Rain over 50%?": {
      "main": [
        [
          {
            "node": "Umbrella note",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Google News",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Umbrella note": {
      "main": [
        [
          {
            "node": "Google News",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google News": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gemini": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Hacker News": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "My settings": {
      "main": [
        [
          {
            "node": "Get weather",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate"
  }
}