Skip to content

Every 15 minutes

Approve supplier invoices in Slack before they go into Xero

New supplier invoices are read and posted to Slack with Approve and Reject buttons, and approved ones become bills in Xero.

Runs
Every 15 minutes
Apps
Slack, Xero
AI
Yes, uses the built-in AI allowance
Access
chat:write; accounting.transactions

Send this to your assistant

Create a ClickRuntime automation: every 15 minutes, read new invoice emails with AI and post each to #finance with Approve and Reject buttons; when someone approves, create the bill in Xero.

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

Spending approval in a small company usually means forwarding an invoice to the manager and waiting. The email gets buried, the supplier chases, and the bookkeeper can't enter the bill until someone says yes.

Putting the invoice in Slack with Approve and Reject buttons turns a forwarded email into a one-click decision, and the approved bill goes straight into Xero.

What you get out of it

  • Faster sign-off

    Managers approve from Slack, often within minutes, instead of finding the email later.

  • Clear accountability

    Each message records who approved or rejected the invoice.

  • Only approved spend is entered

    Bills reach Xero only after a yes, so rejected invoices never clutter your payables.

  • No typing from PDFs

    Supplier, reference and amount are read for you.

How it works

What happens, step by step

  1. Every 15 minutes, ClickRuntime checks your inbox for new invoice emails.

  2. AI reads each one and picks out the supplier, reference and amount.

  3. It posts the invoice to #finance with Approve and Reject buttons.

  4. When someone approves, the bill is created in Xero and the Slack message shows who approved it.

  5. Invoices already posted are remembered, so nothing is posted twice.

Before it runs live

  • Connect Slack, then invite the app to the channel (type /invite @ClickRuntime there)
  • Connect Xero

What you get

RunsEvery 15 minutes
Approve supplier invoices in Slack before they go into Xerotoday, 9:00Succeeded
Slack · #financeNorthwind Supplies INV-2291: 1,280.00 [Approve] [Reject]

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

  • Act only on the items that match your own rules, and skip the rest
  • Change what the AI looks for, or how it writes the result
  • Add another app, for example also send it to Google Sheets
  • Combine it with other Slack 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.
approve_supplier_bills_in_slack_before_posting_to_xero.pyexample
import json
from urllib.parse import parse_qs
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from slack_sdk import WebClient
from clickruntime import on_trigger, on_event, credentials, http, state, ai, report_fetched
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()

@on_trigger
def run(event):
    gmail, seen = build("gmail", "v1", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False), set(state.get("seen") or [])
    msgs = [m for m in gmail.users().messages().list(userId="me", q="label:Invoices newer_than:3d").execute().get("messages", []) if m["id"] not in seen]
    report_fetched(len(msgs))
    if not msgs:
        return {"summary": "Nothing new"}
    for m in msgs:
        snippet = gmail.users().messages().get(userId="me", id=m["id"]).execute()["snippet"]
        f = ai.generate(f"Return JSON supplier, reference, amount from:\n{snippet}", max_output_tokens=80, json_schema={"type": "object",
                        "properties": {"supplier": {"type": "string"}, "reference": {"type": "string"}, "amount": {"type": "number"}}}).json
        buttons = [{"type": "button", "text": {"type": "plain_text", "text": t}, "action_id": t.lower(), "value": json.dumps(f)} for t in ("Approve", "Reject")]
        WebClient(token=credentials.connection("slack", "work")).chat_postMessage(channel="#finance", text=f"{f['supplier']} {f['reference']}: {f['amount']:,.2f}",
            blocks=[{"type": "section", "text": {"type": "mrkdwn", "text": f"*{f['supplier']}* {f['reference']}: {f['amount']:,.2f}"}}, {"type": "actions", "elements": buttons}])
        seen.add(m["id"])
    state.set("seen", list(seen)[-500:])
    return {"posted": len(msgs)}

@on_event
def clicked(event):
    p = json.loads(parse_qs(event.body)["payload"][0])
    action, f = p["actions"][0]["action_id"], json.loads(p["actions"][0]["value"])
    if action == "approve":
        xero("PUT", "/Invoices", json={"Invoices": [{"Type": "ACCPAY", "Status": "AUTHORISED", "Contact": {"Name": f["supplier"]}, "InvoiceNumber": f["reference"],
             "LineItems": [{"Description": f["reference"], "Quantity": 1, "UnitAmount": f["amount"], "AccountCode": "400"}]}]})
    WebClient(token=credentials.connection("slack", "work")).chat_update(channel=p["channel"]["id"], ts=p["message"]["ts"], blocks=[],
        text=f"{f['supplier']} {f['reference']} {f['amount']:,.2f}: {action}d by <@{p['user']['id']}>")
    return {"action": action}

FAQ

Common questions

Is the bill created as approved or draft?
As awaiting payment, since it's already been approved in Slack. Ask for draft if your bookkeeper wants a second check.
Can I restrict who approves?
Yes. List the Slack users allowed to approve; clicks from anyone else are ignored.
What does the Slack app need?
Your workspace's Slack app with interactivity turned on and the request URL set to your automation's trigger link.
What permissions does it need?
chat:write; accounting.transactions. Nothing else in your accounts is used.
Does it need AI?
Yes. It uses ClickRuntime's built-in AI, so you don't need an OpenAI or Anthropic key. Every plan includes a monthly AI allowance.
How many runs does it use?
One run each time it checks. Checks that find nothing new 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 “Approve supplier invoices in Slack before they go into Xero” from your assistant

Copy the prompt above, or connect your assistant first. Free plan, no credit card.