Skip to content

On a schedule

List at-risk clients from Supabase in a sheet every morning

Every morning, clients who haven't visited in 14 days are written to your At Risk sheet and you get an email summary.

Runs
On a schedule
Apps
Google Sheets, Supabase
AI
Optional
Access
Supabase read; sheet edit

Send this to your assistant

Create a ClickRuntime automation: every morning, query my Supabase clients table for anyone with no visit in 14 days, write them to my At Risk sheet and email me the summary.

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 gym or studio running on its own booking app has all the data on who's drifting away, but nobody queries it. Members quietly stop coming, and the first sign is a cancelled membership.

A daily at-risk list in a sheet gives front-desk staff names to call while the member can still be won back, and the email keeps the owner aware of the trend.

What you get out of it

  • Win members back early

    A friendly call after two quiet weeks works far better than after a cancellation.

  • A list staff can work from

    The sheet has names, last visit and contact details, ready to call and mark off.

  • See the trend

    The daily count shows whether retention is improving.

  • No database skills needed

    Staff never touch Supabase; the list arrives in a sheet.

How it works

What happens, step by step

  1. Every morning, ClickRuntime asks Supabase for active clients whose last visit was more than 14 days ago.

  2. It writes their names, last visit and contact details to the At Risk tab of your sheet.

  3. If AI is available, it writes a one-line comment on the list.

  4. You get an email with the number of at-risk clients and the longest absences.

Before it runs live

  • Connect your Google Sheets account and pick the spreadsheets it may use
  • Connect Supabase

What you get

RunsOn a schedule
List at-risk clients from Supabase in a sheet every morningtoday, 9:00Succeeded
Email · At-risk clients12 clients haven't visited since 2026-10-05. Jordan Lee – last visit 2026-09-12 …

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
  • Change what the AI looks for, or how it writes the result
  • Add another app, for example also send it to Slack
  • Combine it with other Google Sheets 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.
scheduled_anomaly_and_risk_checks_on_supabase_data.pyexample
from datetime import date, timedelta
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_trigger, credentials, http, notify, ai

SHEET_ID = "your-spreadsheet-id"
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_trigger
def run(event):
    cutoff = date.today() - timedelta(days=14)
    clients = sb("GET", f"clients?status=eq.active&last_visit=lt.{cutoff}&select=name,email,phone,last_visit&order=last_visit.asc")
    rows = [["Name", "Last visit", "Email", "Phone"]] + [[c["name"], c["last_visit"], c["email"], c.get("phone", "")] for c in clients]
    sheets = build("sheets", "v4", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False).spreadsheets()
    sheets.values().clear(spreadsheetId=SHEET_ID, range="At Risk!A:D").execute()
    sheets.values().update(spreadsheetId=SHEET_ID, range="At Risk!A1", valueInputOption="RAW", body={"values": rows}).execute()
    text = f"{len(clients)} clients haven't visited since {cutoff}.\n" + "\n".join(f"{r[0]} – last visit {r[1]}" for r in rows[1:6])
    try:
        text += "\n\n" + ai.generate(f"One sentence on what stands out:\n{text}", max_output_tokens=60).text
    except ai.AIError:
        pass
    notify.email_me(f"{len(clients)} at-risk clients today", text)
    return {"at_risk": len(clients)}

FAQ

Common questions

What rule decides who is at risk?
No visit in 14 days by default. You can add others, like a drop in weekly visits or a failed payment.
Does the sheet keep yesterday's list?
The At Risk tab is replaced each morning with today's list. Ask for a history tab if you want to keep old lists.
Can AI explain the list?
Yes, if AI is available it adds a one-line comment on what stands out in the email.
What permissions does it need?
Supabase read; sheet edit. Nothing else in your accounts is used.
Does it need AI?
No, but you can ask for an AI step (for example a summary). It then uses ClickRuntime's built-in 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 “List at-risk clients from Supabase in a sheet every morning” from your assistant

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