{
  "name": "Remix 7: Talk back",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 7
            }
          ]
        }
      },
      "id": "dc8ef5cc-638c-4114-b3cd-76e988094e5f",
      "name": "Every morning at 7",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        144,
        160
      ]
    },
    {
      "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"
            },
            {
              "id": "0fe7f057-75a6-4c91-a3a4-8d1d410c4ee9",
              "name": "telegram_chat_id",
              "value": "PASTE_YOUR_CHAT_ID",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "ceeeebbe-1dc6-479d-b8bf-671b1384da3f",
      "name": "My settings",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        368,
        160
      ]
    },
    {
      "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": "0943c591-49b2-426d-a9c0-5fb09a5c2d96",
      "name": "Get weather",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        592,
        160
      ]
    },
    {
      "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": "29a6751a-27cb-47c3-8389-dfd19e42f437",
      "name": "Format weather",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        816,
        160
      ]
    },
    {
      "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": "ed27a758-ae9e-4f9e-9c3d-56f5de7c9af6",
      "name": "Rain over 50%?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        1024,
        160
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "7530c764-d124-467a-834d-72fc8cd628fc",
              "name": "umbrella_note",
              "value": "☔ Take an umbrella today.",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "b9bf3b7a-8a06-42bc-b8c2-08841da28ff6",
      "name": "Umbrella note",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1248,
        0
      ]
    },
    {
      "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": "67724f61-b24b-4158-8383-87614274ea72",
      "name": "Google News",
      "type": "n8n-nodes-base.rssFeedRead",
      "typeVersion": 1.1,
      "position": [
        1472,
        160
      ]
    },
    {
      "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": "3d361ca4-74a7-4173-863e-2b633f52ad75",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.8,
      "position": [
        1696,
        160
      ],
      "executeOnce": true
    },
    {
      "parameters": {
        "modelName": "models/gemini-3.5-flash-lite",
        "options": {}
      },
      "id": "20689cd2-632f-4d23-be18-f0dcc4c2855e",
      "name": "Gemini",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1,
      "position": [
        1696,
        400
      ]
    },
    {
      "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": "9cd929a3-f604-46f0-a1f6-97f80d1b1428",
      "name": "Hacker News",
      "type": "n8n-nodes-base.httpRequestTool",
      "typeVersion": 4.2,
      "position": [
        1840,
        400
      ]
    },
    {
      "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": "e08bf3bf-097d-4576-97d1-ee741b1f9739",
      "name": "Stage 1",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        80,
        -80
      ]
    },
    {
      "parameters": {
        "content": "## 3. News\nGoogle News (fixed) and Hacker News (a tool the agent can call).",
        "height": 640,
        "width": 200,
        "color": 6
      },
      "id": "fdf36972-6932-4718-a026-8b53aa6c261c",
      "name": "Stage 3",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1408,
        -80
      ]
    },
    {
      "parameters": {
        "content": "## 2. The agent\nGemini writes the brief.",
        "height": 640,
        "width": 364,
        "color": 5
      },
      "id": "89cbed06-10f1-4a26-9f48-2beaaedf93fd",
      "name": "Stage 2",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1632,
        -80
      ]
    },
    {
      "parameters": {
        "content": "## 4. Send\nEmail to yourself. Then switch the workflow on.",
        "height": 644,
        "width": 260,
        "color": 4
      },
      "id": "1c5013ad-a6dc-4ab3-a3d8-5acd1a7f87ad",
      "name": "Stage 4",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        2016,
        -80
      ]
    },
    {
      "parameters": {
        "chatId": "={{ $('My settings').first().json.telegram_chat_id }}",
        "text": "={{ $('Umbrella note').isExecuted ? $('Umbrella note').first().json.umbrella_note + '\\n\\n' : '' }}{{ $json.output }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "id": "4a7b7414-329c-46bb-8d4f-06e3f15aca12",
      "name": "Send brief on Telegram",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        2064,
        160
      ],
      "webhookId": "7b921263-12a5-46c7-bdee-0ef5bdae550b"
    },
    {
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "id": "3e4cc988-792f-4aea-b076-6be386962534",
      "name": "Telegram message",
      "type": "n8n-nodes-base.telegramTrigger",
      "typeVersion": 1.2,
      "position": [
        352,
        656
      ],
      "webhookId": "8342b06b-2adc-4b01-a549-9ad7cf25ebc2"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.message.reply_to_message ? 'This is the brief I am replying to:\\n' + $json.message.reply_to_message.text + '\\n\\n' : '' }}My message: {{ $json.message.text }}",
        "options": {
          "systemMessage": "You are my morning briefing assistant, now in a chat on Telegram.\nAnswer questions about my brief and its stories. Keep answers short, plain text, no Markdown.\nUse the Hacker News tool when I ask about tech news. If you do not know something, say so. Never make up news."
        }
      },
      "id": "9c46e7af-579c-4595-9cf5-20461e1fb4d6",
      "name": "Chat agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.8,
      "position": [
        608,
        656
      ]
    },
    {
      "parameters": {
        "modelName": "models/gemini-3.5-flash-lite",
        "options": {}
      },
      "id": "06724345-8875-412f-8cec-64a099a3aea2",
      "name": "Gemini (chat)",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1,
      "position": [
        544,
        896
      ]
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $('Telegram message').first().json.message.chat.id }}",
        "contextWindowLength": 10
      },
      "id": "40f2eb7b-46f7-41aa-8759-92cc926f239b",
      "name": "Chat memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        704,
        896
      ]
    },
    {
      "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": "0e793bc7-0c6b-48bf-aa5e-9ad85ab61a5e",
      "name": "Hacker News (chat)",
      "type": "n8n-nodes-base.httpRequestTool",
      "typeVersion": 4.2,
      "position": [
        864,
        896
      ]
    },
    {
      "parameters": {
        "chatId": "={{ $('Telegram message').first().json.message.chat.id }}",
        "text": "={{ $json.output }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "id": "5da3d3a1-057c-48fb-ade0-8384868a9681",
      "name": "Reply on Telegram",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        992,
        656
      ],
      "webhookId": "55f87da5-5eea-40b9-b04f-44ac8dbdf638"
    },
    {
      "parameters": {
        "content": "## Remix: Talk back\nThe brief now arrives on Telegram. Reply to it and ask questions: the chat agent gets the brief you replied to, remembers the conversation and can check Hacker News.\n\n1. Create a bot with @BotFather and add the token as Telegram credential.\n2. Send your bot a message, run the Telegram trigger once and copy message.chat.id into My settings.\n3. Activate the workflow so the bot keeps listening.",
        "height": 212,
        "width": 560,
        "color": 3
      },
      "id": "62105414-bf16-43c7-b17b-102cd8bec3d9",
      "name": "Remix note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1568,
        576
      ]
    }
  ],
  "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
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Send brief on Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "My settings": {
      "main": [
        [
          {
            "node": "Get weather",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram message": {
      "main": [
        [
          {
            "node": "Chat agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gemini (chat)": {
      "ai_languageModel": [
        [
          {
            "node": "Chat agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Chat memory": {
      "ai_memory": [
        [
          {
            "node": "Chat agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Hacker News (chat)": {
      "ai_tool": [
        [
          {
            "node": "Chat agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Chat agent": {
      "main": [
        [
          {
            "node": "Reply on Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate"
  }
}