Practical Exercise: Daily Weather Forecast Fetcher with n8n

Let’s apply the n8n concepts by building a workflow that gets a daily weather forecast. Build a complete, functional workflow from trigger to output:

  • Objective: Create a workflow triggered by a Schedule node that fetches weather data from the free Pirate Weather API, formats it, and outputs a readable summary.
  • Step-by-Step Guide:
    1. Add a Schedule Trigger: Drag it onto the canvas and set it to run daily.
    2. Add an HTTP Request Node: Connect it to the Schedule node. This node will call the weather API.
      • Set Method to GET.
      • For the URL, use the Pirate Weather format: https://api.pirateweather.net/forecast/[YourAPIKey]/[Latitude],[Longitude]. You can get a free API key from their website.
      • Add query parameters like ?units=si for metric units.
    3. Add a Set Node (for Transformation): Connect it to the HTTP node to format the raw API data.
      • In the Add Value field, create a new field like weather_summary.
      • In its expression editor, craft a readable string by referencing data from the previous node: Today’s forecast for {{ $json.latitude }}, {{ $json.longitude }}: {{ $json.daily.summary }} High: {{ $json.daily.data[0].temperatureHigh }}°C.
    4. Add a Result Node: Connect the Set node to a Code or Email Send node. Configure it to log or send the weather_summary field you created.

Let us summarize the components we used in our example above:

Components in n8n


If you liked the tutorial, spread the word and share the link and our website, Studyopedia, with others.


For Videos, Join Our YouTube Channel: Join Now


Read More:

Transforming Data Between Nodes in n8n
AI-Powered Workflows: Configuring the AI Agent and Chat Model nodes
Studyopedia Editorial Staff
contact@studyopedia.com

We work to create programming tutorials for all.

No Comments

Post A Comment