Triage and route inbound emails using OpenAI, Slack, Gmail, and Google Sheets
Quick overview This workflow polls an IMAP inbox, uses OpenAI to classify each email by urgency, and then routes it to Slack, Google Sheets, Google Drive, or Gmail based on category and confidence, while logging every decision to a Google Sheets audit log.
How it works Polls an IMAP mailbox every minute for new emails. Sends the email subject and plain-text body to OpenAI (gpt-4o-mini) to return a JSON classification with category, confidence, and reason. Posts low-confidence classifications (confidence < 0.7) to a Slack channel for human review. Routes high-confidence emails by category into urgent, invoice, or routine paths. Posts urgent emails to a Slack #ops-alerts channel with the sender and the model’s reason. Uploads invoice attachments to Google Drive and appends the email data to an Invoices sheet in Google Sheets. Adds a Gmail label to routine emails and appends all outcomes to a DecisionLog sheet in Google Sheets.
Setup Configure the IMAP connection in the Email Trigger to monitor your target mailbox. Add an OpenAI API credential (or n8n OpenAI/LangChain credential) for the classification step. Add Slack credentials and set (or create) the #triage-review and #ops-alerts channels used for notifications. Add Google Drive credentials and confirm the upload location and filename format for saved invoice attachments. Add Google Sheets credentials and replace YOUR_LEDGER_SHEET_ID and YOUR_AUDIT_SHEET_ID with your spreadsheet IDs, ensuring the Invoices and DecisionLog tabs exist. Add Gmail credentials and update the label ID (Label_routine) to a label that exists in your Gmail account.
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 Product Ad Copy & CTAs with GPT-4 for Slack and Airtable
⚡ AI Copywriter Pro: Instant Ad Copy & CTA Generator Transform product details into compelling marketing copy in second...
Auto-classify Gmail emails with AI and apply labels for inbox organization
Who is this for? Professionals and individuals who receive high volumes of emails, those who want to automatically organ...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments