Automation library · AI assistants

Triage and label Gmail emails with OpenAI

Started by an arriving email, and works across Gmail. It hands the judgement calls to OpenAI. 28 steps, 4 branches: large, and worth reading before you trust it with anything live.

LargeCalls a model: OpenAI

28 stepsLarge: read it before trusting it with anything live
4Branches: places the flow splits
0Loops or waits
1Service it connects to

The flow

Starts it 1Model 2Logic 11Service 14

The steps in the order they run, from what starts it.

  1. 1Watch unread Gmail emailsGmail triggerStarts it
  2. 2OpenAI model - email classificationLm Chat Open AiModel
  3. 3Normalize email fieldsCodeLogic
  4. 4Classify email with OpenAIAgentModel
  5. 5Validate AI result & guardrailsCodeLogic
  6. 6Route by email categorySwitchLogic
  7. 7Apply category: UrgentGmailService
  8. 8Apply category: ClientGmailService
  9. 9Apply category: ProspectGmailService
  10. 10Apply category: FinanceGmailService
  11. 11Apply category: AdminGmailService
  12. 12Apply category: NewsletterGmailService
  13. 13Apply category: SpamGmailService
  14. 14Apply category: OtherGmailService
  15. 15Merge category branchesMergeLogic
  16. 16Route by prioritySwitchLogic
  17. 17Apply priority: HighGmailService
  18. 18Apply priority: MediumGmailService
  19. 19Apply priority: LowGmailService
  20. 20Merge priority branchesMergeLogic
  21. 21Confidence check: review needed?IfLogic
  22. 22Apply label: AI reviewGmailService
  23. 23Reply needed?IfLogic
  24. 24Merge completion pathsMergeLogic
  25. 25Create Gmail reply draftGmailService
  26. 26Continue without draftSetLogic
  27. 27Apply label: AI triagedGmailService
  28. 28Output triage summarySetLogic

How it's built

Starts on
An arriving email
Steps
28, with 4 branches
Size
Large: read it before trusting it with anything live
Connects to
Gmail
Model
OpenAI

Questions

What does it need to run?

An n8n account, plus your own Gmail account, and a key for OpenAI. You connect your own accounts after importing it; none are included.

What starts it?

It starts on an arriving email.

Does it use AI?

Yes. It calls OpenAI. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 28 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

Before you run it

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 28 steps before you point it at anything that matters.