π« Triage Gmail inbox, label emails, and draft replies with OpenAI
β‘ 38 views Β· π« Ticket Management & Triage
Description
Quick overview
This workflow watches for new unread Gmail messages, uses OpenAI to classify each email and draft a reply, then either creates a Gmail draft in the original thread and labels the message for follow-up, or files it by applying FYI/Noise labels.
How it works
- Triggers every minute when a new unread email arrives in Gmail.
- Sends the email subject and snippet to OpenAI to return a category, a draft reply, and a flag indicating whether the sender is waiting for an answer.
- If an answer is needed, creates a Gmail draft reply in the same thread addressed to the original sender.
- Labels the original Gmail message as YouDecide when OpenAI classifies it as βduβ, otherwise labels it as Drafted.
- If no answer is needed, labels the original Gmail message as Noise when OpenAI classifies it as βwerbungβ, otherwise labels it as FYI.
Setup
- Connect your Gmail OAuth2 account and select the same credential in the Gmail trigger and all Gmail action steps.
- Add your OpenAI API credentials and pick a model that can return JSON. The system message is already written - adjust the four category definitions if your inbox needs different buckets.
- Create the four Gmail labels used by the workflow (YouDecide, Drafted, FYI, Noise) and update the label IDs in the labeling steps if they differ in your account.
π Nodes Used
Gmail, Gmail Trigger, OpenAI
π₯ Import
Download workflow.json and import into n8n:
Workflow menu β Import from File