Email Insight Engine: Knowledge Graph Generation & AI Summaries - n8n Workflow

Automate Gmail analysis using this robust n8n workflow. Filter emails, classify content with Google Gemini, generate visual knowledge graphs and AI insights using InfraNodus, and receive summaries via Telegram and email.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Individuals overwhelmed by high-volume email correspondence who need automated summarization.

  • Researchers or project managers looking to identify recurring topics and conceptual gaps within communication archives.

  • Data scientists needing a structured n8n workflow to extract clean text data from emails for advanced analysis.

  • Users interested in leveraging the Google Gemini n8n node for high-speed email classification and filtering.

Overview

This advanced n8n workflow solves the problem of email overload by transforming raw correspondence into structured, actionable insights. By leveraging the power of a flexible n8n trigger system and sophisticated filtering techniques, users can analyze large batches of emails—categorized by criteria, label, or date—and visualize the recurring themes and conceptual gaps using the InfraNodus knowledge graph tool. This specific n8n workflow not only extracts and cleans data but also utilizes the Google Gemini n8n node to classify email relevance. The final step involves generating unique, gap-based AI questions to spur new ideas or identify overlooked connections, making this one of the most powerful n8n templates for email productivity.

How it Works

This powerful n8n workflow begins with one of several n8n trigger options: a manual trigger, a schedule trigger (for daily runs), or a form trigger (for on-demand, parameter-driven analysis).


  1. Settings Assignment: The ‘Assign Processing Settings’ n8n node sets the initial parameters, including Gmail search criteria (e.g., date range, keywords), label filters (e.g., CATEGORY_PERSONAL), and the desired Graph Name.

  2. Email Retrieval: The ‘Get Messages by Search Criteria’ Gmail n8n node fetches email messages based on the configured search query. Subsequent ‘If’ and ‘Filter’ n8n nodes optionally narrow down these results using specific labels or check if the full email content needs retrieving.

  3. Content Retrieval: If full text is required, the ‘Get Full Message Content’ Gmail n8n node retrieves the body of the emails.

  4. AI Classification (Optional): The workflow utilizes the ‘Google Gemini Chat Model’ and ‘Classify Emails’ n8n nodes to perform advanced filtering. Emails are classified against user-defined criteria (e.g., 'Important personalized emails') to ensure only relevant items proceed.

  5. Data Preparation: Aggregate and Code n8n nodes ('Clean text and organize into statements') preprocess the email data (snippets or full text). This step is crucial for removing HTML/CSS and formatting the content into statements ready for the InfraNodus API.

  6. Graph Generation: A Switch n8n node determines whether to build a Social Knowledge Graph (including sender information) or a Text Knowledge Graph (content only). The corresponding ‘InfraNodus Build’ HTTP Request n8n node submits the cleaned data to create the knowledge graph.

  7. AI Insight Generation: A ‘Wait’ n8n node pauses the flow for 60 seconds to allow graph processing. Then, subsequent HTTP Request n8n nodes query InfraNodus to generate a topical summary and an ‘Insight Question’ based on structural gaps in the data.

  8. Notification: The final results (graph link, summary, and insight question) are delivered using the Telegram n8n node and the Gmail n8n node (Send Email operation). This entire n8n workflow provides a comprehensive end-to-end solution.

Installation Guide

To install and utilize this n8n workflow, follow these steps:


  1. Import: Copy the provided JSON and import it into your self-hosted or cloud n8n instance using the 'Import Workflow' option.

  2. Gmail Credentials: Set up credentials for the Gmail n8n nodes (Get Messages by Search Criteria, Get Full Message Content, and the final Gmail Send node). Ensure you grant read permissions for messages.

  3. InfraNodus API Key: Obtain an API key from InfraNodus. Configure the 'Generic Credential Type' (HTTP Bearer Auth) used by the InfraNodus HTTP Request n8n nodes ('InfraNodus Build...', 'InfraNodus AI Summary...', 'InfraNodus Question Generator').

  4. Gemini API Key: Configure the API key for the 'Google Gemini Chat Model' n8n node.

  5. Telegram Setup: Create a Telegram Bot via BotFather and configure the 'Telegram API' credential used by the Telegram n8n nodes. Update the chatId parameter in the Telegram nodes to your target chat ID.

  6. Configuration: Review the ‘Assign Processing Settings’ n8n node to customize your default search criteria and analysis options.

  7. Activation: Select your desired n8n trigger (e.g., enable the Schedule Trigger or run manually) and activate the n8n workflow.

Node Details


  • User submits form / Schedule Trigger / Manual Trigger: These nodes serve as the entry point, defining how and when the n8n workflow starts.

  • Assign Processing Settings (Set n8n node): Function: Centralizes configuration variables like Search Criteria, Label Filter, and Graph Name. Key Configuration: Dynamically sets criteria, including a default search filter for emails from the previous day.

  • Get Messages by Search Criteria (Gmail n8n node): Function: Retrieves email metadata based on the dynamic Search Criteria defined earlier. Key Configuration: Operation: getAll, uses q parameter for complex search.

  • Google Gemini Chat Model: Function: Provides the language model backend for the classification task. Key Configuration: Uses models/gemini-2.5-flash-preview-04-17.

  • Classify Emails (Text Classifier n8n node): Function: Uses Gemini to determine if an email matches the user's defined Email Type Description (e.g., 'Important personalized emails'), filtering out spam or generic notifications.

  • Clean text and organize into statements (Code n8n node): Function: Essential custom code n8n node that strips HTML/CSS from email bodies and formats the content into machine-readable statements for the knowledge graph tool, combining sender, date, and text.

  • Type of graph to build (Switch n8n node): Function: Routes the workflow based on user input, choosing between a 'Social Knowledge Graph' (including senders) or a 'Text Knowledge Graph' (content only).

  • InfraNodus HTTP Request n8n nodes (Build, Summary, Question): Function: Communicates with the InfraNodus API to build the graph, retrieve the AI summary, and generate the insight question. Key Configuration: Uses genericCredentialType for API key authentication and dynamic Graph Name referencing the settings node.

  • Wait before generating questions (Wait n8n node): Function: Introduces a necessary 60-second delay to ensure the InfraNodus graph generation process is complete before attempting to retrieve the analysis and summary.

  • Telegram / Gmail n8n nodes: Function: Final actions to deliver the visual summary link and AI-generated insights to the user.

Related n8n Workflows

Free

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

I'm Dmitry, the founder of InfraNodus — an AI text network analysis tool. I'm passionate about networks and data visualization and its ability to reveal what everyone else is missing and to highlight different perspectives. I'm sharing the n8n templates that make use of this unique capability of InfraNodus for multiple scenarios.

Featured*