Automation library · AI assistants

Triage and reply to email threads with OpenAI and IMAP

Started by an arriving email, and works across Email, Gmail and n8n data table. It hands the judgement calls to OpenAI. 19 steps, 1 branch: a working afternoon to understand properly.

MediumCalls a model: OpenAI

19 stepsMedium: a working afternoon
1Branch: places the flow splits
0Loops or waits
3Services it connects to

The flow

Model 1Logic 5Service 13

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

  1. 1When Email Received (IMAP)Email Read ImapService
  2. 2Filter Replied EmailsFilterLogic
  3. 3Parse Email ContentCodeLogic
  4. 4Prepare AI PromptCodeLogic
  5. 5Transfer Execution DataExecution DataService
  6. 6OpenAI Model InteractionOpen AiModel
  7. 7Normalize AI ResponseCodeLogic
  8. 8Route by Email StatusSwitchLogic
  9. 9Fetch Email Thread ID 1GmailService
  10. 10Fetch Email Thread ID 2GmailService
  11. 11Reply to Email - Thread ID 1GmailService
  12. 12Reply to Email - Thread ID 2GmailService
  13. 13Post to Suppression List APIHttp RequestService
  14. 14Insert Data to Table 2Data TableService
  15. 15Insert Data to Table 1Data TableService
  16. 16Add Label to Email Thread 2GmailService
  17. 17Add Label to Email Thread 1GmailService
  18. 18Remove Label from Thread 2GmailService
  19. 19Remove Label from Thread 1GmailService

How it's built

Starts on
An arriving email
Steps
19, with 1 branch
Size
Medium: a working afternoon
Connects to
Email, Gmail, n8n data table
Model
OpenAI

Questions

What does it need to run?

An n8n account, plus your own Email and Gmail 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?

Plan an afternoon. 19 steps is enough that you should read each one before running it.

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 19 steps before you point it at anything that matters.