Route and validate emailed documents with Gmail and Google Gemini
Quick Overview This workflow monitors Gmail for unread emails from a specific sender, classifies attached documents with Google Gemini, then extracts and validates structured data for bills of lading, invoices, and warranty claims, posts the results to an HTTP webhook endpoint, and replies to the sender with an HTML confirmation email.
How it works Triggers when an unread Gmail message arrives from the configured sender and downloads the email attachment. Uses Google Gemini to classify the attachment as a bill of lading, invoice, warranty claim, or other, while preserving the original binary file for downstream processing. Routes the flow by document type and uses Google Gemini to extract the document into a structured markdown representation. Uses a dedicated Google Gemini agent per document type to convert the extracted content into JSON that matches a predefined schema. Runs Python validation checks on the structured data (for example, totals matching line items) and adds a validation result to the payload. Posts the structured output to a configured HTTP webhook endpoint and uses a Google Gemini messaging agent to draft an HTML reply. Sends the generated reply back to the original email sender via Gmail.
Setup Connect a Gmail OAuth2 credential and set the Gmail trigger filters (sender, unread status) and ensure attachments are enabled for download. Connect a Google Gemini (PaLM) API credential and confirm the configured Gemini models are available for both extraction and the analysis/messaging agents. Update the HTTP Request node URL (and any required headers/authentication) to point to your target webhook or API endpoint. Review and adjust the structured output schemas and the Python validation rules to match the fields and business rules required for your bill of lading, invoice, and warranty claim formats.
Related Templates
AI Email Classifier & Auto-Delete for Gmail (SPAM/OFFER Cleaner)
This workflow is designed for freelancers, solopreneurs, and business owners who receive a high volume of irrelevant mes...
Generate Food Recipes from Gmail & Form Requests with Ollama & Llama 3.2
This n8n template demonstrates how to create an intelligent food recipe assistant that accepts requests via Gmail and we...
Automatic News Summarization & Email Digest with GPT-4, NewsAPI and Gmail
π° AI News Digest Agent: Auto News Summarizer & Email Newsletter Create an intelligent news curation system that automat...
π Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments