# Follow up on overdue invoices with OpenAI and Gmail: n8n workflow

> Started by a clock, and works across Gmail and Google Sheets. It hands the judgement calls to OpenAI.

Source: https://millionrounds.com/workflow/follow-up-on-overdue-invoices-with-openai-and-gmail (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Money admin](https://millionrounds.com/workflows?category=Money+admin#library)

# 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.

Large Calls a model: OpenAI

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Ffollow-up-on-overdue-invoices-with-openai-and-gmail)

**22 steps** Large: read it before trusting it with anything live

**4** Branches: places the flow splits

**1** Loop or waits

**2** Services it connects to

## The flow

Starts it 1 Model 1 Logic 16 Service 4

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

- 1 **When Daily at 9 AM** Schedule trigger *Starts it*
- 2 **Initialize Configurations** Code *Logic*
- 3 **Read from Invoice Sheets** Google Sheets *Service*
- 4 **Identify Eligibility Stage** Code *Logic*
- 5 **Loop Through Invoices** Split In Batches *Logic*
- 6 **Process Complete** No Op *Logic*
- 7 **Retrieve Gmail History** Gmail *Service*
- 8 **Construct Email Context** Code *Logic*
- 9 **Check Stage Sent Already** If *Logic*
- 10 **Reconcile Sent Invoices** Code *Logic*
- 11 **Check Recent Conversation** If *Logic*
- 12 **Update Invoice in Sheets** Google Sheets *Service*
- 13 **Defer Due to Recent Msg** Code *Logic*
- 14 **OpenAI Classifier for Emails** Open Ai *Model*
- 15 **Interpret AI Classification** Code *Logic*
- 16 **Determine If AI Suggests Send** If *Logic*
- 17 **Craft Deterministic Email** Code *Logic*
- 18 **Decide Human Review Needed** If *Logic*
- 19 **Gmail Reminder Dispatch** Gmail *Service*
- 20 **Queue for Human Review** Code *Logic*
- 21 **Configure AI Deferment** Code *Logic*
- 22 **Set Sent Status** Code *Logic*

## 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.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Ffollow-up-on-overdue-invoices-with-openai-and-gmail)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Gmail](https://millionrounds.com/workflows?service=Gmail#library)[Google Sheets](https://millionrounds.com/workflows?service=Google+Sheets#library)

## Workflows like it

Also money admin, with the same services where possible, closest in size first.

- [**Extract and organize Colombian invoices with Gmail and OpenAI** 22 steps · calls a model · Gmail, Google Drive](https://millionrounds.com/workflow/extract-and-organize-colombian-invoices-with-gmail-and-opena)
- [**Extract invoice data from Gmail PDFs** 22 steps · calls a model · Gmail, Google Drive](https://millionrounds.com/workflow/extract-invoice-data-from-gmail-pdfs)
- [**Log email receipt data to Google Sheets with Gmail and OpenAI** 22 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/log-email-receipt-data-to-google-sheets-with-gmail-and-opena)
- [**Process and validate invoices from Gmail and forms with OpenAI** 22 steps · calls a model · Gmail, Google Drive](https://millionrounds.com/workflow/process-and-validate-invoices-from-gmail-and-forms-with-open)
- [**Process emailed PDF invoices into QuickBooks bills with OpenAI** 22 steps · calls a model · Gmail](https://millionrounds.com/workflow/process-emailed-pdf-invoices-into-quickbooks-bills-with-open)
- [**WhatsApp AI Agent with Payments and CRM** 22 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/whatsapp-ai-agent-with-payments-and-crm)
