Automated Multi-Source Email Analysis and Summarization - n8n Workflow

Use this advanced n8n workflow to automatically process incoming emails, extract, summarize PDFs and images using various AI models (GPT-4o, DeepSeek, Gemini), save data to Google Sheets, and send a final report via Telegram. This is a crucial n8n templates solution for managing complex email data.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Users needing automated processing of high-volume emails containing diverse attachments (PDFs, images).

  • Individuals or teams seeking to implement robust AI automation workflows for data extraction and summarization.

  • Operations specialists looking for ready-to-use n8n templates to integrate email, cloud storage, AI, and messaging services.

  • Developers or non-technical users who require sophisticated, multi-step n8n node logic without writing extensive custom code.

Overview

Managing high-volume inboxes where key information is buried across email bodies, attached PDF documents, and embedded images is highly time-consuming. This powerful n8n workflow solves this by providing an end-to-end AI-driven solution.

Upon receiving an email via the IMAP n8n trigger, the n8n workflow intelligently breaks down the message into its core components. It leverages specialized LLMs (like DeepSeek, GPT-4o-mini, and Gemini) for tasks such as email summarization, image analysis, and PDF text extraction. This ensures high accuracy for each data type. All partial results are saved to Google Sheets for structured data logging, and files are archived in Google Drive. The ultimate value of this n8n workflow lies in its final step: synthesizing these individual summaries into one cohesive report, which is instantly delivered via Telegram, giving the user immediate, actionable insight without manually opening files.

How it Works

This comprehensive n8n workflow is activated by the Email Trigger (IMAP) n8n trigger whenever a new email is detected. The flow immediately checks if the email contains attachments using an If n8n node.


  1. Attachment Handling: If attachments are present, a Code n8n node extracts the binary data, and a Switch n8n node routes the processing based on the file extension (PDF or image - JPG/PNG).

  2. PDF Processing: PDF attachments are first uploaded to Google Drive. The Extract from PDF n8n node retrieves the text, which is then fed into the PDF Analyzer LLM Chain, utilizing a powerful model (Gemini 2.0 Flash) to generate a concise summary. This summary is structured via the Structured Output Parser n8n node and logged to Google Sheets using a Google Sheets n8n node.

  3. Image Analysis: Image attachments are uploaded to Google Drive. The Analyze image n8n node, leveraging GPT-4o-mini's multimodal capabilities, generates a detailed description of the image content. This summary is also logged to Google Sheets using a dedicated Google Sheets n8n node.

  4. Email Body Summarization: Regardless of attachments, the main email text is converted to plain text and passed to the Email Summarization Chain n8n node, which uses the DeepSeek R1 model to produce a high-quality summary. This summary is also saved to Google Sheets.

  5. Final Synthesis: All individual summaries (email, PDF, image) are collected using the Merge n8n node and aggregated. The Create final summary n8n node, running on the Gemini 2.0 Flash model, synthesizes these disparate pieces of information into one single, cohesive final report. This powerful step completes the n8n workflow logic.

  6. Notification: The final comprehensive summary is delivered instantly via the Telegram n8n node.

Installation Guide

To deploy this complex n8n workflow, follow these steps:


  1. Import: Copy the provided JSON code and paste it into your n8n instance to import this n8n template.

  2. IMAP Credentials: Set up the credentials for the Email Trigger (IMAP) n8n node to connect to your specific mailbox.

  3. AI Credentials (OpenRouter/OpenAI): This n8n workflow uses multiple AI models. You will need to configure credentials for OpenRouter (used for DeepSeek and Gemini) and OpenAI (used for GPT-4o-mini image analysis).

  4. Google Sheets Setup: As indicated in the sticky note, clone the provided Google Sheets template. Then, update the Google Sheets n8n node credentials and ensure the Document ID is correctly linked to your cloned sheet.

  5. Google Drive Setup: Configure the Google Drive n8n node credentials and specify the target folder ID where attachments should be uploaded and archived.

  6. Telegram Configuration: Replace the placeholder CHAT_ID in the Send final summary n8n node with your specific Telegram Chat ID and configure the necessary Telegram API credentials.

  7. Activate: Once all n8n node credentials and parameters are set, activate the n8n workflow.

Node Details

Email Trigger (IMAP) n8n trigger: The starting point of this automation. It checks the specified IMAP mailbox and is configured to download all incoming attachments.
If (Contain attachments?) n8n node: A crucial control flow node that checks for the presence of binary data (attachments) to decide whether to execute the attachment processing branch of the n8n workflow.
Code (Get PDF and images attachments) n8n node: Custom JavaScript logic used to iterate through all downloaded binary items and prepare them for individual processing by subsequent nodes.
Switch n8n node: Directs attachments based on the file extension, routing PDFs to the document extraction path and JPG/PNGs to the image analysis path.
Analyze image n8n node (OpenAI): Uses GPT-4o-mini's multimodal feature to generate a textual description of the image content. Configuration: Resource: image, Input Type: base64.
Email Summarization Chain n8n node: A Langchain n8n node that summarizes the cleaned email text using the DeepSeek R1 model. It is configured with a detailed system prompt for concise summarization.
PDF Analyzer n8n node (Langchain): Processes the extracted text from PDF files using the Gemini 2.0 Flash model and a dedicated summarization prompt. It is linked to a Structured Output Parser n8n node to ensure predictable JSON output.
Google Sheets n8n node (multiple instances): Used for persistence. Multiple instances append rows to a specified Google Sheet, recording the email ID, date, summary type (pdf, image, email), and the generated summary content.
Create final summary n8n node (Langchain): The culmination of the analysis. It takes all individual summaries and uses the Gemini 2.0 Flash model with a sophisticated synthesis prompt to generate one unified, comprehensive report.
Telegram n8n node: The final action, sending the synthesized report to a defined CHAT_ID, effectively completing the automated n8n workflow cycle.

Related n8n Workflows

Free

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

Full-stack Web Developer based in Italy specialising in Marketing & AI-powered automations. For business enquiries, send me an email at [email protected] or add me on Linkedin.com/in/davideboizza

Featured*