Build a Weather Alert Workflow

Build a webhook-triggered n8n workflow that fetches and classifies weather data.

Introduction

30 Second Summary

Weather apps tell you it's raining right now. What if you had a system that automatically checked conditions and routed alerts to you based on rules you set up yourself?

In this project, you will build a weather alert workflow using n8n, a visual workflow automation tool. Your workflow will fetch live weather data, evaluate conditions like rain and temperature, and return a formatted alert message through an API endpoint you create.

What You'll Build

A locally running n8n workflow that accepts location coordinates via a webhook, queries a free weather API, and routes data through conditional logic to produce classified alert messages.

By the end of this project, you'll have:

  • A webhook-triggered workflow that acts as your own personal weather alert API endpoint.
  • Hands-on experience with n8n's visual editor, including HTTP Request nodes, If nodes, and Edit Fields nodes.
  • A working understanding of conditional branching and expressions for transforming data between workflow steps.
  • Secret Mission: a scheduled workflow that automatically checks weather every hour and sends alerts to a Discord channel.

Are there any prerequisites?

None. This project includes setup instructions for everything you need. You will install Node.js and launch n8n as part of Step 1.

Install Node.js and Launch n8n

n8n is a workflow automation tool that runs on Node.js. Before you can build any workflows, you need Node.js installed on your machine so that n8n has a runtime to execute on.

In this step, you will install the correct version of Node.js, launch n8n locally using a single terminal command, and get familiar with the workflow editor.

In this step, get ready to:
  • Install and verify Node.js.
  • Launch n8n locally and create your account.
  • Explore the n8n workflow editor.
Check your Node.js installation

n8n requires Node.js version 20.19 through 24.x. You will check whether you already have a compatible version installed.

  • Press Cmd+Space (macOS) or the Windows key (Windows) to open your search bar.
  • Type Terminal and press Enter to open it.
  • Check your Node.js version by running this command:
node --version

Look at the output and pick the tab below that matches what you see.

✔️ I see a version between v20.19 and v24

Your Node.js version is compatible with n8n. You are ready to move on to launching n8n.

ⓧ I see a different version number

You have Node.js installed, but it is outside the supported range for n8n (20.19 through 24.x). You need to install a compatible version alongside it.

Why not the latest Node.js?

Homebrew's default node formula currently installs Node.js 26, which is newer than n8n supports. You need the node@24 formula to get a compatible version.

  • Install Node.js 24 using Homebrew by running:
brew install node@24
  • Follow any instructions Homebrew displays about adding node@24 to your PATH (it is keg-only, so Homebrew does not link it automatically).
  • Verify the new version by running:
node --version

You should now see a version starting with v24.

Alternatively, you can download a compatible version directly from https://nodejs.org/.

ⓧ Command not found

Node.js is not installed on your machine. You will install it now.

What is Homebrew?

Homebrew is a package manager for macOS that lets you install developer tools from the terminal. If you do not have Homebrew installed, visit https://brew.sh and follow the one-line install instructions first.

  • Install Node.js 24 using Homebrew by running:
brew install node@24
  • Follow any instructions Homebrew displays about adding node@24 to your PATH.
  • Verify the installation by running:
node --version

You should see a version starting with v24. You can also download Node.js directly from https://nodejs.org/ if you prefer not to use Homebrew.

Brew command not found?

If your terminal says brew: command not found, Homebrew is not installed yet. Visit https://brew.sh and run the install script shown on the page. Then close and reopen Terminal before trying again.

Help me install Homebrew and Node.js on my Mac.

Launch n8n with npx

With Node.js installed, you can launch n8n using a single command. The npx tool (bundled with Node.js) downloads and runs n8n without a permanent global install.

  • Launch n8n by running this command in your terminal:
npx n8n

What does this command do?

npx n8n downloads the n8n package from npm and starts a local server. All your workflow data is stored in a ~/.n8n folder on your machine.

The first time you run this, it may take a minute to download. You will see log output in the terminal as n8n starts up.

  • Wait for the terminal to display a message indicating n8n is ready (you will see the URL http://localhost:5678 in the output).
  • Open your web browser and go to http://localhost:5678.

Keep this terminal window open

The npx n8n process must keep running for n8n to work. Do not close this terminal window. You will open a second terminal window later when you need to test your workflow.

n8n displays a setup screen on first launch. You need to create an owner account to access the editor.

  • Enter your email address in the Email field.
  • Enter your first name in the First name field.
  • Enter your last name in the Last name field.
  • Create a password (at least 8 characters, including one number and one capital letter).
  • Click Next to complete the setup.

What is this account for?

This creates a local owner account for your n8n instance. It only exists on your machine and is not sent to any external server. You will use it to log back in if you restart n8n later.

After completing the setup, n8n logs you in and shows the Overview page.

n8n not loading in the browser?

Make sure the terminal still shows n8n running. If you accidentally closed it, run npx n8n again.

Check that you typed the URL exactly as http://localhost:5678 (not https).

Help me troubleshoot n8n not loading in my browser.

Explore the n8n editor UI

Before you start building, take a moment to identify the key areas of the n8n editor. Knowing where things live will save you time in the next steps.

  • Create a new workflow by clicking Create Workflow on the Overview page (or select Start from Scratch if prompted).

You should see a blank canvas with a large + button in the center. This is the workflow editor.

  • Identify the canvas. This is the large center area where you will drag and connect nodes to build your workflow.
  • Open the nodes panel by clicking the + icon on the canvas (or pressing the N key on your keyboard). This panel lists all the available nodes you can add to your workflow.
  • Close the nodes panel by pressing Escape or clicking outside it.
  • Locate the Execute Workflow button at the top of the canvas. You will use this later to run your completed workflow.

What are nodes?

In n8n, every action in your workflow is represented by a node. A node might fetch data from an API, transform data, or make a decision. You connect nodes together on the canvas to create an automation flow.

Your n8n instance is up and running. Next up, you will create your first workflow node and set up a webhook trigger that listens for incoming data.

Create the Webhook Trigger

Your n8n instance is up and running. Now it's time to build the actual workflow, starting with its entry point.

Every automation needs a trigger that kicks it off. You'll create a Webhook trigger that listens for incoming HTTP requests containing location coordinates.

In this step, get ready to:
  • Create a new workflow and add a Webhook trigger node.
  • Configure the webhook to wait for processing before responding.
  • Test the webhook by sending a POST request with location data.
Create a new workflow and add the Webhook node
  • In the n8n editor, click the n8n logo in the top-left corner to go to the Overview page.
  • Click Start from Scratch to create a new blank workflow.
  • On the empty workflow canvas, click Add first step in the center.
  • In the search panel that appears, type Webhook and select the Webhook node from the results.
  • In the Webhook node panel on the right, find the HTTP Method dropdown and set it to POST.
  • Look at the top of the node panel for the Test URL. This is the address you'll use to trigger the workflow during development.

What is a webhook?

A webhook is a URL endpoint that waits for incoming HTTP requests. When a request arrives, it triggers an action.

In this case, the Webhook node acts as the front door for your workflow. Any POST request sent to its URL will kick off the entire automation chain you're about to build.

Configure the webhook response behavior

By default, n8n sends a response immediately when it receives a request. You need it to wait until your workflow finishes processing before responding with useful data.

  • In the Webhook node panel, find the Respond dropdown (below the HTTP Method).
  • Change it to Using 'Respond to Webhook' Node.

Why 'Using Respond to Webhook Node'?

This setting tells n8n to hold the HTTP connection open until a Respond to Webhook node executes later in the workflow. Without it, n8n would immediately reply with a generic confirmation before your workflow finishes processing the weather data.

You'll add the Respond to Webhook node in a later step, after the data has been fetched and classified.

Test the webhook with a curl request

Time to verify that the webhook can receive data. You'll send a test request with sample latitude and longitude coordinates.

  • In the Webhook node panel, click Listen for Test Event at the top. The node is now actively waiting for an incoming request.
  • Open a new terminal window. Press Cmd+N (macOS) in your existing Terminal, or press the Windows key and search for Terminal (Windows).
  • Keep the terminal running n8n open. You need both running at the same time.
  • Send a test request to your webhook by running this command:
curl --request POST http://localhost:5678/webhook-test/[[WEBHOOK_PATH="your webhook path from the Test URL"]] --header "Content-Type: application/json" --data '{"lat": 40.71, "lon": -74.01}'

What does this command do?

  • curl sends an HTTP request from your terminal.
  • --request POST sets the HTTP method to POST, matching what your Webhook node expects.
  • The URL is the Test URL from your Webhook node panel. Replace the path portion with your own.
  • --data sends a JSON body containing latitude and longitude for New York City.

Your curl may hang

Since you set the response mode to 'Using Respond to Webhook Node' but haven't added that node yet, the curl command will wait indefinitely for a response. That's expected. Press Ctrl+C in your terminal to stop it after you confirm the data appeared in n8n.

  • Switch back to your browser with the n8n editor.
  • You should see the Webhook node's Output panel populate with the received JSON data, including lat and lon fields with the values you sent.
  • Press Ctrl+C in your second terminal to stop the hanging curl command.

Not seeing data in the Output panel?

  • Make sure you clicked Listen for Test Event before sending the curl request. The test URL is only active for 120 seconds after clicking.
  • Check that the URL in your curl command matches the Test URL shown in the Webhook node panel exactly. Copy-paste it to avoid typos.
  • Verify the HTTP Method is set to POST in the Webhook node. A mismatch between the node setting and the curl method will silently fail.

Help me debug why my n8n Webhook node isn't receiving data from my curl request.

Your webhook trigger is ready to receive location data. Next up, you'll connect it to a weather API that turns those coordinates into real-time weather information.

Fetch Weather Data with HTTP Request

Your webhook is accepting location data. Now you need to use that data to fetch real weather conditions from a live API.

In this step, you'll connect your workflow to the Open-Meteo API, a free weather service that requires no API key or signup. Your workflow will dynamically pass the latitude and longitude from the webhook request into the API call using n8n expressions.

In this step, get ready to:
  • Add an HTTP Request node to your workflow.
  • Configure the node to query the Open-Meteo API using dynamic expressions.
  • Execute the node and inspect the returned weather data.
Add an HTTP Request node

The HTTP Request node lets your workflow call any external API. You'll use it to query Open-Meteo for current weather conditions at the coordinates received by your webhook.

  • Click the + connector on the right edge of your Webhook node.
  • Type HTTP Request in the search field.
  • Select HTTP Request from the results to add it to your canvas.

The node panel opens on the right side with configuration fields.

  • Confirm the Method is set to GET (this is the default).
  • Click the URL field.
  • n8n shows a text input. You need to switch it to expression mode so it can read data from the Webhook node. Click the Expression tab above the field (or press = inside the empty field to toggle expression mode).
  • Paste the following expression URL into the expression editor:
https://api.open-meteo.com/v1/forecast?latitude={{ $json.body.lat }}&longitude={{ $json.body.lon }}&current=temperature_2m,rain,wind_speed_10m

What does this URL do?

This is a single URL that combines a static API endpoint with dynamic values pulled from the webhook's incoming data.

  • https://api.open-meteo.com/v1/forecast is the Open-Meteo API endpoint. It requires no authentication.
  • {{ $json.body.lat }} and {{ $json.body.lon }} are n8n expressions. The double curly braces tell n8n to pull values from the previous node's output. $json.body refers to the JSON body of the webhook request.
  • &current=temperature_2m,rain,wind_speed_10m tells the API which weather variables to return: temperature in Celsius, rain in millimeters, and wind speed in km/h.

Seeing an error in the expression editor?

If the expression shows a red warning or cannot resolve the values, make sure the Webhook node has pinned data from the test you ran earlier. Without pinned input data, n8n cannot preview what $json.body.lat resolves to.

Also check that the URL is pasted in the Expression tab, not the Fixed tab. Fixed mode treats the entire string as literal text and won't evaluate the {{ }} parts.

Help me debug my HTTP Request expression

Execute the node and inspect the results

Your HTTP Request node is now configured to call the weather API with dynamic coordinates. Time to run it and see what comes back.

  • Click Execute step (the play button) inside the HTTP Request node panel to run just this node using the pinned webhook data.
  • Wait for the green success indicator to appear.
  • Look at the Output panel on the right side of the node.
  • Click the JSON tab to see the raw response data.

You should see a JSON object containing weather data. The key fields are nested inside a current object.

Node shows an error instead of weather data?

If you see a 400 error, double-check that the expression URL has no extra spaces or line breaks. The entire URL should be on one line.

If you see a message about missing data, go back to the Webhook node and confirm it still has pinned test data showing lat and lon values. The HTTP Request node uses this pinned data when you execute it individually.

Help me fix my HTTP Request node error

Understand the response data structure

Before moving on, take a moment to identify the data paths you'll reference in the next step when building conditional logic.

What is the Open-Meteo response structure?

The API returns weather data wrapped inside a current object. In n8n expressions for the next node, you'll reference these values using:

  • $json.current.temperature_2m for the temperature in Celsius.
  • $json.current.rain for rainfall in millimeters (0 means no rain).
  • $json.current.wind_speed_10m for wind speed in km/h.

The rain field represents precipitation from the preceding hour. A value of 0 means no rain was detected. You'll use this field in the next step to route your workflow through a True (raining) or False (not raining) branch.

Your workflow now fetches live weather data from any coordinates passed through the webhook. Next up, you'll add conditional logic to classify this data into alert categories.

Add Conditional Logic with the If Node

Your workflow fetches live weather data, but right now it treats every response the same way. A sunny day and a rainstorm both produce the same raw output.

In this step, you'll teach your workflow to make decisions. You'll add an If node that checks whether it's raining, then route data down two separate paths to produce different alert messages depending on the conditions.

In this step, get ready to:
  • Add an If node that evaluates the rain value from the weather data.
  • Create a rain alert message on the True branch.
  • Create an all-clear message on the False branch.
Add the If node and configure the rain condition

The If node splits your workflow into two branches based on a condition you define. Data that matches the condition goes down the True branch. Everything else goes down the False branch.

  • Click the + connector on the right side of the HTTP Request node.
  • Search for If and select it to add the node to your workflow.
  • In the If node's settings panel, click the data type dropdown (it defaults to String).
  • Select Number as the data type, then select is greater than as the comparison.
  • In the first value field (left side), click to switch to the Expression tab and enter this expression:
{{ $json.current.rain }}
  • In the second value field (right side), enter 0.

What does this condition do?

The expression {{ $json.current.rain }} pulls the rain value from the previous node's output. The Open-Meteo API returns rain in millimeters for the preceding hour.

If rain is greater than 0, there's active precipitation and data flows down the True branch. If rain equals 0, the sky is clear and data flows down the False branch.

  • Click Execute step (the play button on the If node) to test the condition with your pinned webhook data.

You should see your data appear on either the True or False output tab, depending on whether the pinned coordinates have active rain.

Not seeing any output?

Make sure the HTTP Request node has output data from a previous execution. If the If node shows no input, click the HTTP Request node first and execute it to refresh the data.

Double check that you selected Number as the data type. If it's set to String, the comparison won't work correctly on numeric values.

Why isn't my If node producing any output?

Format the rain alert message

When rain is detected, you want to produce a clear, formatted alert message. The Edit Fields node lets you create custom output fields using expressions that pull data from earlier in the workflow.

  • Click the + connector on the True output (green) of the If node.
  • Search for Edit Fields and select it to add the node.
  • In the Edit Fields node, click Add Value, then select String.
  • In the Name field, enter alert.
  • In the Value field, click to switch to the Expression tab and enter this expression:
Rain alert! Current rain: {{ $json.current.rain }}mm. Temperature: {{ $json.current.temperature_2m }}C. Wind: {{ $json.current.wind_speed_10m }}km/h
  • Toggle Keep Only Set to on (green). This discards all the raw weather data and outputs only your formatted alert field.

What does Keep Only Set do?

Without this toggle, the Edit Fields node passes through all incoming data plus your new field. With it enabled, only the fields you explicitly define (in this case, alert) appear in the output. This keeps your response clean.

  • Click Execute step on the Edit Fields node to verify the output.

If the If node routed data through the True branch, you should see a single alert field containing a formatted rain message with live temperature and wind values.

Seeing empty values in the alert?

Check that your expression paths match exactly: $json.current.rain, $json.current.temperature_2m, and $json.current.wind_speed_10m. A typo in any path produces an empty value.

If the output panel is blank, the If node may have routed data down the False branch instead. That means rain was 0 for the test coordinates. The False branch node (which you'll build next) will handle that case.

Help me fix empty expression values in my Edit Fields node.

Format the all-clear message

The False branch handles the happy path: no rain detected. You'll create another Edit Fields node with a different message for clear weather.

  • Return to the canvas and click the + connector on the False output (red) of the If node.
  • Search for Edit Fields and add a second instance of the node.
  • Click Add Value, then select String.
  • In the Name field, enter alert.
  • In the Value field, switch to the Expression tab and enter:
All clear. Temperature: {{ $json.current.temperature_2m }}C. Wind: {{ $json.current.wind_speed_10m }}km/h. No rain detected.
  • Toggle Keep Only Set to on (green).
  • Click Execute step to test the node.

If data was routed through the False branch, you should see the alert field with an all-clear message containing the current temperature and wind speed.

Why two separate Edit Fields nodes?

Each branch of the If node needs its own processing logic. The True branch builds a rain alert with precipitation data. The False branch builds an all-clear message. Both produce a field called alert, which makes the downstream Respond to Webhook node simpler to configure.

Edit Fields node showing no input data?

This happens when the If node routed all data down the other branch. To test this node, you can temporarily change the If node's condition to is less than instead of is greater than, execute the workflow, then switch it back.

How can I test both branches of my If node?

Your workflow now makes decisions on its own. Next up, you'll close the loop by returning the formatted alert message as a response to whoever triggered the webhook.

Return the Response and Test End-to-End

Your workflow now classifies weather into two branches. The If node routes data through either a rain alert path or an all-clear path, each producing a formatted message.

In this step, you'll close the loop by sending that formatted message back to whoever triggered the workflow. You'll also test the entire pipeline end-to-end and publish it as a live API endpoint.

In this step, get ready to:
  • Add a Respond to Webhook node to return processed data.
  • Test the complete workflow with a curl command.
  • Save, rename, and publish the workflow.
Add the Respond to Webhook node

Right now, the workflow processes data but never sends anything back to the caller. The Respond to Webhook node closes this gap by returning the formatted alert as a JSON response.

  • Click the + connector on the right side of your first Edit Fields node (the rain alert branch).
  • Search for Respond to Webhook and select it.
  • In the node settings panel, set Respond With to All Incoming Items.
  • Now connect the second Edit Fields node (the all-clear branch) to this same Respond to Webhook node. Drag from the + connector on the second Edit Fields node to the input of the Respond to Webhook node.

Why connect both branches to one node?

Only one branch executes per run. Connecting both Edit Fields outputs to the same Respond to Webhook node means that whichever branch runs, its output gets returned to the caller.

The "All Incoming Items" setting passes through whatever data arrives from the preceding node without modification.

Your canvas should now show six nodes total, with both Edit Fields nodes feeding into a single Respond to Webhook node at the end.

Don't see the Respond to Webhook node in search?

Make sure you are clicking the + connector on the Edit Fields node's output (right side), not adding from the main nodes panel. If you do use the panel, search for the exact name Respond to Webhook.

Help me connect both Edit Fields outputs to the Respond to Webhook node.

Test the complete workflow end-to-end

With all six nodes connected, you can now fire a request through the entire pipeline and see the formatted alert come back as a response.

  • Click on the Webhook node (the first node in your workflow) to open its panel.
  • Click Listen for Test Event. The node starts listening for incoming requests.

What is Listen for Test Event?

This registers the Test URL for 120 seconds. During that window, any request sent to the Test URL triggers the full workflow and returns a response. After 120 seconds, the listener stops automatically.

  • Switch to your second terminal window (the one you used for the first test in Step 2). Send a test request with London coordinates by running this command:
curl --request POST http://localhost:5678/webhook-test/[[WEBHOOK_PATH="your-webhook-path"]] --header "Content-Type: application/json" --data '{"lat": 51.51, "lon": -0.13}'

Where do I find my webhook path?

Open the Webhook node and look at the Test URL displayed at the top of the panel. The path is the segment after /webhook-test/. It's the same path you used in Step 2.

  • Check your terminal output. You should see a JSON response containing an alert field with either a rain alert message or an all-clear message, depending on London's current weather.
  • Switch back to n8n in your browser. You should see green checkmarks on every node that executed, showing data flowed through the entire pipeline.

Getting an empty response or timeout?

Make sure you clicked Listen for Test Event before running the curl command. The test listener only stays active for 120 seconds.

Verify that the Webhook node's Respond setting is set to Using 'Respond to Webhook' Node. If it's set to "Immediately", n8n returns a generic response before processing finishes.

Help me debug why my webhook isn't returning the alert data.

Save and publish the workflow

Your workflow works in test mode. Publishing it activates the Production webhook URL, which stays live without needing to click "Listen for Test Event" each time.

  • Save the workflow by pressing Cmd+S (macOS) or Ctrl+S (Windows).
  • Rename the workflow to Weather Alert Workflow. Double-click the workflow name at the top of the canvas to edit it.
  • Click Publish in the top navigation of the editor.

What does publishing do?

Publishing registers the Production webhook URL. This URL stays active as long as n8n is running and the workflow is published. Anyone (or any service) can send a POST request to it at any time without you needing to listen for test events.

In n8n 2.0, the Publish button replaced the older "Activate" toggle. The concept is the same. Publishing makes the workflow live.

Your weather alert workflow is now a live API endpoint. Any POST request with latitude and longitude coordinates returns a classified weather alert.

Secret mission

Add a Scheduled Discord Alert Workflow

Your weather workflow responds on demand. But what if you want automatic alerts when dangerous weather rolls in? In this secret mission, you will build a second n8n workflow that checks the weather every hour and sends a Discord notification when conditions turn extreme.

Clean Up Your Resources

Clean Up Your Resources

This project runs entirely locally, so there are no ongoing costs. Decide whether to keep your resources running, pause them to come back later, or delete them entirely.

Resources you used:

  • n8n local instance and data stored in ~/.n8n (SQLite database, workflows, and credentials).
  • Discord webhook created in your Discord server (Secret Mission).

Keep everything running

No action needed. Choose this if you're still actively building or want your scheduled workflows to keep running.

  • Leave the terminal window running npx n8n open.
  • Published workflows (like your Hourly Weather Check) will continue executing on their schedules as long as n8n is running.
  • Your Discord webhook will remain active and ready to receive messages.

Pause - I'll come back to this later

Shut down n8n to free up your terminal. Your workflows and data are saved locally and will be available next time you start n8n.

  • In the terminal window running n8n, press Ctrl+C to stop the process.
  • Your workflows, credentials, and execution history are stored in ~/.n8n and persist between sessions.
  • To resume later, open a terminal and run npx n8n again. Everything will be right where you left it.
  • Your Discord webhook stays active in your Discord server. No action needed there.

Delete - I don't want to use this again

Remove all project resources and start fresh. This permanently deletes your workflows, credentials, and execution history.

  • In the terminal window running n8n, press Ctrl+C to stop the process.
  • Delete the n8n data directory by running this command:
rm -rf ~/.n8n
  • To delete your Discord webhook, open your Discord server and navigate to Server Settings > Integrations > Webhooks. Select your weather alert webhook and click Delete.
  • If you installed n8n globally (not applicable if you only used npx n8n), uninstall it by running:
npm uninstall -g n8n

What about Node.js?

Node.js is a general-purpose tool you may need for other projects. There is no need to uninstall it unless you are certain you will not use it again.

That's a Wrap!

That's a Wrap!

Nice work! You just built a fully functional weather alert system using n8n's visual workflow editor. From a blank canvas to a working API endpoint that fetches, evaluates, and routes real weather data.

You've learned how to:

  • Built a webhook-triggered workflow that accepts location coordinates and fetches live weather data from the Open-Meteo API using dynamic expressions.
  • Implemented conditional branching with the If node to classify weather conditions and route data through different processing paths.
  • Created a personal API endpoint using the Respond to Webhook node that returns formatted weather alerts as JSON responses.
  • Secret Mission: Built a scheduled workflow that automatically monitors weather conditions every hour and sends alerts to a Discord channel.

Ready to quiz yourself?