Grabbed the community's 'Gmail AI Agent' template. It categorized emails perfectly. But client asked: 'Can it extract invoice data too?' Added 3 nodes. Now it does.
THE BASE TEMPLATE:
Using the popular 'Gmail AI Agent' (2,000+ downloads from community). Categorizes emails, drafts responses. Works perfectly for text. But ignores PDF attachments completely.
CLIENT'S REQUEST:
'When invoice email arrives, can the agent extract vendor name, amount, due date? Right now it just forwards the email.'
THE EXTENSION (3 NEW NODES):
NODE 1 - IF NODE: Check for PDF attachment
Triggers when email has .pdf file attached. Routes to document processing branch.
NODE 2 - DOCUMENT PROCESSING NODE: Parse Invoice
Configuration: Extract Structured Document mode. JSON Schema for invoice data (vendor, amount, date, invoice_number). Returns structured data.
NODE 3 - SET NODE: Format for Agent
Takes extracted invoice data, formats as clear text summary for agent to use.
NODE 4 - ADDITIONAL TOOL: Give agent new capability
Tool name: 'Extract Invoice Data'
Tool description: 'Extracts vendor, amount, date, and invoice number from PDF invoices'
Tool input: Email with PDF attachment
Tool output: Structured invoice data
THE RESULT:
Agent now responds: 'I found an invoice from Vendor X for $1,245.50, due March 15. I've added it to your tracking sheet in row 47.'
Before extension: Agent could only read email text, forwarded invoices manually.
After extension: Agent extracts data, logs automatically, provides summary.
IMPLEMENTATION TIME:
25 minutes to extend the base template. No need to rebuild agent from scratch.
THE NUMBERS:
- Processes 80+ invoice emails monthly
- Saves 12 minutes per invoice (no manual entry)
- Client processes $120K invoices monthly through agent
- Zero manual data entry needed
CONFIGURATION DETAILS:
Document processing node settings: Use 'Extract Structured Document' operation. Define JSON Schema with required fields. Set confidence threshold at 0.85. Route low-confidence extractions to review queue.
AGENT TOOL CONFIGURATION:
In AI Agent node, Tools section: Add 'Execute Workflow' tool. Point to document processing branch. Tool becomes available to agent automatically.
THE PATTERN:
This same extension works for any document type. Replace invoice schema with resume schema, form schema, contract schema. Same 3-node pattern.
TEMPLATE AVAILABILITY:
Extended workflow JSON with all configurations. Import directly into your instance. Modify schema for your document type. Deploy in 10 minutes.
Document processing integration for n8n here How are you extending the Gmail Agent template?