{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "ee5c851f-b27a-4e3b-8072-983ba221f2b1",
      "name": "Daily Schedule (8 AM)",
      "type": "n8n-nodes-base.cron",
      "position": [
        32,
        368
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "5a4f19c1-37cb-4802-ab9c-437791774ffd",
      "name": "Fetch Weather Data",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        288,
        368
      ],
      "parameters": {
        "url": "https://api.openweathermap.org/data/2.5/weather?q={{ encodeURIComponent('London') }}&units=metric&appid=YOUR_OPENWEATHERMAP_API_KEY",
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "8d9c1007-5c33-4217-bf9d-bb62a17a6959",
      "name": "Format Weather Report",
      "type": "n8n-nodes-base.code",
      "position": [
        544,
        368
      ],
      "parameters": {
        "jsCode": "const weatherData = $input.first().json;\n\nconst city = weatherData.name;\nconst description = weatherData.weather[0].description;\nconst temp = weatherData.main.temp;\nconst feelsLike = weatherData.main.feels_like;\nconst humidity = weatherData.main.humidity;\nconst windSpeed = weatherData.wind.speed;\n\nconst report = `\nGood morning!\n\nHere's your daily weather report for ${city}:\n\nConditions: ${description.charAt(0).toUpperCase() + description.slice(1)}\nTemperature: ${temp}\u00b0C (Feels like: ${feelsLike}\u00b0C)\nHumidity: ${humidity}%\nWind Speed: ${windSpeed} m/s\n\nHave a great day!\n`;\n\nreturn [{ json: { report: report, city: city } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "76c9bf47-e0af-4d92-ad91-3fa8bb368dc3",
      "name": "Send Email Report",
      "type": "n8n-nodes-base.gmail",
      "position": [
        784,
        368
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "={{ $json.report }}",
        "options": {},
        "subject": "Daily Weather Report for {{ $json.city }}",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "f610daff-486e-4ef6-a20d-6f86451873ee",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -32,
        32
      ],
      "parameters": {
        "width": 416,
        "height": 240,
        "content": "## Daily Weather Report to Email\n\n**Author: David Olusola**\n\nDescription: This workflow runs daily, fetches current weather data for a specified city using the OpenWeatherMap API, and sends a formatted weather report to your email.\n\nUse Case: Daily digests, automated reports, personalized notifications."
      },
      "typeVersion": 1
    },
    {
      "id": "83443a67-aa2c-44e1-b8cf-89ddb35f2c67",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        32
      ],
      "parameters": {
        "width": 528,
        "height": 464,
        "content": "## Set up steps\nBefore  Running :\n\nOpenWeatherMap API Key: Go to OpenWeatherMap and sign up for a free API key. Replace YOUR_OPENWEATHERMAP_API_KEY in the \"Fetch Weather Data\" node's URL.\n\nAdjust City: Change London in the \"Fetch Weather Data\" node's URL to your desired city.\n\nSet up Gmail Credentials: In n8n, create a Gmail OAuth2 credential.\n\nRecipient Email: Replace your_email@example.com in the \"Send Email Report\" node with your actual email address.\n\nSchedule: The \"Daily Schedule (8 AM)\" node is set to run every day at 8 AM. You can adjust the hour and minute parameters as needed."
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Fetch Weather Data": {
      "main": [
        [
          {
            "node": "Format Weather Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Daily Schedule (8 AM)": {
      "main": [
        [
          {
            "node": "Fetch Weather Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Weather Report": {
      "main": [
        [
          {
            "node": "Send Email Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}