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
- Use the Download button on this page to get the workflow file.
- Open the n8n editor and use “Import from File” to upload the workflow.
Set Up Credentials and Configuration
- Add your OpenAI API Key under the OpenAI Chat Model node.
- Check the HTTP Request nodes and make sure parameters like URLs and query fields are correct.
- Update any IDs, emails, or channels if the workflow involves communication steps beyond this scope.
Test and Activate the Workflow
- Trigger the workflow by sending a chat message to the webhook URL provided by When chat message received node.
- Make sure the reply includes the correct weather forecast.
- 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.

