Build a Weather Alert Automation
Build a multi-step n8n workflow that fetches live weather data and routes alerts.
Introduction
30 Second Summary
Think about how many times you check the weather before deciding what to wear or whether to carry an umbrella. Now imagine a system that checks for you and only alerts you when conditions actually matter. That's the power of automation with conditional logic.
In this project, you will build a weather alert automation using n8n, a visual workflow tool that connects APIs, transforms data, and makes decisions without writing traditional code.
What You'll Build
A multi-step automation workflow in n8n that fetches live weather data, extracts the temperature, and sends different alert messages depending on whether it's hot or comfortable outside.
By the end of this project, you'll have:
- A locally running n8n instance powered by Docker, giving you unlimited workflow executions for free.
- A complete 5-node workflow with a schedule trigger, API call, data extraction, conditional branching, and formatted alert outputs.
- A reusable "fetch data, decide, act" pattern you can adapt for any automation that needs to pull information and respond based on conditions.
- Secret Mission: Extend your workflow to monitor multiple cities and compare their temperatures side by side.
Are there any prerequisites?
None. This guide walks you through installing Docker and running n8n from scratch. No prior experience with automation tools or APIs is required.
Set Up Docker and Run n8n
n8n is a workflow automation tool that runs inside a Docker container. Think of Docker as a lightweight box that packages up everything n8n needs to run, so you don't have to install a bunch of dependencies on your machine.
In this step, you'll install Docker Desktop, spin up the n8n container, and log in to the n8n editor where you'll build your automation.
In this step, get ready to:
- Install Docker Desktop and verify it's running.
- Run the n8n container with persistent data storage.
- Access the n8n editor and create your owner account.
Install Docker Desktop and verify it's running
Docker Desktop is the app that runs the Docker engine on your Mac. You already have the installer downloaded. Now you need to install it and confirm Docker is ready.
- Double-click Docker.dmg to open the installer.
- Drag the Docker icon into the **Applications** folder.Applications folder.
- Press Cmd+Space (macOS) or the Windows key (Windows) to open your search bar.
- Type Docker and press Enter to open Docker Desktop.
What happens when Docker Desktop opens for the first time?
Docker Desktop presents a setup wizard. It will ask you to accept the Docker Subscription Service Agreement and choose your settings.
Select Accept on the service agreement, then choose Use recommended settings when prompted. You may need to enter your Mac password to grant permissions. Finally, click Finish.
- Accept the Docker Subscription Service Agreement when prompted.
- Select Use recommended settings and click Finish.
- Wait for Docker Desktop to finish starting. You'll see the Docker whale icon in your menu bar at the top of the screen.
Now verify Docker is ready by opening your terminal.
- Press Cmd+Space (macOS) or the Windows key (Windows) to open your search bar.
- Type Terminal and press Enter to open it.
- Check that Docker is running by running this command:
docker --version
✔️ I see a version number
Docker is installed and ready to go. You'll see something like Docker version 27.x.x followed by a build hash. The exact version doesn't matter for this project.
ⓧ Command not found
Docker Desktop might still be starting up, or the installation didn't finish correctly.
- Check your menu bar for the Docker whale icon. If it's animating, Docker is still starting. Wait until it stops animating.
- If there's no whale icon, open Docker Desktop again from your Applications folder.
- Close and reopen your Terminal window after Docker Desktop finishes starting.
Try running docker --version again after Docker Desktop has fully started.
Run the n8n Docker container with persistent data storage
With Docker running, you can now launch n8n. You'll create a Docker volume first to store your workflow data, then start the n8n container.
What is a Docker volume?
A Docker volume is a storage space that lives outside the container. If you ever stop or remove the container, your workflows and settings are safely stored in the volume and ready to use when you start n8n again.
- Create the Docker volume for n8n's data by running this command:
docker volume create n8n_data
What does this command do?
This creates a named volume called n8n_data on your machine. n8n will use this volume to save all your workflows, credentials, and settings.
- Start the n8n container by running this command:
docker run -d --name n8n -p 5678:5678 -v n8n_data:/home/node/.n8n docker.n8n.io/n8nio/n8n
What does this command do?
Here's what each part means:
- -d runs the container in the background so your terminal stays free.
- --name n8n gives the container a friendly name you can reference later.
- -p 5678:5678 maps port 5678 on your Mac to port 5678 inside the container. This is how you'll access n8n in your browser.
- -v n8n_data:/home/node/.n8n connects the volume you just created to n8n's internal data folder.
- docker.n8n.io/n8nio/n8n is the official n8n Docker image.
Docker will download the n8n image (this may take a minute the first time) and output a long string of characters. That string is the container ID, which confirms n8n is running.
- Confirm the container is running by running this command:
docker ps
You should see a table with one row showing the n8n container with status Up and port 5678 listed.
Don't see the n8n container?
If docker ps shows an empty table, the container might have exited. Run docker ps -a to see all containers (including stopped ones) and check the STATUS column for an error.
A common cause is that port 5678 is already in use by another app. Try stopping whatever is using that port, remove the failed container with docker rm n8n, and re-run the docker run command above.
Need more help? Why isn't my n8n Docker container starting?
Access the n8n editor and create your owner account
n8n is now running inside Docker and serving its editor on port 5678. You can access it through your web browser.
- Open your web browser (Chrome, Safari, Firefox, or any browser you prefer).
- Navigate to the following URL:
http://localhost:5678
You'll see the n8n setup page asking you to create an owner account. This account is stored locally in your Docker volume, not on any external server.
- Enter your name in the First name and Last name fields.
- Enter an email address in the Email field.
- Create a password and enter it in the Password field.
- Click Next to create your account.
These credentials are local only
The email and password you enter here are only used to log in to this local n8n instance. They don't create an account on n8n's cloud service. Use anything you'll remember.
After creating your account, n8n may show a survey or onboarding screen. You can skip these to go straight to the editor.
- Skip any onboarding prompts until you reach the n8n editor canvas. You'll see an empty workspace with a + button in the center.
What is the n8n editor?
The n8n editor is a visual canvas where you build automation workflows by connecting nodes. Each node represents one step in your automation (fetching data, transforming it, making a decision). You'll be adding nodes to this canvas throughout the project.
Your n8n instance is running and ready to build workflows. Next up, you'll create your first workflow and fetch live weather data from a real API.
Create Your Workflow and Fetch Weather Data
Your n8n instance is up and running. Now it's time to put it to work by building your first automation workflow.
Every n8n workflow starts with a trigger node and chains together action nodes that process data step by step. You'll create a workflow that connects to a live weather API and pulls real-time temperature data onto your canvas.
In this step, get ready to:
- Create a new workflow with a Manual Trigger node.
- Fetch live weather data using an HTTP Request node.
- Inspect the API response to find the temperature field.
Create a new workflow and add a Manual Trigger node
A workflow in n8n is a visual sequence of connected nodes. Each node performs one task, and the first node is always a trigger that decides when the workflow runs.
- In the n8n editor, click the workflow name at the top of the canvas (it defaults to My workflow).
- Rename the workflow to Weather Alert and press Enter to confirm.
- Open the nodes panel by clicking the + icon in the top right corner of the canvas (or press N on your keyboard).
- Search for Manual Trigger and select it to add it to your canvas.
The Manual Trigger node appears on your canvas. This lets you run the workflow on demand during development instead of waiting for a schedule.
What is a Manual Trigger?
The Manual Trigger is a development convenience. It starts the workflow whenever you click the execute button, so you can test each node as you build.
Later in this project, you'll swap it for a Schedule Trigger that runs automatically at a set time.
Add an HTTP Request node to fetch weather data
The HTTP Request node calls external APIs and brings their data into your workflow. You'll point it at wttr.in, a free weather API that returns JSON data with no authentication required.
- Click the + connector on the right side of the Manual Trigger node to add a new connected node.
- Search for HTTP Request and select it.
- In the node's Parameters panel, confirm the Method is set to GET.
- In the URL field, enter https://wttr.in/London?format=j1.
What is wttr.in?
wttr.in is a free public weather service that handles around 100 million queries per day. It requires no API key or signup.
The ?format=j1 parameter tells it to return structured JSON instead of a text-based forecast. You can swap London for any city name.
Use your own city
Replace London in the URL with the name of your city to get local weather data. Multi-word city names use a + between words (e.g. New+York).
Execute the node and inspect the JSON response
Now you'll run the HTTP Request node to pull live data into your workflow and explore what the API returns.
- With the HTTP Request node open, click the Execute step button at the top of the node panel.
- Wait a moment for the response to appear in the Output section below the parameters.
- Click JSON in the output view toggle (Table | JSON | Schema) to see the raw JSON response.
- Scroll through the JSON and locate the current_condition array. Inside the first item (current_condition[0]), find the temp_C field. This is the current temperature in Celsius.
You should see a green checkmark next to the Output title, confirming the API call succeeded. The JSON includes fields like temp_C, humidity, weatherDesc, and windspeedKmph.
What does this JSON structure look like?
The wttr.in response is a nested JSON object. The temperature lives at current_condition[0].temp_C. This path means: go into the current_condition array, take the first item, and read its temp_C value.
In the next step, you'll use an n8n expression to extract this exact value automatically.
- Save your workflow by pressing Cmd+S (macOS) or Ctrl+S (Windows).
Not seeing any output data?
Make sure the HTTP Request node is connected to the Manual Trigger with a line between them. If the nodes are not connected, drag from the Manual Trigger's output connector to the HTTP Request's input connector.
If you see a red error icon, double-check that the URL is exactly https://wttr.in/London?format=j1 with no extra spaces or typos.
Why is my HTTP Request node not returning data?
You now have live weather data flowing through your workflow. Next up, you'll extract the temperature and add conditional logic to decide whether to send a hot weather alert or a comfortable weather update.
Extract Temperature and Add Conditional Logic
Your HTTP Request node is pulling in a full page of weather data. That raw JSON contains dozens of fields, but your workflow only cares about one thing: the current temperature.
In this step, you'll teach your workflow to extract that single value and make a decision based on it. This is where your automation gets smart.
In this step, get ready to:
- Extract the temperature from the nested JSON response.
- Add conditional logic that routes data based on whether it's hot outside.
- Test both branches of the condition to verify your logic works.
Add an Edit Fields node to extract temperature
The JSON response from wttr.in contains nested arrays and objects. You need a way to pull out just the temperature value and give it a clean, simple name that downstream nodes can reference easily.
What is an Edit Fields node?
An Edit Fields node (sometimes called "Set" in older n8n versions) lets you create new fields or reshape data between steps. Think of it as a translator that takes messy input and outputs exactly the fields you need.
- Click the + button to the right of your HTTP Request node to add a new node after it.
- Search for Edit Fields in the node search panel.
- Click Edit Fields (Set) to add it to your workflow.
The Edit Fields configuration panel opens. Now you'll add a field that extracts the temperature.
- Click Add Field in the configuration panel.
- In the Name field, type:
temperature
- Click the Value field. Instead of typing a static value, you'll use an expression to dynamically pull data from the previous node.
- Click the Expression tab (or toggle) in the value field to switch from fixed mode to expression mode.
- Enter the following expression:
{{ $json.current_condition[0].temp_C }}
What does this expression do?
The {{ }} syntax tells n8n to evaluate an expression instead of using a plain string. $json references data from the previous node's output.
The path current_condition[0].temp_C navigates into the nested JSON structure. It accesses the first item in the current_condition array, then grabs the temp_C field (temperature in Celsius).
- Close the Edit Fields configuration panel by clicking Back to canvas or clicking on the canvas background.
- Verify that the Edit Fields node is connected between your HTTP Request node and the end of the workflow.
Expression not resolving?
Make sure you switched to Expression mode in the value field. If you're in Fixed mode, n8n treats your input as a plain string.
Double check that the expression starts with {{ and ends with }}. Missing braces will cause a syntax error.
If you see "undefined" as the result, check the path. It should be current_condition[0].temp_C with a zero index.
Still stuck? Help me fix my n8n expression for extracting temperature from the wttr.in JSON response.
Add an If node to check the temperature
Now that your workflow can extract a clean temperature value, you need decision-making logic. An If node evaluates a condition and splits the workflow into two paths: one for when the condition is true, and one for when it's false.
- Click the + button to the right of your Edit Fields node.
- Search for If in the node search panel.
- Click If to add the conditional node to your workflow.
The If node configuration panel opens. You'll set up a condition that checks whether the temperature is above 30°C.
- In the first condition row, click the Value 1 field.
- Switch to Expression mode, then enter:
{{ $json.temperature }}
- Set the Operation dropdown to is greater than (or the > operator).
- In the Value 2 field, type:
30
What does this condition do?
The If node receives the temperature field you created in the Edit Fields node. It compares that value against 30.
If the temperature is above 30°C, data flows down the true branch (hot weather). If it's 30 or below, data flows down the false branch (not hot).
- Close the If node configuration panel.
Your canvas should now show 4 nodes connected in sequence: Manual Trigger, HTTP Request, Edit Fields, and If.
Test the conditional branch
Time to run the full workflow and see your conditional logic in action. You'll watch data flow through each node and verify which branch the If node sends it down.
- Click Test workflow in the top right corner of the canvas to execute the entire workflow from the Manual Trigger.
- Wait for execution to complete. You'll see green indicators on each node as data passes through it.
- Click on the Edit Fields node to inspect its output. You should see a single field called temperature with the current temperature value for London.
- Click on the If node to inspect its output. Check whether data appeared on the true or false branch based on the current temperature.
What if my temperature is below 30?
That's completely normal. London's temperature is often below 30°C. The important thing is that data flows down one of the two branches.
If you want to see the true branch in action, temporarily change the threshold from 30 to a value below the current temperature (like 5), run the test again, then change it back to 30.
Seeing an error on the If node?
If the If node shows an error, click on the Edit Fields node output first. Make sure the temperature field exists and contains a number.
If temperature is empty or shows "undefined", go back to the Edit Fields node and check your expression. The path must be {{ $json.current_condition[0].temp_C }} exactly.
Need more help? Help me debug my If node in n8n that's failing to compare the temperature value.
Your workflow now has real intelligence. It fetches weather data, extracts exactly what it needs, and makes decisions based on that data. Next up, you'll format human-readable alert messages for each branch and set the workflow to run on a schedule.
Format Alert Messages and Add a Schedule Trigger
In the previous step, you built the decision-making logic for your weather workflow. Your If node now splits data into a hot path and a not-hot path based on temperature.
Right now those branches lead nowhere. In this step, you will format human-readable alert messages on each branch and replace the Manual Trigger with a Schedule Trigger so your workflow runs automatically every day.
In this step, get ready to:
- Add Edit Fields (Set) nodes to format alert messages on both the true and false branches.
- Replace the Manual Trigger with a Schedule Trigger that fires daily at 8:00 AM.
- Test the full workflow end-to-end and publish it so the schedule goes live.
Add alert message nodes to both branches
Each branch of your If node should produce a clear, formatted message that tells you whether the weather is hot or comfortable. You will use an Edit Fields (Set) node on each branch to compose these messages.
Let's start with the hot weather (true) branch.
- In your workflow canvas, click the + connector on the true (green) output of the If node.
- Search for Edit Fields in the node search panel.
- Select Edit Fields (Set) when it appears in the results.
Now configure this node to produce a hot weather warning message.
- In the node configuration panel, click Add Field and select String as the type.
- Set the field Name to message.
- Click on the Value field. You will see a Fixed / Expression toggle. Select Expression.
- Enter the following expression in the expression editor:
🔥 Hot weather alert! It is {{ $json.temperature }}°C in London. Stay hydrated!
What does this expression do?
The {{ $json.temperature }} part pulls the temperature value from the previous node's output. n8n replaces it with the actual number at runtime, producing a message like "It is 34°C in London."
- Close the node panel to return to the canvas.
Now repeat the same process for the comfortable weather (false) branch.
- Click the + connector on the false (red) output of the If node.
- Search for Edit Fields and add another Edit Fields (Set) node.
- Click Add Field and select String as the type.
- Set the field Name to message.
- Toggle the Value field to Expression mode.
- Enter the following expression:
🌤 Weather update: It is {{ $json.temperature }}°C in London. Enjoy your day!
- Close the node panel to return to the canvas.
Your workflow now has 6 nodes. Both branches of the If node end with a Set node that produces a formatted message.
Why use Edit Fields for messages?
The Edit Fields (Set) node lets you create new fields with expression-based values. This is the standard way to compose formatted output in n8n before passing it to a downstream action like sending an email or posting to Slack.
- Test your alert messages by clicking Execute Workflow in the top toolbar.
- Click on one of the new Set nodes to open it and inspect the OUTPUT panel.
You should see your formatted message string with the actual temperature value filled in.
Not seeing a message in the output?
Make sure you toggled the Value field to Expression mode. If you left it on Fixed, n8n treats the text literally and won't replace {{ $json.temperature }} with a number.
Also check that the field name in your earlier Edit Fields node is exactly temperature (lowercase). Expression references are case-sensitive.
Why isn't my expression resolving to a value in the Set node output?
Replace the Manual Trigger with a Schedule Trigger
Your workflow currently starts only when you click Execute Workflow. To make it run automatically every morning, you will swap the Manual Trigger for a Schedule Trigger node.
- Select the Manual Trigger node on your canvas by clicking it.
- Press the Delete key on your keyboard (or click the trash can icon) to remove it.
You will see an empty starting point on the canvas. Now add the Schedule Trigger.
- Click the + button where the trigger used to be (or open the nodes panel).
- Search for Schedule Trigger and select it.
Configure the Schedule Trigger to run daily at 8:00 AM.
- Set Trigger Interval to Days.
- Set Days Between Triggers to 1.
- Set Trigger at Hour to 8am.
- Set Trigger at Minute to 0.
What is the Schedule Trigger?
The Schedule Trigger node runs your workflow at fixed intervals or specific times, similar to a cron job. It only fires when the workflow is published and active.
The timing depends on your n8n instance timezone. For self-hosted instances, this defaults to America/New_York unless you set the GENERIC_TIMEZONE environment variable when you started the container.
- Close the Schedule Trigger node panel.
- Connect the Schedule Trigger to the HTTP Request node by dragging from the Schedule Trigger's output connector to the HTTP Request node's input.
Schedule Trigger not connecting?
Make sure you deleted the Manual Trigger first. A workflow can only have one trigger node connected to the first step. If the HTTP Request node still shows a connection to the old trigger, click the connection line and press Delete.
Help me connect my Schedule Trigger to the HTTP Request node in n8n.
Test and publish the workflow
Before publishing, run one final test to confirm everything works end-to-end. After testing, you will publish the workflow so the Schedule Trigger fires automatically.
- Click Execute Workflow in the top toolbar to run the workflow manually one more time.
- Click through each node and verify data flows from the Schedule Trigger through the HTTP Request, Edit Fields, If node, and into the correct Set node branch.
You should see your formatted alert message in the output of whichever Set node received data (true or false branch depending on the current temperature).
- To publish the workflow and activate the schedule, toggle the Active switch in the top-right corner of the editor. It should turn from grey to green/orange.
Why do I need to publish?
The Schedule Trigger only fires on its schedule when the workflow is published (active). During development, the Execute Workflow button lets you test without waiting for the scheduled time. Once you toggle the workflow active, n8n will automatically run it at 8:00 AM every day.
You should see a confirmation that your workflow is now active.
Workflow running at the wrong time?
The Schedule Trigger uses your n8n instance's timezone. If you set GENERIC_TIMEZONE when you started Docker, the schedule respects that timezone. If you did not set it, n8n defaults to America/New_York.
You can also set the timezone for an individual workflow by clicking the three-dot menu in the upper-right corner, selecting Settings, and adjusting the Timezone dropdown.
Why is my n8n scheduled workflow running at an unexpected time?
Your weather alert automation is complete. You have a workflow that fetches live weather data every morning, decides whether it is hot or comfortable, and formats a clear alert message. In the Secret Mission, you will extend this to monitor multiple cities and compare their temperatures.
Secret mission
Monitor Multiple Cities
Your workflow monitors one city. But what if you could compare weather across multiple cities and determine which one is hotter? Extend your automation to fetch data for two cities, merge the results, and output a side-by-side comparison.
Clean Up Your Resources
Clean Up Your Resources
Decide whether to keep your resources running, pause them to come back later, or delete them entirely. This project runs entirely locally with Docker, so there are no ongoing cloud costs.
Resources you used:
- One Docker container named n8n running the n8n editor.
- One Docker volume named n8n_data storing all your workflow data.
Keep everything running
No action needed. Choose this if you plan to keep building workflows in n8n.
- The n8n container uses minimal resources when idle.
- Your workflows remain accessible at http://localhost:5678 whenever Docker Desktop is running.
- If Docker Desktop is closed, the container will automatically restart when you reopen Docker Desktop.
Pause - I'll come back to this later
Stop the running container to free up memory. Your workflow data persists safely in the Docker volume.
- Stop the n8n container by running this command in Terminal:
docker stop n8n
- Your workflows and account are preserved in the n8n_data volume.
- When you're ready to come back, restart the container with the same docker run command you used in Step 1.
Delete - I don't want to use this again
Remove all project resources and start fresh. This permanently deletes all your workflows.
- Stop the n8n container by running:
docker stop n8n
- Remove the stopped container by running:
docker rm n8n
- Remove the Docker volume (this deletes all your workflow data permanently) by running:
docker volume rm n8n_data
- Confirm both are gone by running:
docker ps -a | grep n8n
docker volume ls | grep n8n
Both commands should return no results.
That's a Wrap!
That's a Wrap!
Nice work! You just built your first real automation workflow using n8n and Docker.
You've learned how to:
- Set up a self-hosted n8n instance using Docker with persistent storage.
- Built a multi-node workflow that fetches live weather data, extracts values using expressions, and routes alerts with conditional logic.
- Configured a Schedule Trigger to automate your workflow on a daily schedule.
- Extended the workflow to monitor multiple cities and compare their temperatures side by side.
Ready to quiz yourself?