Generate LEDES invoices from email attachments with OpenAI, Gmail, and Sheets
UnknownWhat this workflow does
This AI workflow has 27 nodes and runs when a new email arrives over IMAP. Along the way it connects Google Sheets, OpenAI Chat Model, Gmail and Word2text (community).
How it runs
Trigger: When a new email arrives over IMAP.
- Identify File Attachment Type (Code): runs custom JavaScript code
- If: checks a condition and branches into true / false
- If: checks a condition and branches into true / false
- Fetch Invoice Numbers from Sheets (Google Sheets): uses Google Sheets
- Extract PDF Text (Extract from File): extracts data from a file (pdf)
- Extract Word Document Text (Word2text): uses Word2text
- Compute Next Invoice Number (Code): runs custom JavaScript code
- Time Entry Extractor Agent (AI Agent): runs an AI agent, with model: OpenAI Time Entry Model
- Combine Entries with Invoice (Merge): merges the data from its input branches
- Parse Time Entries Data (Code): runs custom JavaScript code
…plus 14 more steps. See the full node list below.
Services it uses
Before you upgrade to n8n 3.0
We can't fully verify this one: it relies on 1 community package, and n8n 3.0 turns unverified community packages off by default (N8N_UNVERIFIED_PACKAGES_ENABLED=false).
- Check that n8n-nodes-word2text is verified or supports 3.0 (used in Extract Word Document Text).
Nodes used (11)
- Email Trigger (IMAP)
n8n-nodes-base.emailReadImap - Code
n8n-nodes-base.code - If
n8n-nodes-base.if - Google Sheets
n8n-nodes-base.googleSheets - Extract from File
n8n-nodes-base.extractFromFile - Word2text
n8n-nodes-word2text.word2text - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - AI Agent
@n8n/n8n-nodes-langchain.agent - Merge
n8n-nodes-base.merge - HTTP Request
n8n-nodes-base.httpRequest - Gmail
n8n-nodes-base.gmail
From the author
Quick overview This workflow watches an IMAP inbox for new emails with PDF or Word attachments, extracts legal time entries using OpenAI, generates LEDES 1998B, LEDES XML 2.0, and a PDF invoice (via a Gotenberg HTML-to-PDF endpoint), then logs results to…