Custom Personalized Weather Report Email Sender using Python and AI - n8n Workflow

Generate dynamic, analyzed weather reports, calculate comfort levels, and use an AI agent (GPT-4.1-mini) to draft personalized, engaging emails. Deploy this advanced n8n workflow template today.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

-
Developers looking for advanced n8n workflow examples combining custom Python code, API integrations, and AI.
Businesses needing to generate highly personalized daily email reports.
Users seeking robust n8n templates for data analysis and rich HTML email generation.
Anyone interested in integrating GPT models into data processing pipelines using an n8n node.

Overview

This comprehensive n8n workflow demonstrates how to transform raw API data into high-value, actionable insights. Instead of simply forwarding basic OpenWeatherMap data, this n8n template utilizes a sophisticated Python Code n8n node to calculate unique metrics, such as comfort levels, specific clothing suggestions, and a proprietary “Weather Quality Score.” The resulting analytical data is then fed into an AI Agent n8n node, powered by GPT-4.1-mini, which refines the message for human readability and adds a personalized touch, like a weather-related joke. The entire process culminates in the delivery of a professional, HTML-formatted report via the Gmail n8n node. This solution showcases the power of building advanced, multi-step n8n automations.

How it Works

This efficient n8n workflow begins with the user inputting a city name.


  1. Form Trigger: The automation starts with the On form submission n8n trigger, which captures the city name requested by the user.

  2. Fetch Data: The Fetch Weather Data n8n node (an HTTP Request) queries the OpenWeatherMap API using the city name provided by the n8n trigger. (Note: The user must replace APIkey> in the URL parameter).

  3. Process Logic (Python): The Process Weather Data Python n8n node performs extensive calculations. It converts temperatures, calculates wind speeds in various units, determines a 'Comfort Level,' and generates practical advice like 'Clothing Suggestions' and 'Activity Recommendations.'

  4. Generate Email Content (Python): The subsequent Generate Email Content Python n8n node takes the processed data and constructs both a fully styled HTML email body and a plain text version, including a dynamic subject line.

  5. AI Enhancement: The structured output is passed to the AI Agent n8n node, which uses the connected OpenAI Chat Model (running gpt-4.1-mini). The AI Agent is instructed to draft a polished email, incorporating the weather facts and adding a relevant joke.

  6. Send Email: Finally, the Send a message Gmail n8n node uses the AI-generated output as the message body and the dynamic subject to dispatch the custom personalized weather report to the intended recipient.

Installation Guide

To deploy this n8n workflow, follow these steps:


  1. Import: Copy the provided JSON and import it into your n8n instance using the 'New' > 'Import from JSON' option.

  2. API Keys: You must configure external credentials.

OpenWeatherMap: Open the Fetch Weather Data n8n node and replace APIkey> in the appid query parameter with your actual OpenWeatherMap API key.
OpenAI: Set up an OpenAI credential resource in n8n and link it to the OpenAI Chat Model n8n node.

  1. Gmail Credentials: Set up a Gmail credential resource in n8n and link it to the Send a message n8n node.

  2. Recipient Setup: In the Send a message Gmail n8n node, update the sendTo parameter with the email address where you want to receive the report.

  3. Activation: Ensure all credentials are set, save the n8n workflow, and activate the n8n trigger (On form submission) to start testing the automation.

Node Details

This n8n workflow relies on several specialized n8n node types:

On form submission (n8n trigger): Starts the automation when a city name is entered via a simple n8n form. Key Configuration: Collects the City input.
Fetch Weather Data (HTTP Request n8n node): Retrieves raw weather data from OpenWeatherMap. Function: Sends a GET request parametrized by the city name. Key Configuration: Uses an expression to dynamically inject the city: ={{ $json.City }}.
Process Weather Data (Code n8n node - Python): Performs complex analytical logic. Function: Calculates comfort levels, visibility, wind speed conversions, and generates clothing/activity recommendations. This core n8n node generates the analytical report structure.
Generate Email Content (Code n8n node - Python): Structures the highly analyzed data into presentable HTML and plain text formats for the final email. Function: Creates a rich HTML email template using Python f-strings.
OpenAI Chat Model (n8n node): The language model provider. Function: Specifies the use of the gpt-4.1-mini model for text generation.
AI Agent (n8n node): The primary tool for content refinement. Function: Takes the plain text report and follows instructions to enhance readability, use proper formatting, and, crucially, add a weather-related joke before passing the output to Gmail.


  • Send a message (Gmail n8n node): The final delivery mechanism. Function: Sends the AI-enhanced HTML content using the dynamic subject generated earlier: ={{ $('Generate Email Content').item.json.subject }}.

Related n8n Workflows

Free

Nodes: 7 Nodes
Updated: December 26 2025
View all
Created by
Moe Ahad
Moe Ahad

Featured*