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.
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
Every morning, ClickRuntime asks Supabase for active clients whose last visit was more than 14 days ago.
It writes their names, last visit and contact details to the At Risk tab of your sheet.
If AI is available, it writes a one-line comment on the list.
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
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
- 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
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?
Does the sheet keep yesterday's list?
Can AI explain the list?
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
List low-stock items from Supabase in a purchasing sheet
Each night, items in your Supabase inventory that are below their reorder level are written to your purchasing sheet, and you get an email to review and approve them.
See how it worksKeep a Supabase knowledge base in sync with your FAQ sheet
Each night, new or edited rows in your FAQ sheet are turned into search-ready entries in your Supabase documents table, so your bots always answer from the latest version.
See how it worksFind people asking for tools like yours and list them in a sheet
Every hour, posts from people looking for a tool like yours are scored, stored in Supabase and added to a leads sheet for your team.
See how it worksKeep exploring
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.