Automate Weather Forecasts with n8n and OpenAI Integration

Discover how this unique n8n workflow integrates OpenAI and the Open-Meteo API to automate personalized 7-day weather forecasts from chat inputs. Save time planning trips with accurate, AI-driven weather updates.
chatTrigger
agent
toolHttpRequest
+3
Workflow Identifier: 1881
NODES in Use: chatTrigger, lmChatOpenAi, stickyNote, agent, memoryBufferWindow, toolHttpRequest
Automate weather forecasts with n8n and OpenAI

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

Learn how to Build this Workflow with AI:

What This Automation Does

This workflow answers questions about weather for specific cities. It solves the problem of spending too much time looking for weather data from different websites. The user asks for a weather forecast in a chat, then the workflow gets city location and weather info from APIs. Finally, it gives a clear and easy answer with the weather forecast.

The workflow takes your question, finds the city coordinates, and then fetches a 7-day weather report. It keeps track of the chat history so the conversation stays clear. This saves time and stops mistakes from manual searching.


Tools and Services Used

  • When chat message received node (@n8n/n8n-nodes-langchain.chatTrigger): Starts the workflow when a chat message arrives.
  • OpenAI Chat Model node (@n8n/n8n-nodes-langchain.lmChatOpenAi): Understands the user’s question using GPT-4.
  • Chat Memory Buffer node (@n8n/n8n-nodes-langchain.memoryBufferWindow): Saves past chat messages to keep context.
  • Generic AI Tool Agent node (@n8n/n8n-nodes-langchain.agent): Decides the right API call steps based on the question.
  • HTTP Request node for city geolocation (@n8n/n8n-nodes-langchain.toolHttpRequest): Gets latitude and longitude of the city from Open-Meteo.
  • HTTP Request node for weather forecast (@n8n/n8n-nodes-langchain.toolHttpRequest): Fetches daily weather data for up to 7 days using city’s location.

Inputs, Processing Steps, and Output

Inputs

  • User sends a city-specific weather request in chat, like “Weather Forecast for the Next 7 Days in São Paulo.”

Processing Steps

  • 1. The chat trigger node activates when the message is received.
  • 2. OpenAI Chat Model node interprets the question and extracts the city name.
  • 3. Chat Memory Buffer node stores previous messages to keep context.
  • 4. Generic AI Tool Agent node decides the API call order.
  • 5. Calls the geolocation HTTP Request node to get the city coordinates.
  • 6. Uses those coordinates in the weather forecast HTTP Request node to retrieve weather data.
  • 7. Combines the information and generates a clear weather summary reply.

Output

  • Returns an easy-to-read, accurate forecast for 7 days, with temperature highs and precipitation details.

Beginner step-by-step: How to build this in n8n

Download and Import Workflow

  1. Use the Download button on this page to get the workflow file.
  2. Open the n8n editor and use “Import from File” to upload the workflow.

Set Up Credentials and Configuration

  1. Add your OpenAI API Key under the OpenAI Chat Model node.
  2. Check the HTTP Request nodes and make sure parameters like URLs and query fields are correct.
  3. Update any IDs, emails, or channels if the workflow involves communication steps beyond this scope.

Test and Activate the Workflow

  1. Trigger the workflow by sending a chat message to the webhook URL provided by When chat message received node.
  2. Make sure the reply includes the correct weather forecast.
  3. Activate the workflow in n8n to run it in production.

If using self hosting or wanting full control, consider self-host n8n deployments.


Common challenges and errors

City not found or no weather data returned

If the city names are wrong or misspelled, the geolocation API won’t return coordinates. Without coordinates, no weather data comes back.

Check your queries carefully and the HTTP Request node setups. Also check if Open-Meteo API is working or if limits are hit.

Generic AI Tool Agent not calling API tools

This can happen when the AI tool agent isn’t set up to call the geolocation and weather nodes properly.

Review node connections and input configurations to make sure the agent knows when and how to call each.


Customization ideas

  • Change weather data fields in the forecast HTTP Request node. Add humidity, wind speed, or sunshine hours.
  • Increase how many past messages the Chat Memory Buffer node saves to allow longer context.
  • Process chat input first with an OpenAI node to translate questions from other languages.
  • Expand geolocation HTTP Request node to return multiple cities if users ask about more than one place.

Summary

→ The workflow answers city-based weather questions fast in chat.

✓ Saves manual searching time by getting city location and forecast automatically.

✓ Maintains chat history to improve conversation flow.

✓ Gives a simple, clear forecast for the next 7 days.

Automate weather forecasts with n8n and OpenAI

Visit through Desktop to Interact with the Workflow.

Frequently Asked Questions

The workflow uses the Open-Meteo geocoding API called from the HTTP Request node to get the city’s latitude and longitude.
The workflow requires an OpenAI API Key for the chat language model. No API key is needed for Open-Meteo as it is a free public API.
Yes. You can customize the workflow to add an OpenAI node that translates user input before processing.
Import the workflow into an n8n instance running on a private server or VPS. See self-host n8n for deployment options.

Promoted by BULDRR AI

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.