Triage shared inbox emails with OpenAI and human-in-the-loop approval
Quick overview
Description
Quick overview This workflow monitors a shared IMAP inbox, uses OpenAI to classify each incoming email and draft a short reply, then emails the draft to an approver for one-click approval before sending the response back to the original sender. How it works Triggers when a new email arrives in a shared inbox via IMAP and marks the message as read. Prepares the email details (sender, subject, message text) and loads configuration like company name and approval addresses. Uses OpenAI to classify the email into categories such as quote request, appointment, complaint, invoice question, general, or spam. Stops processing for spam messages so no reply is drafted or sent. Uses OpenAI to draft a short reply in the sender’s language based on the classified case and the original message. Emails the draft to an approver using an editable decision form. By default it waits four hours, then sends a reminder/escalation and waits another twenty hours (24 hours total) before logging expiry for manual follow-up. If approved, sends the reply to the original sender from the configured mailbox; if declined, stops so the email can be handled manually. Setup Add IMAP credentials for the shared inbox in the email reading step. Add an OpenAI API credential for both the classification and reply generation model steps (or swap in another compatible chat model). Add SMTP/email-sending credentials for sending the approval request and the final reply. Update the configuration values for company name, the “from” address used to send emails, and the approver’s email address. Run the one-time data-table setup, select the resulting log and knowledge tables, and replace the example knowledge entries with your own. Configure a reachable HTTPS n8n webhook URL so approvers can open the decision forms. Requirements IMAP and SMTP access to a shared mailbox (e.g. info@) OpenAI API key, or any other chat model supported by n8n (for example a local Ollama model) Customization Adjust categories and classification instructions in Analysis schema and Analyze email, and keep approver routing in Merge analysis aligned. Adjust tone, length and rules of the replies in the Draft reply prompt Change reminder_after_hours and give_up_after_hours in Configuration. Defaults are four hours before the reminder and twenty additional hours before expiry. Additional info Invalid classification falls back to the general category and is flagged for the approver. A reply still requires an explicit Send reply decision with non-empty text. Opening an approval form does not send a reply; the decision must be submitted. Test the mailbox, model, data tables and approval flow with dummy messages before activating. An n8n automation workflow template by Anthony Höhener.
Community Metrics
Author
Anthony Höhener
Platform
web
Pricing model
free
Categories
- Automation
- AI
Tags
- n8n
- workflow
- send-email
- gmail
- microsoft-outlook
- code
- basic-llm-chain
- openai-chat-model
- structured-output-parser
Capabilities
- 7 nodes
- 1 views