Dynamic Weather Retrieval API Endpoint - n8n Workflow

Create a powerful custom weather API endpoint using this ready-to-use n8n workflow. Accepts city parameters via webhook query and returns formatted temperature data efficiently.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Developers needing a simple microservice for localized weather data.

  • Users looking for practical n8n templates to learn external API consumption and data transformation.

  • Admins building custom dashboards (like bash-dash) that require formatted, lightweight data feeds.

  • Anyone studying how to utilize the webhook n8n trigger as a robust API interface.

Overview

This specialized n8n workflow acts as a lightweight microservice designed to retrieve real-time weather information from OpenWeatherMap for any requested city. By leveraging the power of the core n8n node types, this automation converts a simple webhook request into a concise, formatted text response containing current temperature details.

The value of this n8n workflow lies in its simplicity and customization. It abstracts away the complexity of the third-party API, providing a clean JSON response suitable for integration into command-line tools or minimalistic web applications where quick, readable data is crucial. This efficient n8n node setup demonstrates best practices for dynamic parameter passing and output generation within a hosted n8n environment.

How it Works

This automation functions as a self-contained API endpoint activated by an external HTTP call. The logical flow is executed seamlessly across four distinct n8n node steps:


  1. Start and Trigger: The process is initiated by the Webhook GET n8n trigger node, which is configured to listen for incoming requests on the /weather path. This n8n trigger acts as the public interface for the microservice.

  2. Parameter Mapping: The Set City n8n node processes the incoming webhook request. It uses an expression to extract the desired city name from the URL query parameters (query.parameter). If no city is specified, the n8n node defaults the lookup value to 'berlin,de', ensuring the n8n workflow always has valid input.

  3. Data Retrieval: The OpenWeatherMap n8n node receives the validated city name and makes the necessary external API call to fetch the current weather data, including temperature and perceived temperature.

  4. Response Generation: The Create Response n8n node transforms the complex JSON output from the previous step into a simple, readable string using an expression. This string summarizes the temperature and 'feels like' data for the requested city. The overall n8n workflow then returns this formatted string as the final response to the initial webhook call.

Installation Guide


  1. Import: Copy the provided JSON and import it directly into your n8n instance as a new n8n workflow.

  2. Credentials: You must configure the OpenWeatherMap n8n node with valid API credentials. Obtain an API key from OpenWeatherMap and create a corresponding credential entry in n8n.

  3. Activation: Save the n8n workflow and ensure it is activated (toggle 'Active' to ON). The system will automatically generate a unique URL for the Webhook GET n8n trigger.

  4. Testing: Test the endpoint by hitting the generated URL (e.g., YOURN8NURL/webhook/weather?parameter=london,uk).

  5. Customization: If you wish to change the default city or the specific data points returned, modify the expressions within the Set City and Create Response n8n nodes.

Node Details

This n8n workflow utilizes fundamental n8n node types for efficient execution:

Webhook GET (n8n trigger):
Function: Serves as the primary n8n trigger and endpoint for the custom API.
Key Configuration: Path is set to weather. Response mode is set to Last Node, ensuring the final formatted data is returned.
Set City (n8n node):
Function: Extracts and sanitizes the user-provided city parameter from the webhook query data. If the parameter is missing, it injects a default value.
Key Configuration: Uses the expression ={{ $json["query"]["parameter"] || 'berlin,de' }} to handle null/missing input gracefully.
OpenWeatherMap (n8n node):
Function: Queries the OpenWeatherMap API using the city name passed via the previous n8n node.
Key Configuration: City Name is dynamically set using an expression referencing the output of the Set City node: ={{ $json["city"] }}.
Create Response (n8n node):
Function: Formats the complex weather data into a clean, single-line text output.
Key Configuration: The value field uses expressions to pull specific fields (main.temp, main.feels_like, name) into a descriptive sentence, providing the final output for this n8n workflow.

Related n8n Workflows

Free

Nodes: 3 Nodes
Updated: December 26 2025
View all
Created by

Founder/CEO of n8n

Featured*