# Automate Xero invoices and payments with PostgreSQL: n8n workflow

> Started by another system calling it, and works across Google Calendar, Postgres and Twilio. 14 steps, 1 branch: a working afternoon to understand properly.

Source: https://millionrounds.com/workflow/automate-xero-invoices-and-payments-with-postgresql (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)

# Automate Xero invoices and payments with PostgreSQL

Started by another system calling it, and works across Google Calendar, Postgres and Twilio. 14 steps, 1 branch: a working afternoon to understand properly.

Medium

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fautomate-xero-invoices-and-payments-with-postgresql)

**14 steps** Medium: a working afternoon

**1** Branch: places the flow splits

**0** Loops or waits

**3** Services it connects to

## The flow

Starts it 5 Logic 1 Service 8

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

- 1 **Webhook Trigger - Invoice Created** Webhook *Starts it*
- 2 **Webhook - Payment Received** Webhook *Starts it*
- 3 **Xero - Create Invoice** Xero *Service*
- 4 **PostgreSQL - Update Payment Status** Postgres *Service*
- 5 **IF - Invoice Created Successfully** If *Logic*
- 6 **Xero - Update Invoice to Paid1** Xero *Service*
- 7 **Add Invoice Record** Postgres *Service*
- 8 **Respond to Webhook - Error** Respond To Webhook *Starts it*
- 9 **WhatsApp - Send Invoice Confirmation1** Twilio *Service*
- 10 **Google Calendar - Create Due Date Event** Google Calendar *Service*
- 11 **Google Calendar - Remove Due Date Event** Google Calendar *Service*
- 12 **WhatsApp - Send Invoice Confirmation** Twilio *Service*
- 13 **Respond to Webhook - Payment** Respond To Webhook *Starts it*
- 14 **Respond to Webhook - Success** Respond To Webhook *Starts it*

## How it's built

- **Starts on:** Another system calling it
- **Steps:** 14, with 1 branch
- **Size:** Medium: a working afternoon
- **Connects to:** Google Calendar, Postgres, Twilio
- **Model:** None. This is plumbing, not judgement

## Questions

What does it need to run?

An n8n account, plus your own Google Calendar, Postgres and Twilio accounts. You connect your own accounts after importing it; none are included.

What starts it?

It starts on another system calling it.

Does it use AI?

No. Every step is fixed logic or a call to a service, so it does the same thing every time.

How long does it take to set up?

Plan an afternoon. 14 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 14 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%2Fautomate-xero-invoices-and-payments-with-postgresql)
- **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.

[Google Calendar](https://millionrounds.com/workflows?service=Google+Calendar#library)[Postgres](https://millionrounds.com/workflows?service=Postgres#library)[Twilio](https://millionrounds.com/workflows?service=Twilio#library)

## Workflows like it

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

- [**Sync AWS billing invoices with FreeAgent and PostgreSQL** 14 steps · Postgres](https://millionrounds.com/workflow/sync-aws-billing-invoices-with-freeagent-and-postgresql)
- [**Process and validate invoices with OpenAI and PostgreSQL** 14 steps · calls a model · Postgres, Slack](https://millionrounds.com/workflow/process-and-validate-invoices-with-openai-and-postgresql)
- [**Send a monthly summary of days off to payroll** 13 steps · Email, Google Calendar](https://millionrounds.com/workflow/send-a-monthly-summary-of-days-off-to-payroll)
- [**Send Stripe invoice reminders with Google Sheets and Slack** 13 steps · calls a model · Email, Google Calendar](https://millionrounds.com/workflow/send-stripe-invoice-reminders-with-google-sheets-and-slack)
- [**Send payment check due-date reminders with Google Calendar** 16 steps · Google Calendar, Telegram](https://millionrounds.com/workflow/send-payment-check-due-date-reminders-with-google-calendar)
- [**Review and approve employee expenses with OpenAI** 16 steps · calls a model · Gmail, Google Calendar](https://millionrounds.com/workflow/review-and-approve-employee-expenses-with-openai)
