Skip to main content

Automated inbox organization for Outlook using GPT-4.1 agent

Workflow preview

Workflow preview
100%
Automated inbox organization for Outlook using GPT-4.1 agent preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Auto Categorize Outlook Emails with AI in n8n How It Works 1. Trigger: The workflow starts with the Microsoft Outlook Trigger node, polling your inbox every minute for new emails. 2. Extract & Clea...

Best for

  • Ticket Management automation workflows
  • AI Summarization automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

n8n-nodes-base.microsoftoutlooktrigger, @n8n/n8n-nodes-langchain.agent, n8n-nodes-base.microsoftoutlooktool, @n8n/n8n-nodes-langchain.lmchatopenrouter, n8n-nodes-base.stickynote, n8n-nodes-base.markdown, n8n-nodes-base.code

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by AlexAutomates.

Original n8n.io source

1.1 Workflow description

Title
Automated inbox organization for Outlook using GPT-4.1 agent
Workflow name
Automated inbox organization for Outlook using GPT-4.1 agent

Auto-Categorize Outlook Emails with AI in n8n

How It Works

  1. Trigger: The workflow starts with the Microsoft Outlook Trigger node, polling your inbox every minute for new emails.

  2. Extract & Clean Email Content: The email’s key fields (from, subject, isRead, body) are extracted. The body is converted from HTML to Markdown, then sanitized to plain text for reliable AI processing.

    Node Setup Details:

    • Microsoft Outlook Trigger

      • Resource: Message
      • Operation: Trigger on new email
      • Fields to Output: from, subject, isRead(optional), body
      • Folders to Include: (Set to your Inbox or specific folder IDs)
    • Markdown Node

      • Input: {{$json["body"]["content"]}} (HTML email body)
      • Output Key: Email Body Markdown
      • Purpose: Converts HTML to Markdown for easier downstream processing.
    • Sanitize Node (Code Node)

      • Input: Email Body Markdown from previous node
      • Purpose: Cleans up Markdown, strips images, links, HTML tags, table formatting, and truncates to 4000 characters.
      • Sample JS Code:
        // Get the markdown content from the previous node
        const markdownContent = $input.item.json["Email Body Markdown"];
        
  3. Setup AI tools

    • Move message and Get Folders Outlook tools are required, get contacts is optional.
    • Set each field in the tools to "defined automatically by the model" and describe each field so the model understands how to use it.
    • OpenRouter or other LLM models tool: You can use any client for this, but make sure to use a model that does well with tool calls (Claude, GPT-4.1, Gemini 2.5 Pro, etc.).

Best Practices & Notes

  • AI Prompt Engineering: The AI is instructed to be conservative—never move emails from real people or saved contacts, and always explain its reasoning if it doesn’t move a message.
  • This automation only works for NEW incoming messages.
  • Inbox Zero: This system is designed to help you achieve and maintain Inbox Zero by keeping only actionable items in your main inbox.
  • Customization: You can adjust the folder logic, add more categories, or tweak the AI prompt for your specific needs.
  • Privacy: All processing happens within your n8n instance; no email data is stored outside your environment except for the AI call (which only receives sanitized, minimal content).

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Microsoft Outlook Trigger

Type / Role
n8n-nodes-base.microsoftOutlookTrigger - microsoftOutlookTrigger
Config choices
Version 1

Block 2 - AI Agent - Determine Category

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.6

Block 3 - Move Message

Type / Role
n8n-nodes-base.microsoftOutlookTool - microsoftOutlookTool
Config choices
Version 2

Block 4 - Get Folders

Type / Role
n8n-nodes-base.microsoftOutlookTool - microsoftOutlookTool
Config choices
Version 2

Block 5 - OpenRouter Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenRouter - lmChatOpenRouter
Config choices
Version 1

Block 6 - Get Contacts

Type / Role
n8n-nodes-base.microsoftOutlookTool - microsoftOutlookTool
Config choices
Version 2

Block 7 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 8 - Markdown

Type / Role
n8n-nodes-base.markdown - markdown
Config choices
Version 1

Block 9 - Sanitize Email Body

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

3. Summary Table

Workflow Automated inbox organization for Outlook using GPT-4.1 agent
Complexity intermediate
Nodes 9
Categories Ticket Management, AI Summarization
Author AlexAutomates
Published 25 Jul 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/6454/6454.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Automated inbox organization for Outlook using GPT-4.1 agent do?

Auto Categorize Outlook Emails with AI in n8n How It Works 1. Trigger: The workflow starts with the Microsoft Outlook Trigger node, polling your inbox every minute for new emails. 2. Extract & Clea...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Ticket Management, AI Summarization use case.