Auto-Categorize Outlook Emails into Color Categories with GPT-4o

This workflow fetches recent emails from Outlook and uses OpenAI to assign a category (e.g., **Red**, **Yellow**, **Green**). It then updates each message's category in Outlook. --- ## Setup Instructions ### 1. Set Up Outlook Connection 1. In n8n, go to **Credentials > New > Microsoft Outlook OAuth2 API**. 2. Log in with your Outlook account & approve access. 3. Attach this credential to the **Get Messages from Outlook** and **Update Category** nodes in the workflow. 4. (Optional) Adjust the **limit** field in **Get Messages from Outlook** if you want more/less than 5 results. --- ### 2. Set Up OpenAI Connection 1. Go to the **[OpenAI Platform](https://platform.openai.com/api-keys)**. 2. Navigate to **[OpenAI Billing](https://platform.openai.com/settings/organization/billing/overview)**. 3. Add funds to your billing account. 4. Copy your API key into the **OpenAI** credentials in n8n and select it on the **OpenAI Chat Model** and **Categorizing Agent** nodes. --- ## Notes - The agent reads `subject` + `bodyPreview` and returns a JSON category. - The **Update Category** node writes that category back to Outlook. - You can tweak the category names or logic in the **Categorizing Agent** system message. --- ## Contact Need help customizing the categorization rules or routing categories to folders? - **robert@ynteractive.com** - **[Robert Breen](https://www.linkedin.com/in/robert-breen-29429625/)** - **[ynteractive.com](https://ynteractive.com)**

n8n

This workflow fetches recent emails from Outlook and uses OpenAI to assign a category (e.g., Red, Yellow, Green). It then updates each message's category in Outlook.


Setup Instructions

1. Set Up Outlook Connection

  1. In n8n, go to Credentials > New > Microsoft Outlook OAuth2 API.
  2. Log in with your Outlook account & approve access.
  3. Attach this credential to the Get Messages from Outlook and Update Category nodes in the workflow.
  4. (Optional) Adjust the limit field in Get Messages from Outlook if you want more/less than 5 results.

2. Set Up OpenAI Connection

  1. Go to the OpenAI Platform.
  2. Navigate to OpenAI Billing.
  3. Add funds to your billing account.
  4. Copy your API key into the OpenAI credentials in n8n and select it on the OpenAI Chat Model and Categorizing Agent nodes.

Notes

  • The agent reads subject + bodyPreview and returns a JSON category.
  • The Update Category node writes that category back to Outlook.
  • You can tweak the category names or logic in the Categorizing Agent system message.

Contact

Need help customizing the categorization rules or routing categories to folders?

$9.99
Last updated October 3, 2026
30-day money-back guarantee
Instant download
Lifetime updates included

New buyers can create an account from the cart to unlock a controlled $10 first-purchase credit on eligible orders of $25+.

Secure checkout powered by Stripe

Support

How to import this workflow into n8n

  1. 1Purchase or download the workflow to get the n8n workflow JSON file.
  2. 2In your n8n instance, open Workflows and choose "Import from File" (or paste the JSON with Ctrl+V on the canvas).
  3. 3Open each node marked with a credential warning and connect your own accounts and API keys.
  4. 4Run the workflow once manually to verify the data flow, then toggle it to Active.

Related Communication workflows

More from Robert Breen

Need this deployed? We'll set it up for you.

Our automation experts deploy this workflow in your stack, connect your accounts, and verify it works — or build a custom solution from scratch.