{
  "name": "Remix 4: Rain or shine",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 7
            }
          ]
        }
      },
      "id": "67c19208-9b29-44ea-aed9-3d275d8f9ed0",
      "name": "Every morning at 7",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        -64,
        320
      ]
    },
    {
      "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": "0f716544-cda6-49d2-a479-e603788e12dd",
      "name": "My settings",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        160,
        320
      ]
    },
    {
      "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": "4b20c8fc-93a8-4b17-af54-d954e1fd36ea",
      "name": "Get weather",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        384,
        320
      ]
    },
    {
      "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": "03ea848d-24a1-4a20-884a-12d169bc4786",
      "name": "Format weather",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        608,
        320
      ]
    },
    {
      "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": "2162da8e-ab5d-4b70-bab0-126d35a7c132",
      "name": "Rain over 50%?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        1040,
        320
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "7530c764-d124-467a-834d-72fc8cd628fc",
              "name": "umbrella_note",
              "value": "☔ Take an umbrella today.",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "ae4f880d-dbe8-4e0b-96c9-031883b336c3",
      "name": "Umbrella note",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1264,
        160
      ]
    },
    {
      "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": "b1d514c7-0513-42fa-8c41-ca1a144f34f5",
      "name": "Google News",
      "type": "n8n-nodes-base.rssFeedRead",
      "typeVersion": 1.1,
      "position": [
        1488,
        320
      ]
    },
    {
      "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": "ddb5beda-3198-4949-8e9b-a471ccfc037f",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.8,
      "position": [
        1712,
        320
      ],
      "executeOnce": true
    },
    {
      "parameters": {
        "modelName": "models/gemini-3.5-flash-lite",
        "options": {}
      },
      "id": "5e7ba447-7fd5-4ccb-be70-a8fd3da4eb04",
      "name": "Gemini",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1,
      "position": [
        1712,
        560
      ]
    },
    {
      "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": "2f14dbee-661f-44d6-8fb4-1ade124c68f5",
      "name": "Hacker News",
      "type": "n8n-nodes-base.httpRequestTool",
      "typeVersion": 4.2,
      "position": [
        1856,
        560
      ]
    },
    {
      "parameters": {
        "sendTo": "={{ $('My settings').first().json.email }}",
        "subject": "=Your daily brief, {{ $now.toFormat('ccc d LLL') }}",
        "emailType": "text",
        "message": "={{ $('Weather tip').first().json.tip }}\n{{ $('Umbrella note').isExecuted ? $('Umbrella note').first().json.umbrella_note + '\\n\\n' : '' }}{{ $json.output }}",
        "options": {
          "appendAttribution": false
        }
      },
      "id": "42d0948c-9daa-446d-b0dc-da5b6abf1f79",
      "name": "Send brief",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        2080,
        320
      ],
      "webhookId": "1a5ac51b-cf30-41ec-a116-7b76bd1d479f"
    },
    {
      "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": 1520,
        "color": 7
      },
      "id": "4189de25-43a6-4574-9f84-989e47145930",
      "name": "Stage 1",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -128,
        80
      ]
    },
    {
      "parameters": {
        "content": "## 3. News\nGoogle News (fixed) and Hacker News (a tool the agent can call).",
        "height": 640,
        "width": 200,
        "color": 6
      },
      "id": "2c1e7fe6-c53e-47ad-ada3-24410bdb210c",
      "name": "Stage 3",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1424,
        80
      ]
    },
    {
      "parameters": {
        "content": "## 2. The agent\nGemini writes the brief.",
        "height": 640,
        "width": 364,
        "color": 5
      },
      "id": "339e7ca6-beb9-475e-a8ca-294dc6e61d1e",
      "name": "Stage 2",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1648,
        80
      ]
    },
    {
      "parameters": {
        "content": "## 4. Send\nEmail to yourself. Then switch the workflow on.",
        "height": 644,
        "width": 260,
        "color": 4
      },
      "id": "5f341643-15ea-48a8-b736-524c8547f36d",
      "name": "Stage 4",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        2032,
        80
      ]
    },
    {
      "parameters": {
        "jsCode": "const w = $input.first().json;\nlet tip;\nif (w.rain_chance > 70) tip = '🚆 Heavy rain likely: take the bus or train.';\nelse if (w.temp_max < 5) tip = '🧣 Cold day: wrap up warm.';\nelse if (w.temp_max > 25) tip = '🕶️ Warm day: bring water and sunscreen.';\nelse tip = '🚲 Good day to bike.';\nreturn [{ json: { ...w, tip } }];"
      },
      "id": "03dd6926-bd3c-47af-9d98-9b76b6c75dff",
      "name": "Weather tip",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        832,
        320
      ]
    },
    {
      "parameters": {
        "content": "## Remix: Rain or shine\nA Code node with your own weather rules in JavaScript. The tip goes on top of every brief. Change the thresholds and messages to your taste.",
        "height": 136,
        "width": 356,
        "color": 3
      },
      "id": "88a8a938-50d5-4851-b598-800f1fc6d13c",
      "name": "Remix note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1648,
        752
      ]
    }
  ],
  "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": "Weather tip",
            "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
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Send brief",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "My settings": {
      "main": [
        [
          {
            "node": "Get weather",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Weather tip": {
      "main": [
        [
          {
            "node": "Rain over 50%?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate"
  }
}