How to triage your inbox to zero with AI labels and drafts
When to use: Monday morning or post-vacation when your inbox is a war zone.
Prerequisites
- Google Cloud project with Gmail API enabled — console.cloud.google.com > APIs > Gmail API > Enable
- OAuth 2.0 Desktop credentials — Credentials > Create OAuth client > Desktop. Set GOOGLE_OAUTH_CLIENT_ID and _SECRET env vars
Flow
-
Pull last week of unreadSearch Gmail for unread messages from the last 7 days. Group by sender category (team, external, vendor, newsletter).✓ Copied→ Grouped counts + preview lines
-
Auto-label + archive newslettersFor the newsletter bucket, label them 'newsletter' and archive.✓ Copied→ Count archived, thread ids
-
Draft replies to the top-5 real threadsFor the 5 most important threads (client ask, blocker, decision needed), draft a concise reply. Do not send — just draft.✓ Copied→ 5 drafts visible in Gmail
Outcome: Inbox under 20, drafts ready to review + send.
Pitfalls
- AI sends replies instead of drafting — Always say 'draft only' in the prompt; disable send_gmail_message for untrusted sessions