๐ซ Intelligent Gmail label management with AI & Discord notifications
โก 519 views ยท ๐ซ Ticket Management & Triage
Description
How it works
- This workflow will trigger upon new mail in your gmail inbox and will automatically apply existing labels OR identify, create, then apply up to 5 new labels.
- This is currently set up to run using a OpenAI endpoint which I have set up connected to my local llama.cpp server running.
- After your email is done labeling, the workflow will send you a nice notification in your discord channel!
Set up Instructions
- This workflow requires a Gmail OAuth account credential with the ability to create labels and label messages
- [OPTIONAL] You can create a Discord Bot Account which connects with a Bot Token which will summarize the email and show you which labels were created and added in the workflow.
- You might want to tweak the prompts a bit based on how detailed you want your labels. Iโve found after running it for a bit that the labels that get created mostly encompass everything I want.
Workflow Hints
- The workflow works in 5 phases โ Phase 1: Find existing Gmail labels as options for the LLM to choose from. โ Phase 2: LLM chooses labels or defines new ones โ Phase 3: Create additional Gmail labels if needed โ Phase 4: Label the message with newly created and existing labels โ Phase 5: Rewrite and send a message notification via Discord.
Screenshot 1: Screenshot 20250831 at 9.06.29โฏPM.png Note: colors are my own
Screenshot 20250831 at 9.09.01โฏPM.png Screenshot of notification sent via discord
Model Tips
- I set this up to run completely using offline models. I had good success with Llama.cpp server with gpt-oss-20B and with a bit more tweaking could get it to work with a smaller gemma3-4b model mostly likely as well.
- The whole workflow runs in about 5-10 seconds on my Blackwell Nvidia GPU. Probably would be a few seconds slower on an older piece of hardware.
๐ Nodes Used
Discord, Gmail, Gmail Trigger, Filter, Basic LLM Chain, OpenAI Chat Model
๐ฅ Import
Download workflow.json and import into n8n:
Workflow menu โ Import from File