This n8n AI Agent Will Manage Your Outlook Inbox (100% Automatic)

By Jono Catliff

Share:

Key Concepts

  • NADN Workflow Automation: A platform for building automated processes.
  • Email Management System: An automated system to handle incoming emails.
  • Triggers: Events that initiate a workflow (e.g., email received).
  • Actions: Steps performed within a workflow (e.g., sorting, replying, downloading).
  • AI Text Classifier: A tool to categorize text based on predefined descriptions.
  • Large Language Models (LLMs): AI models like OpenAI's GPT used for text generation and classification.
  • API Key: A credential for authenticating access to services like OpenAI.
  • Data Mapping: Connecting output data from one step to the input of another.
  • Attachments Handling: Downloading and processing files from emails.
  • Cloud Storage Integration: Connecting with services like OneDrive for file storage.
  • Contact Creation: Automatically adding email senders as contacts.

Automated Outlook Email Management System

This video details the construction of a comprehensive Microsoft Outlook email management system using the NADN platform. The system aims to automate inbox management, saving users an estimated 15-30 minutes daily by handling tasks such as sorting emails, drafting AI responses, processing receipts, and managing contacts. The blueprints for this workflow are provided for free.

Workflow Setup: Trigger and Initial Actions

  1. Trigger: On Message Received (Outlook)

    • The workflow begins when a new email is received in the Outlook inbox.
    • Account Connection: Requires connecting your Microsoft Outlook account to NADN, granting it permissions to view, reply, delete, and update emails.
    • Poll Times: The NADN system checks for new emails at a set interval (e.g., every minute, hour).
    • Output: Raw: This setting is crucial to retrieve all available data from an email, not just a summary.
    • Download Attachments: An option to automatically download all attachments from incoming emails, particularly useful for receipts or invoices.
  2. Action: Extract HTML Content

    • Purpose: To strip away HTML, CSS, and other code from the email body, leaving only plain text for easier processing by AI.
    • Methodology:
      • Add an "Extract HTML content" action.
      • Specify the body.content field from the Outlook trigger as the source.
      • Use a CSS selector of * to remove all HTML tags.
      • Define a key, such as email_body, to reference the cleaned text in subsequent steps.

AI-Powered Email Classification

  1. Action: Text Classifier
    • Purpose: To categorize incoming emails into predefined folders using Artificial Intelligence.
    • Input Data: The classifier uses the sender, subject, and the cleaned email body for analysis.
    • Categories: Users can define custom folders (e.g., Personal, Promotional, Social, Receipts, Work, Miscellaneous).
    • Category Descriptions: Each category requires a concise description to guide the AI. Examples provided:
      • Personal: Time-sensitive, requires attention or response.
      • Work: Client-related, sales, deals, contracts, follow-ups.
      • Social: Notifications from social platforms (Facebook, YouTube, Instagram, etc.).
      • Promotional: Marketing emails, offers, discounts.
      • Receipts: Invoices, bills, payments, confirmations from financial tools (Dex, Stripe).
      • Miscellaneous: A catch-all for emails that don't fit other categories.
    • AI Model Integration: Requires connecting a Large Language Model (LLM) like OpenAI's GPT.
      • Credential Setup: An API key from OpenAI is needed. Users receive free credits initially, but a small balance ($5 minimum) might be required for continued use.
    • Output: The classifier assigns one category to each email. The option "Allow multiple classes to be true" should be turned off to ensure emails are routed to a single folder.

Email Sorting and Prioritization

  1. Action: Update Message (Outlook)
    • Purpose: To move classified emails into their designated Outlook folders.
    • Methodology:
      • For each category identified by the Text Classifier (e.g., Miscellaneous, Personal, Work, Social, Promotional, Receipts), a separate "Update Message" action is configured.
      • Message ID: The unique ID of the received email is used to identify which message to update.
      • Folder Selection: The system specifies the target folder (e.g., "Miscellaneous," "Personal").
    • Importance and Read Status:
      • Personal Emails: Can be marked as "High" importance.
      • Social and Promotional Emails: Can be marked as "Red" and assigned "Low" importance to de-prioritize them.

AI-Generated Email Drafts

  1. Action: Message Model (OpenAI)

    • Purpose: To generate a draft response to incoming emails using AI.
    • Model Selection: GPT-5 Mini is suggested for its balance of cost and speed.
    • System and User Messages:
      • System Message: Provides instructions to the AI (e.g., "You're an intelligent bot capable of replying very politely in a Canadian fashion to incoming emails.").
      • User Message: Contains the input email data (sender, subject, cleaned body).
    • Customization: Rules can be added, such as signing off with a specific name ("Best Jonno").
    • Iterative Process: The AI prompts and rules can be refined over time for better results.
  2. Action: Reply to Message (Outlook)

    • Purpose: To create a draft of the AI-generated response to the incoming email.
    • Methodology:
      • Uses the Message ID of the original email.
      • The AI-generated message is used as the reply content.
      • Save as Draft: This option is recommended initially to review and edit the AI's response before sending automatically.

Contact Creation and Attachment Handling

  1. Action: Create Contact (Outlook)

    • Purpose: To automatically add senders of work-related emails as contacts.
    • Data Extraction: Requires splitting the full name from the sender's information into first and last names.
    • ChatGPT for Data Manipulation: ChatGPT can be used to generate JavaScript functions to extract first and last names from a full name string.
    • Workflow Routing: This action is placed within the "Work" path of the workflow, ensuring contacts are created only for work-related emails.
  2. Action: Get Many Attachments (Outlook)

    • Purpose: To retrieve all attachments from an email.
    • Methodology:
      • Uses the Message ID to identify the email.
      • Returns a list of attachments, allowing for processing of multiple files.
    • Filter Step: A filter is added to ensure the workflow only proceeds if attachments are actually present, preventing errors.
  3. Action: Download Attachment (Outlook)

    • Purpose: To download individual attachments.
    • Requirements: Message ID and Attachment ID are needed.
    • Processing: This action is executed for each attachment found.
  4. Action: Send Message (Outlook) / Upload File (OneDrive)

    • Purpose: To handle downloaded attachments.
    • Options:
      • Forward to Accountant: Send the attachments via email to a designated recipient.
      • Upload to OneDrive: Store the attachments in a specific folder in OneDrive for cloud access.
        • Folder ID: Requires obtaining the ID of the target OneDrive folder. This can be done by using a "Get Folder" action in OneDrive and then hardcoding the ID.
        • File Name and Binary Data: The downloaded attachment's name and binary data are used for the upload.

Conclusion and Further Integrations

The constructed system automates a significant portion of email management, offering substantial time savings. The video highlights the flexibility of NADN for integrating with other Microsoft applications:

  • Microsoft Teams: For notifications on important emails.
  • Microsoft To-Do: To create tasks from emails.
  • Microsoft Excel: To add email data to spreadsheets.

The presenter emphasizes that this automation can be set up in 30-60 minutes and provides ongoing benefits, acting as a cost-effective alternative to hiring a personal assistant. The video concludes by promoting a community and agency for further learning and implementation of automation tools.

Chat with this Video

AI-Powered

Load the transcript when you're ready to chat so the initial page stays lighter.

Ready to summarize another video?

Summarize YouTube Video