# Triage Gmail inbox emails and draft replies with OpenAI and Google Sheets

> Quick overview This workflow runs every 10 minutes to triage new Gmail inbox emails with OpenAI, apply Gmail labels, create reply drafts for messages that need a response, optionally send urgent alert emails, and log the triage results to Google Sheets. How it works 1. Runs every 10 minutes and loads configuration values such as the Gmail search query, label names, OpenAI model, and Google Sheets destination. 2. Reads existing Gmail labels and, if enabled, creates any missing AI-related labels used for triage and categorization. 3. Fetches a limited batch of untriaged Gmail inbox messages matching the configured search query and cleans the body text (removing HTML and quoted history). 4. Sends each email to the OpenAI Chat Completions API to return structured JSON with category, priority, sentiment, summary, next steps, and an optional reply draft. 5. Validates the AI output and decides whether to apply labels, flag the email for review, create a Gmail reply draft, and/or trigger an ur

- **Domain**: `n8n-workflow-20570.n8n.io`
- **Provider**: n8n.io (https://n8n.io)
- **Kind**: workflow
- **Live-responds (last probe)**: None
- **Signed card**: False
- **Streaming**: False
- **Quality score**: 40%

## URLs
- Agent card: https://n8n.io/workflows/20570
- Page (HTML): https://agenstry.com/agents/n8n-workflow-20570.n8n.io
- Documentation: https://n8n.io/workflows/20570
