Quick overview
This workflow monitors a Gmail inbox, uses an OpenAI chat model to classify each new email into a trust level, and then either marks it as read, drafts a reply for your approval via Gmail, or sends you a notification to handle it yourself.
How it works
- Triggers when a new Gmail message arrives that matches the configured Gmail search filter.
- Sends the sender, subject, and email snippet to an OpenAI chat model with a structured output format to assign a trust level (auto, draft, or human) plus a reason and optional reply draft.
- For 🟢 auto emails, marks the original Gmail message as read.
- For 🟡 draft emails, emails the proposed reply to your approval address using Gmail “send and wait” buttons to approve or reject sending.
- If you approve, replies to the original Gmail thread with the AI-drafted message.
- For 🔴 human emails (or unclear classifications), sends a notification email to your approval address with the reason and the message snippet and takes no further action.
Setup
- Connect a Gmail OAuth2 credential and select it in all Gmail nodes (trigger, mark as read, send-and-wait approval, reply, and notification).
- Add an OpenAI API credential and select it in the OpenAI Chat Model node (or swap to another compatible chat model node).
- Set your approval/alert recipient by updating
approval_email in the Config step.
- Adjust the Gmail trigger search query (currently
subject:AI-test) to match the emails you want to process before activating the workflow.