Skip to content

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.

Paste it into your assistant. It tells you what it will send or change before it runs live.

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

  1. Every weekday morning, ClickRuntime asks Xero for approved invoices that still have an amount due.

  2. It works out how many days late each one is.

  3. At 7, 14 and 30 days, it emails the customer a reminder from your Gmail address, with wording that gets firmer at each stage.

  4. It remembers which stage each invoice has reached, so no reminder is sent twice.

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

RunsOn a schedule
Send Xero payment reminders that get firmer over timetoday, 9:00Succeeded
Email · Reminders2 payment reminders sent: Acme Ltd INV-0412: 1,800.00 (15 days, 14-day reminder)

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • 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

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
tiered_overdue_invoice_reminders_from_xero_via_gmail.pyexample
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?
No more automatic emails are sent for that invoice. It stays in your summary so you can decide whether to call or escalate.
Does a part-payment stop the reminders?
Reminders use the amount still due. An invoice that's fully paid in Xero drops out automatically.
Can I send a statement instead of one email per invoice?
Yes. Ask for one email per customer listing all their overdue invoices.
What permissions does it need?
accounting.transactions.read; Gmail send. Nothing else in your accounts is used.
Does it need AI?
No. It runs without AI, so it doesn't use your plan's AI allowance.
How many runs does it use?
One run each time it runs (on a schedule). Checks that find nothing to do and stop right away aren't counted.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

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.