On a schedule
Send Xero payment reminders that get firmer over time
Customers with overdue Xero invoices get a reminder from your Gmail at 7, 14 and 30 days late, each a little firmer, and you get a daily summary.
- Runs
- On a schedule
- Apps
- Gmail, Xero
- AI
- Not needed
- Access
- accounting.transactions.read; Gmail send
Send this to your assistant
Create a ClickRuntime automation: every weekday, pull unpaid Xero invoices and email customers from Gmail at 7, 14 and 30 days overdue with a tone that matches, then send me a summary. Never send the same stage twice.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A small agency invoices on 14-day terms and spends the end of every month writing awkward 'just following up' emails. Some clients get chased three times in a week; others are forgotten until an invoice is 90 days old.
A fixed reminder schedule, gentle at first and firmer later, is what credit controllers use. Sending it from your own Gmail keeps the personal touch, and recording each stage means nobody is chased twice for the same step.
What you get out of it
Paid sooner, with less effort
A predictable sequence of reminders is the simplest way to reduce how long clients take to pay.
The right tone at each stage
A friendly nudge at 7 days and a clear request at 30 days protect the relationship while still getting results.
Personal, not automated-looking
Reminders come from your address and replies reach your inbox, so clients answer you directly.
A daily view of collections
The summary email lists who was reminded and at which stage.
How it works
What happens, step by step
Every weekday morning, ClickRuntime asks Xero for approved invoices that still have an amount due.
It works out how many days late each one is.
At 7, 14 and 30 days, it emails the customer a reminder from your Gmail address, with wording that gets firmer at each stage.
It remembers which stage each invoice has reached, so no reminder is sent twice.
You get an email summary of the reminders sent.
Before it runs live
- Connect Google through your own Google app (a one-time, 10-minute setup), so it works with your own Gmail
- Connect Xero
What you get
Build your own
Need it to work differently?
Your own rules
Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.
Any number of apps
One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.
AI where it helps
Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.
On a schedule or on each event
Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.
Changes you can ask for
- Run it at a different time, more or less often, or only on weekdays
- Add an AI step, for example to summarize, sort or draft a reply
- Add another app, for example also send it to Slack
- Combine it with other Gmail and Xero steps into one automation
Under the hood
The code that runs this automation
import base64
from datetime import date
from email.message import EmailMessage
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_trigger, credentials, http, state, notify
XERO = "https://api.xero.com/api.xro/2.0"
TENANT = "your-xero-tenant-id"
def xero(method, path, **kw):
r = http.request(method, XERO + path, **kw, headers={"Accept": "application/json", "Xero-tenant-id": TENANT, "Authorization": "Bearer " + credentials.connection("xero", "company")})
return r.raise_for_status() or r.json()
STAGES = {7: "a friendly reminder", 14: "a second reminder", 30: "a final reminder before we follow up by phone"}
@on_trigger
def run(event):
invoices = xero("GET", "/Invoices", params={"Statuses": "AUTHORISED", "where": 'Type=="ACCREC"'})["Invoices"]
sent_stages, gmail, sent = state.get("stages") or {}, build("gmail", "v1", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False), []
for inv in invoices:
days = (date.today() - date.fromisoformat(inv["DueDateString"][:10])).days
stage = max([s for s in STAGES if days >= s], default=None)
email = inv["Contact"].get("EmailAddress")
if not stage or not email or sent_stages.get(inv["InvoiceID"], 0) >= stage:
continue
msg = EmailMessage()
msg["To"], msg["Subject"] = email, f"Invoice {inv['InvoiceNumber']} is {days} days overdue"
msg.set_content(f"Hello {inv['Contact']['Name']},\n\nThis is {STAGES[stage]}: invoice {inv['InvoiceNumber']} for "
f"{inv['CurrencyCode']} {inv['AmountDue']:,.2f} was due on {inv['DueDateString'][:10]}.\n\nThank you")
gmail.users().messages().send(userId="me", body={"raw": base64.urlsafe_b64encode(msg.as_bytes()).decode()}).execute()
sent_stages[inv["InvoiceID"]] = stage
sent.append(f"{inv['Contact']['Name']} {inv['InvoiceNumber']}: {inv['AmountDue']:,.2f} ({days} days, {stage}-day reminder)")
if sent:
notify.email_me(f"{len(sent)} payment reminders sent", "\n".join(sent))
state.set("stages", sent_stages)
return {"sent": len(sent)}FAQ
Common questions
What happens after the 30-day email?
Does a part-payment stop the reminders?
Can I send a statement instead of one email per invoice?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Turn emailed supplier invoices into Xero draft bills
Supplier invoices that arrive in Gmail become draft bills in Xero with the PDF attached, ready for you to approve.
See how it worksCreate a Xero invoice for each order and email it to the customer
When an order comes in, a Xero invoice is created and emailed to the customer from your Gmail with the PDF and a short personal note.
See how it worksKnow the moment your website goes down
Your team hears in Slack when the site stops responding or slows down, and again when it's back.
See how it worksKeep exploring
Set up “Send Xero payment reminders that get firmer over time” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.