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
- In n8n → Credentials → New → Microsoft Outlook OAuth2 API
- Log in with your Outlook account & approve access
- Attach this credential to the Get Messages from Outlook and Update Category nodes in the workflow
- (Optional) Adjust the limit field in Get Messages from Outlook if you want more/less than 5 results
2️⃣ Set Up OpenAI Connection
- Go to the OpenAI Platform
- Navigate to OpenAI Billing
- Add funds to your billing account
- 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?