2_email_triage
2. Intelligent Email Triage and Response
Description
This workflow monitors an email inbox, uses a Large Language Model (LLM) to classify incoming emails, and then takes action based on the classification. It can categorize emails (e.g., "Sales Lead," "Support Request"), and for certain categories, draft and send an automated reply.
Architecture
graph TD
A[Email Trigger] --> B{AI Agent LLM};
B --> C{Switch};
C -- Sales Lead --> D[Create CRM Lead];
C -- Support Request --> E[Send Auto-Reply];
C -- Other --> F[Mark as Read];
Setup
- Import Workflow: Import the
workflow.jsonfile into your n8n instance. - Configure Email Trigger:
- In the "New Email Trigger" node, create or select your IMAP/OAuth2 email credentials.
- Specify the "Folder" you want to monitor (e.g.,
INBOX).
- Configure LLM:
- In the "Classify Email" node, replace the placeholder URL with the API endpoint of your chosen LLM.
- Configure the authentication with your LLM API key, similar to the previous project.
- Adjust the
promptin the JSON body to define your desired categories.
- Configure Switch:
- Review the paths in the "Route by Category" switch node. Ensure the
Valuein each path matches the output you defined in the LLM prompt.
- Review the paths in the "Route by Category" switch node. Ensure the
- Configure Actions:
- Sales Lead: In the "Create CRM Lead" node (example: HubSpot), create or select your CRM credentials and map the fields from the email.
- Support Request: In the "Draft & Send Reply" branch, configure the "Send Email" node with your email credentials. The body of the email is pre-filled with the AI-generated draft.
Execution
- This workflow can be triggered in two ways:
- Push: (Recommended) The email server sends a push notification to n8n. This is the most efficient method but requires more server configuration.
- Poll: n8n checks for new emails every few minutes. This is easier to set up.
- Once activated, it will process every new email in the specified folder.