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

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

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

Opening Problem Statement

Meet Davi, a travel consultant who spends hours manually gathering weather forecasts from multiple sources to help clients plan trips. Each day, he types city names into different websites, copies data into reports, and often ends up with conflicting or outdated weather information. This takes up to two hours daily, reducing his productivity and risking client dissatisfaction due to inaccurate or delayed forecasts.

Wouldn’t it be great if Davi could simply ask a chat assistant, “What’s the weather forecast for the next 7 days in São Paulo?” and get a precise, consolidated response instantly? This exact scenario is solved by our unique n8n workflow that combines artificial intelligence with real-time weather data using the Open-Meteo API.

What This Automation Does

This workflow creates an interactive chat-driven weather assistant by integrating OpenAI’s language model with Open-Meteo’s geographic and weather forecast APIs. Here’s what happens when the automation runs:

  • Receives city-specific weather queries via a chat interface.
  • Uses AI to extract the city name and decide the correct API calls sequence.
  • Fetches geographic coordinates of the requested city from Open-Meteo geocoding API.
  • Retrieves detailed daily weather forecasts (temperature max and precipitation) for up to 7 days.
  • Maintains chat history to provide context in ongoing conversations.
  • Returns a human-friendly, precise weather forecast reply tailored to the user’s query.

By automating these steps, Davi can save about two hours every day, reduce errors from manual data entry, and provide faster, more reliable travel advice.

Prerequisites ⚙️

  • n8n Account (cloud or self-hosted) – to set up and run the workflow.
  • OpenAI API Key 🔐 – for leveraging GPT-based language models to handle chat and tool selection.
  • Internet Access 🔌 – to call Open-Meteo API endpoints for real-time geographic and weather data.
  • Optional: Self-hosting with services like Hostinger for those wanting full control over n8n deployment.

Step-by-Step Guide

1. Set Up the Chat Message Trigger Node

Navigate to the n8n editor canvas and add the When chat message received node (@n8n/n8n-nodes-langchain.chatTrigger). This node acts as the workflow trigger when a user sends a chat message.

  • Click + Add Node → Search for When chat message received.
  • Set the webhook as public for easy testing.
  • Configure the initial system messages to introduce the assistant, e.g., “Type like this: Weather Forecast for the Next 7 Days in São Paulo.”
  • Save and note the webhook URL — this is where you’ll send chat requests.

Common Mistake: Forgetting to enable public access will prevent messages from triggering the workflow.

2. Configure the OpenAI Chat Model Node

Add the OpenAI Chat Model node (@n8n/n8n-nodes-langchain.lmChatOpenAi) to process chat inputs using GPT-4 or similar.

  • Set your OpenAI API credentials under this node using your API key.
  • No extra options are required for default chat model usage.
  • This node provides advanced language understanding for parsing user messages and generating AI-driven responses.

3. Insert the Chat Memory Buffer Node

To maintain context over multiple user interactions, add the Chat Memory Buffer node (@n8n/n8n-nodes-langchain.memoryBufferWindow).

  • Simply add it and connect it as a memory handler for chat nodes.
  • This enables the assistant to recall previous messages, improving conversational flow.

4. Add the Generic AI Tool Agent Node

The Generic AI Tool Agent node (@n8n/n8n-nodes-langchain.agent) orchestrates AI-driven decisions on which API tool to call based on user inputs.

  • Connect it as a main handler between the chat trigger, chat model, and subsequent API requests.
  • This node dynamically determines the order: first retrieve city coordinates, then fetch weather data.

5. Create the HTTP Request Node for City Geolocation

Add the A tool for inputting the city and obtaining geolocation node (@n8n/n8n-nodes-langchain.toolHttpRequest).

  • Set method to GET with URL https://geocoding-api.open-meteo.com/v1/search.
  • Configure query parameters: name (city), count=1 (only first result), and format=json.
  • This fetches longitude and latitude for the specified city.

6. Create the HTTP Request Node for Weather Forecast

Add the A tool to get the weather forecast based on geolocation node (@n8n/n8n-nodes-langchain.toolHttpRequest).

  • Set method GET with URL https://api.open-meteo.com/v1/forecast.
  • Configure query parameters to include latitude, longitude, daily=temperature_2m_max,precipitation_sum, timezone=GMT, and forecast_days.
  • This node returns the weather forecast data for the next requested days.

7. Connect the Workflow Nodes for Data Flow

Link these nodes so the AI tool agent calls geolocation first, then weather forecast using coordinates received.

  • Ensure chat message triggers the generic AI tool agent.
  • The agent calls geolocation tool, waits for response, then uses coordinates to call weather forecast tool.

8. Test Your Workflow via Chat Interface

Open the webhook URL from the chat trigger node in a web browser or use an API client.

  • Send a message like “Weather Forecast for the Next 7 Days in São Paulo.”
  • The workflow will respond with a complete weather summary.

Common Mistake: Incorrect city names or API request parameters can cause empty or incorrect responses. Always validate input formatting.

Customizations ✏️

  • Change Forecast Parameters: In the weather forecast HTTP Request node, add or modify daily parameters to include humidity, wind speed, or sunshine hours depending on your use case.
  • Extend Memory Context: Adjust the Chat Memory Buffer node to store longer conversation history for more contextual dialogs.
  • Multi-language Support: Preprocess the chat input message with OpenAI node to translate queries from different languages before passing to the workflow.
  • Multiple City Queries: Adjust the geolocation HTTP Request node to increase count and handle multiple city responses with conditional branching.

Troubleshooting 🔧

Problem: Workflow triggers but returns no weather data

Cause: The geolocation API didn’t return coordinates due to incorrect city input or API limits.

Solution: Verify the city name spelling; check Open-Meteo API status; inspect query parameters in the HTTP Request node for correctness.

Problem: AI tool agent does not call subsequent API tools

Cause: The Generic AI Tool Agent node lacks proper configuration or API tool definitions.

Solution: Review the AI tool configurations, ensure API URLs and parameters are correctly set up and linked to the agent node.

Pre-Production Checklist ✅

  • Confirm OpenAI API key is set and has sufficient quota.
  • Test the public webhook URL to ensure chat messages trigger the workflow.
  • Simulate queries with valid city names and verify correct weather data returns.
  • Backup your workflow configuration before major edits.

Deployment Guide

Activate the workflow in n8n and keep monitoring chat interactions via the execution logs.

If self-hosted, monitor server logs for stability and errors.

Enable sufficient API rate limits on OpenAI and Open-Meteo endpoints for smooth operation.

FAQs

Can I use other AI language models instead of OpenAI?

Yes, as long as they are compatible with n8n’s LangChain agent node. You would need to configure credentials accordingly.

Does this workflow consume many API calls?

Each weather query results in two API calls: one for geolocation and one for forecast. Plan your API quota accordingly.

Is chat history securely stored?

The chat memory buffer is session-based within the workflow and does not store data externally unless configured. For enhanced security, use encrypted databases or integrations.

Conclusion

By following this guide, you have built a powerful, interactive weather forecasting assistant in n8n that leverages AI to interpret user queries and calls real-time Open-Meteo APIs for accurate data. This automation saves travel consultants like Davi up to two hours per day, reduces errors, and provides quick, reliable weather insights.

Next, consider expanding the assistant to support multi-city forecasts, add alerts for severe weather, or integrate travel booking services for a complete trip planning tool. Keep experimenting and keep automating!

Promoted by BULDRR AI

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

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