Automation library · Chat assistants

Smart email manager with Gmail and OpenAI

Started by an arriving email, and works across Gmail, Google Drive and Telegram. It hands the judgement calls to OpenAI. 26 steps, 4 branches, 1 loop or waits: large, and worth reading before you trust it with anything live.

LargeCalls a model: OpenAI

26 stepsLarge: read it before trusting it with anything live
4Branches: places the flow splits
1Loop or waits
3Services it connects to

The flow

Starts it 1Model 5Logic 11Service 9

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

  1. 1Structured Output ParserOutput Parser StructuredModel
  2. 2Email_TriggerGmail triggerStarts it
  3. 3AI Language ModelLm Chat Open AiModel
  4. 4Get Specific File TypesFunctionLogic
  5. 5Auto-fixing Output ParserOutput Parser AutofixingModel
  6. 6Process One by OneSplit In BatchesLogic
  7. 7AI Email ClassifierChain LlmModel
  8. 8AI Response GeneratorChain LlmModel
  9. 9Get Conversation ThreadGmailService
  10. 10Smart Action RouterSwitchLogic
  11. 11Create Draft ResponseGmailService
  12. 12Get Latest Message IDLimitLogic
  13. 13Check for AttachmentsIfLogic
  14. 14Send Urgent AlertTelegramService
  15. 15Aggregate Label IDsAggregateLogic
  16. 16Get Latest Message ContentGmailService
  17. 17Get All AttachmentsFunctionLogic
  18. 18Mark as ProcessedGmailService
  19. 19Assign Classification LabelGmailService
  20. 20Get All Gmail LabelsGmailService
  21. 21Check Existing AttachmentsGoogle DriveService
  22. 22Merge Attachment DataMergeLogic
  23. 23Filter User LabelsIfLogic
  24. 24Check if File ExistsIfLogic
  25. 25Upload to Google DriveGoogle DriveService
  26. 26Get User LabelsAggregateLogic

How it's built

Starts on
An arriving email
Steps
26, with 4 branches, 1 loop or waits
Size
Large: read it before trusting it with anything live
Connects to
Gmail, Google Drive, Telegram
Model
OpenAI

Questions

What does it need to run?

An n8n account, plus your own Gmail, Google Drive and Telegram accounts, 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 26 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 26 steps before you point it at anything that matters.