See llms.txt for all machine-readable content.

Back to Templates

Triage inbox emails and schedule follow-up reminders with OpenAI, Gmail and Sheets

Quick overview

This workflow triages new Gmail emails with OpenAI, logs each message to Google Sheets, creates Gmail drafts only for emails that need a reply, and sends you a daily Gmail digest of overdue follow-ups based on the sheet.

How it works

  1. Triggers when a new email arrives in Gmail (or runs a manual test with a sample email payload).
  2. Sends the email content to OpenAI to classify whether it needs a reply, assign an urgency tier, explain why, and generate two draft reply options.
  3. Parses the OpenAI response, calculates a follow-up date for emails that need a reply, and prepares a log record with a direct Gmail thread link.
  4. Appends the log record to a Google Sheets follow-up log for tracking.
  5. If the email is classified as needing a reply, creates a Gmail draft addressed to the original sender using the first drafted reply.
  6. On a daily schedule, reads the Google Sheets log, identifies threads whose follow-up date is due and haven’t been reminded yet, and emails you a digest with links to each thread.
  7. Records reminded thread IDs in workflow static data to avoid sending duplicate reminders on subsequent days.

Setup

  1. Add credentials for OpenAI (OpenAI API), Gmail, and Google Sheets to the workflow’s corresponding nodes.
  2. Select the same Google Sheets document and sheet in both the logging and daily read steps, and ensure the first row headers match: logged_at,sender,subject,classification,tier,why,needs_reply,follow_up_date,thread_id,gmail_link.
  3. Replace the digest recipient address (you@example.com) with your own email address in the reminder email step.
  4. (Optional) Update the schedule time and the follow-up delay rules for the today/week tiers in the code steps to match your workflow.

Requirements

  • An OpenAI (or OpenAI-compatible) API key
  • A Gmail account connected via n8n's Gmail credential
  • A Google account connected via n8n's Google Sheets credential
  • A Google Sheet with the header row: logged_at,sender,subject,classification,tier,why,needs_reply,follow_up_date,thread_id,gmail_link

Customization

  • Swap the urgency tiers or how many days ahead each tier triggers a nudge (edit the DAYS_BY_TIER map in the "Read triage result" code step)
  • Replace the Gmail digest with Slack or Telegram by swapping the final send node
  • Point the Gmail trigger's filters at a specific label or sender list to scope triage to part of your inbox
  • Swap the AI provider by changing the URL and auth type on the HTTP Request node — the prompt and JSON response shape are provider-agnostic

Additional info

Human-in-the-loop by design: the AI only ever creates a Gmail draft, never sends. The one autonomous send is the daily digest to yourself, never to the original sender.

Non-destructive: no node deletes, moves, or auto-replies. A bad classification at worst costs a missed draft or an extra Sheet row.

Dedupe uses n8n's built-in workflow static data, so there's no external database to stand up — this runs fine on the Starter plan.

The AI triage step calls a plain HTTP Request (not a vendor-locked AI node), so it's easy to repoint at Anthropic, Azure OpenAI, or any other OpenAI-compatible endpoint.