← Back to Projects

Project Showcase

AI Document Summarizer & Classifier

An automated document intelligence pipeline built with n8n and Google Gemini 2.5 Flash that receives any text document via webhook, analyzes it using AI, and delivers a structured summary report via email and Google Sheets — all without manual intervention.

n8n
Gemini 2.5 Flash
webhooks
Google API
Telegram API

Overview

Project Summary

This system accepts document submissions through a webhook endpoint containing a filename and raw text content. A JavaScript Code node first cleans and measures the text, then passes it to a Gemini-powered LLM chain that performs full document analysis in a single prompt. The AI returns structured JSON containing the document type, tone, sentiment, complexity rating, a 2-3 sentence summary, five extracted key points, and a recommended action. A second Code node parses and sanitizes the AI output, after which the structured data is logged to a Google Sheets database and delivered as a formatted HTML email report to the recipient.

Architecture

Technical Implementation

1. Webhook Input Layer: Accepts HTTP POST requests containing filename and content fields, simulating a document upload endpoint compatible with any frontend or form tool.

2. Text Processing Layer (Code Node 1): A JavaScript node cleans whitespace, calculates word count and character count, and prepares the payload for the AI. Demonstrates use of n8n's Code node for pre-processing logic.

3. AI Analysis Layer: A Basic LLM Chain node sends the cleaned document to Google Gemini 2.5 Flash using a structured JSON-mode prompt. Extracts eight distinct fields in a single LLM call, demonstrating efficient prompt engineering for multi-field extraction.

4. Output Parsing Layer (Code Node 2): A second JavaScript node strips markdown artifacts from the LLM response, parses the JSON, joins array fields into readable strings, and carries the filename forward from the input layer using explicit node referencing.

5. Google Sheets Logging: All ten fields including timestamp, filename, AI classifications, summary, key points, and recommended action are mapped and appended to a centralized Google Sheets database for record keeping.

6. Email Delivery: A Gmail node sends a formatted HTML summary report to the recipient, dynamically populating all fields from the parsed AI output using explicit node reference expressions.