Automation library · Money admin

Follow up on overdue invoices with OpenAI and Gmail

Started by a clock, and works across Gmail and Google Sheets. It hands the judgement calls to OpenAI. 22 steps, 4 branches, 1 loop or waits: large, and worth reading before you trust it with anything live.

LargeCalls a model: OpenAI

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

The flow

Starts it 1Model 1Logic 16Service 4

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

  1. 1When Daily at 9 AMSchedule triggerStarts it
  2. 2Initialize ConfigurationsCodeLogic
  3. 3Read from Invoice SheetsGoogle SheetsService
  4. 4Identify Eligibility StageCodeLogic
  5. 5Loop Through InvoicesSplit In BatchesLogic
  6. 6Process CompleteNo OpLogic
  7. 7Retrieve Gmail HistoryGmailService
  8. 8Construct Email ContextCodeLogic
  9. 9Check Stage Sent AlreadyIfLogic
  10. 10Reconcile Sent InvoicesCodeLogic
  11. 11Check Recent ConversationIfLogic
  12. 12Update Invoice in SheetsGoogle SheetsService
  13. 13Defer Due to Recent MsgCodeLogic
  14. 14OpenAI Classifier for EmailsOpen AiModel
  15. 15Interpret AI ClassificationCodeLogic
  16. 16Determine If AI Suggests SendIfLogic
  17. 17Craft Deterministic EmailCodeLogic
  18. 18Decide Human Review NeededIfLogic
  19. 19Gmail Reminder DispatchGmailService
  20. 20Queue for Human ReviewCodeLogic
  21. 21Configure AI DefermentCodeLogic
  22. 22Set Sent StatusCodeLogic

How it's built

Starts on
A clock
Steps
22, with 4 branches, 1 loop or waits
Size
Large: read it before trusting it with anything live
Connects to
Gmail, Google Sheets
Model
OpenAI

Questions

What does it need to run?

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

What starts it?

It starts on a clock.

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