Skip to content

The moment it happens

Warn Slack about duplicate invoices before they're paid

When a new invoice arrives, it's checked against your Supabase records, saved with a status, and any likely duplicate is flagged in Slack.

Runs
The moment it happens
Apps
Slack, Supabase
AI
Not needed
Access
Supabase read+write; Slack chat:write

Send this to your assistant

Create a ClickRuntime automation: when a new invoice comes in at this link, check Supabase for one with the same vendor and amount in the last 60 days and warn #finance if it looks like a duplicate.

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

Duplicate invoices are one of the most common ways small companies overpay: a supplier sends the same invoice twice, or a scanned copy and the PDF both get entered. Each one looks fine on its own.

Checking every incoming invoice against recent ones by vendor, amount and number catches duplicates at the door, before anyone pays them.

What you get out of it

  • Stop paying twice

    Likely duplicates are flagged before they reach a payment run.

  • Every invoice recorded

    Each one is stored in Supabase with a clear status: new or possible duplicate.

  • Simple, explainable checks

    The Slack message says exactly which earlier invoice it matched.

  • Works with any source

    Scanners, email tools and accounting systems can all send invoices to the link.

How it works

What happens, step by step

  1. A new invoice arrives at your automation's link.

  2. ClickRuntime looks in your Supabase invoices table for the same invoice number, or the same vendor and amount in the last 60 days.

  3. It saves the invoice with a status of new or possible duplicate.

  4. Possible duplicates are posted to #finance in Slack with the matching invoice.

Before it runs live

  • Connect Slack, then invite the app to the channel (type /invite @ClickRuntime there)
  • Connect Supabase
  • Paste your automation's link into the other app's webhook settings

What you get

RunsThe moment it happens
Warn Slack about duplicate invoices before they're paidjust nowSucceeded
Slack · #finance⚠️ Possible duplicate: Acme Logistics 5530 for 412.50 matches invoice 5530 received 2026-10-02

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
  • Add an AI step, for example to summarize, sort or draft a reply
  • Add another app, for example also send it to Google Sheets
  • Combine it with other Slack and Supabase 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.
flag_duplicate_or_risky_records_in_supabase_to_slack.pyexample
from datetime import date, timedelta
from clickruntime import on_event, credentials, http, notify
SUPABASE = "https://your-project.supabase.co/rest/v1"

def sb(method, path, **kw):
    key = credentials.secret("SUPABASE_KEY")
    r = http.request(method, f"{SUPABASE}/{path}", **kw, headers={"apikey": key, "Authorization": f"Bearer {key}", "Prefer": "return=representation,resolution=merge-duplicates"})
    return r.raise_for_status() or (r.json() if r.content else None)

@on_event
def handle(event):
    inv = event.json or {}
    vendor, amount, number = inv["vendor"].strip(), round(float(inv["amount"]), 2), inv.get("number", "")
    since = date.today() - timedelta(days=60)
    same_number = sb("GET", "invoices", params={"vendor": f"ilike.{vendor}", "number": f"eq.{number}"}) if number else []
    same_amount = sb("GET", "invoices", params={"vendor": f"ilike.{vendor}", "amount": f"eq.{amount}", "received_on": f"gte.{since}"})
    match = (same_number or same_amount or [None])[0]
    sb("POST", "invoices", json={"vendor": vendor, "amount": amount, "number": number, "received_on": str(date.today()),
                                 "status": "possible duplicate" if match else "new", "event_id": event.event_id})
    if match:
        notify.slack(f":warning: Possible duplicate: {vendor} {number} for {amount:,.2f} matches invoice {match['number']} "
                     f"received {match['received_on']}", channel="#finance")
    return {"duplicate": bool(match)}

FAQ

Common questions

What counts as a duplicate?
The same invoice number from the same vendor, or the same vendor and amount within 60 days.
Is a flagged invoice deleted?
No. It's saved with the status 'possible duplicate' so someone can check and decide.
Can it check other records?
Yes. The same approach works for payments, refunds or uploaded files.
What permissions does it need?
Supabase read+write; Slack chat:write. 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 for each event the app sends.
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 “Warn Slack about duplicate invoices before they're paid” from your assistant

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