Automate City Weather Info Retrieval with n8n Webhook & OpenWeatherMap

Discover how to automate retrieving precise weather details for any city using n8n’s Webhook and OpenWeatherMap integration. Save time and eliminate manual lookups with this hands-on workflow that delivers temperature and descriptions instantly.
webhook
openWeatherMap
set
Learn how to Build this Workflow with AI:
Workflow Identifier: 2396
NODES in Use: Webhook, OpenWeatherMap, Set

Press CTRL+F5 if the workflow didn't load.

Visit through Desktop for Best experience

1. Opening Problem Statement

Meet Sarah, a travel blogger who frequently writes about weather conditions in dozens of cities worldwide. Every day, she spends about 30 minutes manually checking weather websites for the cities she covers. The repetitive task not only wastes time but also leads to occasional errors when copying data or mixing up city names. This inefficiency has slowed down her content publishing schedule and affected her audience engagement.

Sarah needs a reliable way to automatically fetch accurate weather data for any city on demand, eliminating tedious manual lookups and reducing errors. That’s where this n8n workflow comes in to solve her exact problem.

2. What This Automation Does

This workflow streamlines the retrieval of live weather data by combining n8n’s Webhook and OpenWeatherMap node. When triggered, it fetches current temperature and weather description for any city specified through the webhook URL query parameters.

  • Trigger on demand: Invokes via a webhook URL that accepts city name as a parameter.
  • Fetch current weather: Uses OpenWeatherMap API to get real-time temperature and weather conditions.
  • Extracts key info: Outputs the temperature and brief weather description like “clear sky” or “light rain.”
  • Returns structured data: Sends simplified and clear JSON with only the most relevant weather info back to the webhook caller.
  • Saves time: No need for Sarah to manually open multiple weather websites or apps.
  • Reduces errors: Automates data retrieval accurately every time based on the city parameter.

3. Prerequisites ⚙️

  • n8n account: Access to n8n automation platform to create and run workflows.
  • OpenWeatherMap API key 🔑: You need to sign up at OpenWeatherMap and get a free API key to use their weather data.
  • Internet access 🌐: Workflow calls external API, so reliable internet connection is necessary.

4. Step-by-Step Guide

Step 1: Create a new workflow and add a Webhook node

In your n8n dashboard, click New Workflow. Drag the Webhook node from the nodes panel into the canvas. Configure it as follows:

  • Set the HTTP Method (default GET is fine).
  • Set the Path to a unique identifier (e.g., weather-info or use the autogenerated UUID as in this workflow).
  • This node will listen for HTTP requests where you can pass the city name as a query parameter.

You should now see a webhook URL generated by n8n. This is what you’ll call to trigger the workflow.

Common mistake: Forgetting to include the city parameter in the query string will cause the OpenWeatherMap node to receive empty data.

Step 2: Add and connect the OpenWeatherMap node

Drag the OpenWeatherMap node next to the Webhook node. Connect the output of the Webhook to the input of this node.

Configure the OpenWeatherMap node:

  • In the City Name field, enter the expression: {{$node["Webhook"].json["query"]["city"]}}. This dynamically grabs the city parameter from the webhook request.
  • Under Credentials, add your OpenWeatherMap API key. You can get one for free by registering on their website.

Outcome: When triggered, it fetches the current weather data for the specified city.

Common mistake: Missing or invalid API key leads to authentication errors. Make sure the API key is correct and active.

Step 3: Add a Set node to extract temperature and description

Next, drag in the Set node and connect the OpenWeatherMap node output to it. This node refines the output payload by selecting only needed fields.

Configure the Set node to keep only these fields:

  • temp with value: {{$node["OpenWeatherMap"].json["main"]["temp"]}}
  • description with value: {{$node["OpenWeatherMap"].json["weather"][0]["description"]}}

This means the final output will be a simple JSON with just temperature and weather description.

Common mistake: If the JSON path is incorrect, you may get undefined values. Use the output preview to verify fields.

Step 4: Test the workflow

Activate the workflow by toggling the Active switch.

Open a browser or API client like Postman and call your webhook URL with a city query, for example:

https://your-n8n-instance.com/webhook/weather-info?city=London

You should receive a JSON response like:

{
  "temp": 15.3,
  "description": "clear sky"
}

If you see this, congrats! Your automation is working.

5. Customizations ✏️

  • Add more weather details: In the Set node, include other fields like humidity, wind speed by referencing JSON paths from the OpenWeatherMap response.
  • Change webhook path: Modify the Webhook node path parameter to something memorable like get-city-weather.
  • Use POST method: Change Webhook node HTTP method to POST if you prefer sending city data in the body instead of query.
  • Format temperature units: In OpenWeatherMap node, adjust settings to change units from Kelvin to Celsius or Fahrenheit.
  • Integrate Slack notifications: Add a Slack node after Set to notify your team automatically of weather info requests.

6. Troubleshooting 🔧

Problem: “Invalid API key or Unauthorized” error from OpenWeatherMap node

Cause: This happens if your API key is missing, expired, or incorrect.

Solution: Go to OpenWeatherMap node → Credentials and re-enter the correct active API key. Test connection with a known city.

Problem: Webhook returns empty data or errors

Cause: City parameter missing or misspelled in the webhook URL.

Solution: Ensure you add ?city=CityName exactly to your webhook URL. Example: https://your-n8n-instance.com/webhook/weather-info?city=Paris.

7. Pre-Production Checklist ✅

  • Confirm your OpenWeatherMap API key is valid and has permissions.
  • Test webhook URL with multiple city queries to verify response accuracy.
  • Validate JSON output structure from the Set node for expected fields.
  • Backup your n8n workflows before activating in production.

8. Deployment Guide

Once tested, activate your workflow by toggling the switch to ACTIVE. Deploy this on your production n8n instance. Monitor requests and errors through n8n execution logs.

For higher request volumes, consider scaling your n8n instance or caching frequent city requests to reduce API calls.

10. Conclusion

By building this workflow, you’ve automated real-time weather retrieval for any city via a simple webhook trigger. No more manually looking up weather data—saving Sarah (and you) precious time and reducing human error.

This automation can streamline any app or service needing quick weather updates on demand. Next steps might include adding additional environmental data, creating scheduled weather reports, or integrating this into travel booking apps.

Give it a try and customize it to fit your unique needs!

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation in n8n (Beginner Guide)

A complete beginner guide to building an AI-powered SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free