See llms.txt for all machine-readable content.

Back to Templates

Triage and reply to Gmail with OpenAI trust levels and human approval

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

  1. Triggers when a new Gmail message arrives that matches the configured Gmail search filter.
  2. 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.
  3. For 🟢 auto emails, marks the original Gmail message as read.
  4. For 🟡 draft emails, emails the proposed reply to your approval address using Gmail “send and wait” buttons to approve or reject sending.
  5. If you approve, replies to the original Gmail thread with the AI-drafted message.
  6. 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

  1. Connect a Gmail OAuth2 credential and select it in all Gmail nodes (trigger, mark as read, send-and-wait approval, reply, and notification).
  2. Add an OpenAI API credential and select it in the OpenAI Chat Model node (or swap to another compatible chat model node).
  3. Set your approval/alert recipient by updating approval_email in the Config step.
  4. Adjust the Gmail trigger search query (currently subject:AI-test) to match the emails you want to process before activating the workflow.