{
  "id": "",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Personalized Weather Assistant with Google Calendar, Weatherapi, AI & Telegram",
  "tags": [],
  "nodes": [
    {
      "id": "c3104ac5-46d1-44b0-9086-ea7126a7e872",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -900,
        -320
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 6
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "2b570610-c022-47bc-a67d-d561aacd3339",
      "name": "Get many events",
      "type": "n8n-nodes-base.googleCalendar",
      "position": [
        -560,
        -320
      ],
      "parameters": {
        "options": {},
        "timeMax": "={{ $now.setZone($json.Timezone).plus({ day: 1})}}",
        "timeMin": "={{ $now.setZone($json.Timezone) }}",
        "calendar": {
          "__rl": true,
          "mode": "list",
          "value": "primary"
        },
        "operation": "getAll"
      },
      "credentials": {
        "googleCalendarOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "a244ba68-cea7-4a97-9f40-097a04bc6417",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -120,
        -460
      ],
      "parameters": {
        "url": "=http://api.weatherapi.com/v1/current.json",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "key",
              "value": "=YOUR_WEATHERAPI_KEY"
            },
            {
              "name": "q",
              "value": "={{ $json.location }}"
            },
            {
              "name": "dt",
              "value": "={{ $json['time start'].split('T')[0] }}"
            },
            {
              "name": "hour",
              "value": "={{ parseInt($json['time start'].split('T')[1].split(':')[0]) }}"
            }
          ]
        }
      },
      "executeOnce": false,
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "bd053ee0-aa73-4012-a6e7-a11d02d11b09",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        -380,
        -320
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.location }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "f9af621c-ec65-4bb8-aed5-c3ae7c5b29fa",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        160,
        -460
      ],
      "parameters": {
        "text": "=agenda for (today, tomorrow) : {{ $('If').item.json.start.dateTime }}\nagenda: {{ $('Get many events').item.json.summary }},\nlocation: {{ $('Get many events').item.json.location }},\ntime: start {{ $('Get many events').item.json.start.dateTime }} end {{ $('Get many events').item.json.end.dateTime }},\ncondition in the location : Temperature (Feels Like) {{ $json.current.feelslike_c }}, Humidity {{ $json.current.humidity }}, UV Index {{ $json.current.uv }}, Visibility {{ $json.current.vis_km }}, Wind (Direction + Speed) {{ $json.current.wind_kph }} {{ $json.current.wind_dir }}",
        "options": {
          "systemMessage": "=You are a smart personal assistant who helps users plan their day with agenda and weather information. Present information concisely, politely, and easily read. Avoid using technical language. Communicate it simply so it's easy to understand. Write in plain text without punctuation. Add emoji to make it more interactive.\n\nFormat each agenda item:\n- Event name and location\n- Time (if available)\n- Weather conditions\n- Provide a motivating statement or lighthearted advice if the weather is bad."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2
    },
    {
      "id": "04ba0f52-addc-45fd-a53e-357b61e40212",
      "name": "OpenRouter Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        160,
        -300
      ],
      "parameters": {
        "model": "google/gemini-2.0-flash-exp:free",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "ecd56a45-2f16-40a5-87ec-d2adcae8acb1",
      "name": "Set Timezone",
      "type": "n8n-nodes-base.set",
      "position": [
        -720,
        -320
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "",
              "name": "Timezone",
              "type": "string",
              "value": "UTC"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "f5d304be-a8a5-46f0-805e-ed31ec79b14c",
      "name": "Send a text message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        520,
        -460
      ],
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "YOUR_TELEGRAM_CHAT_ID",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "8657096c-2e49-49ce-a5bd-32e1eb86af8e",
      "name": "AI Agent2",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -120,
        20
      ],
      "parameters": {
        "text": "=agenda for (today, tomorrow) : {{ $json.start.date }}\nagenda: {{ $json.summary }},\ntime: start {{ $json.start.date }} end {{ $json.end.date }},\n",
        "options": {
          "systemMessage": "=You are a smart personal assistant who helps users plan their day with agenda information. Present information concisely, politely, and easily read. Avoid using technical language; communicate it simply so it's easy to understand. Write in plain text without punctuation. Add emoji to make it more interactive.\n\nFormat each agenda item:\n- Event name\n- Time (if available)\n- Provide a motivating statement."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2
    },
    {
      "id": "ee687c11-4622-40db-b961-2c33584e8a26",
      "name": "OpenRouter Chat Model2",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        -120,
        240
      ],
      "parameters": {
        "model": "google/gemini-2.0-flash-exp:free",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "",
      "name": "Send a text message1",
      "type": "n8n-nodes-base.telegram",
      "position": [
        280,
        20
      ],
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "YOUR_TELEGRAM_CHAT_ID",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1640,
        -960
      ],
      "parameters": {
        "width": 620,
        "height": 1080,
        "content": "# Personalized Weather Assistant with Google Calendar, WeatherAPI, AI & Telegram\n\nThis workflow automates the delivery of a personalized daily agenda by combining events from Google Calendar with real time local weather conditions. Using AI powered summarization and Telegram integration, users receive a friendly and motivating message every morning with everything needed to plan the day effectively.\n\nPerfect for professionals or individuals who want an overview of their schedule and weather in one place.\n\n## \ud83d\udee0\ufe0f Key Features\n\n- Triggered automatically every morning by schedule\n- Fetches Google Calendar events for today and tomorrow\n- Retrieves weather conditions (temperature, humidity, wind, UV index) using WeatherAPI based on event location\n- Uses AI Agent to generate a concise, human-friendly agenda summary\n- Sends the summary via Telegram bot\n- If no location is available, delivers a simplified agenda without weather\n\n## \ud83d\udd27 Requirements\n\n- Google Calendar OAuth2 credentials connected to n8n\n- WeatherAPI key ([weatherapi.com](https://www.weatherapi.com/))\n- Telegram Bot Token and user `chat_id`\n- OpenRouter API Key ([openrouter.ai](https://openrouter.ai/))\n\n## \ud83e\udde9 Setup Instructions\n\n1. **Timezone**\n   - Adjust timezone in the Set Timezone node (default: UTC)\n\n2. **Google Calendar**\n   - Add Google Calendar OAuth2 credentials\n   - Set your primary calendar ID in the Get many events node\n\n3. **WeatherAPI**\n   - Replace `YOUR_WEATHERAPI_KEY` in the HTTP Request node with your WeatherAPI key\n\n4. **OpenRouter**\n   - Create credentials in n8n and connect them to the OpenRouter Chat Model nodes\n   - Replace `YOUR_OPENROUTER_CREDENTIAL_ID` with your actual credential ID\n\n5. **Telegram**\n   - Add your bot token and chat_id to both Telegram nodes\n   - Replace `YOUR_TELEGRAM_CHAT_ID` and `YOUR_TELEGRAM_CREDENTIAL_ID` with your actual values\n\n6. **Deploy**\n   - Activate the workflow\n   - You'll start receiving personalized daily Telegram messages\n\n## \u2699\ufe0f Configuration\n\n- **Schedule**: Currently set to 6 AM daily. Adjust in Schedule Trigger node\n- **Timezone**: Change in Set Timezone node to match your location\n- **Calendar**: Use 'primary' for main calendar or specific calendar ID\n- **Weather**: Automatically fetches weather for event locations\n- **AI Model**: Uses Google Gemini 2.0 Flash via OpenRouter"
      },
      "typeVersion": 1
    },
    {
      "id": "",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -940,
        -500
      ],
      "parameters": {
        "color": 2,
        "width": 680,
        "height": 340,
        "content": "- Runs workflows based on a schedule, with the default setting being 6 AM.\n- Sets the timezone so that Google Calendar events are retrieved according to local time.\n- Fetches all events from Google Calendar for today and tomorrow.\n- Checks whether each event has a location."
      },
      "typeVersion": 1
    },
    {
      "id": "",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        -620
      ],
      "parameters": {
        "color": 3,
        "width": 560,
        "height": 440,
        "content": "- Fetch local weather data from WeatherAPI, based on event location, date, and time (customizable)\n- Combine event and weather data into a single personalized message"
      },
      "typeVersion": 1
    },
    {
      "id": "",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        -120
      ],
      "parameters": {
        "color": 4,
        "width": 320,
        "height": 480,
        "content": "- If the event does not have a location, the data will still be presented in the form of a personalized message."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "",
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "AI Agent2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent2": {
      "main": [
        [
          {
            "node": "Send a text message1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Timezone": {
      "main": [
        [
          {
            "node": "Get many events",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get many events": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Set Timezone",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model2": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent2",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}