The moment it happens
Save form leads to Supabase and reply to them by email
Each new lead from your form is checked, scored and saved to Supabase, gets a reply from your Gmail, and you hear about the high-value ones.
- Runs
- The moment it happens
- Apps
- Gmail, Supabase
- AI
- Optional
- Access
- Supabase write; Gmail send
Send this to your assistant
Create a ClickRuntime automation: when my form posts a lead to this link, check the email address, score the lead, insert it into my Supabase leads table, send the lead a reply from Gmail and email me if it's high value.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
Leads from a website form often sit in a database until someone gets to them, and by then the prospect has talked to two competitors. Replying within minutes makes a big difference, but small teams can't watch the form all day.
Saving the lead, replying straight away from your own address and flagging the valuable ones means every enquiry is acknowledged and the best are followed up first.
What you get out of it
Every lead gets a fast reply
A personal email from you within a minute keeps the prospect's attention.
Best leads first
High-value leads are flagged to you right away, so you call them first.
Clean data
Obviously fake or malformed emails are rejected before they reach your table.
One place for all leads
Everything is stored in your Supabase leads table for your own reports and tools.
How it works
What happens, step by step
Your form sends each new lead to your automation's link.
ClickRuntime checks the email address looks real and skips obvious junk.
It scores the lead from its details, with AI reading the message if available.
It saves the lead to your Supabase leads table and sends them a reply from your Gmail address.
If the score is high, you get an email straight away.
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 Supabase
- Paste your automation's link into the other app's webhook settings
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
- 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 Slack
- Combine it with other Gmail and Supabase steps into one automation
Under the hood
The code that runs this automation
import re
import base64
from email.message import EmailMessage
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_event, credentials, http, notify, ai
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)
def send(to, subject, text):
msg = EmailMessage()
msg["To"], msg["Subject"] = to, subject
msg.set_content(text)
build("gmail", "v1", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False).users().messages().send(userId="me", body={"raw": base64.urlsafe_b64encode(msg.as_bytes()).decode()}).execute()
@on_event
def handle(event):
lead = event.json or {}
if not re.fullmatch(r"[^@\s]+@[^@\s]+\.[a-z]{2,}", lead.get("email", ""), re.I):
return {"skipped": "invalid email"}
score = 40 + (20 if int(lead.get("employees") or 0) >= 50 else 0) + (20 if lead.get("budget") else 0)
try:
score += int(ai.generate(f"Rate 0-20 how ready to buy this enquiry sounds. Reply with a number only.\n{lead.get('message', '')[:1500]}", max_output_tokens=5).text)
except (ai.AIError, ValueError):
pass
sb("POST", "leads", json={**lead, "score": score, "event_id": event.event_id})
send(lead["email"], "Thanks for getting in touch", f"Hi {lead.get('name', 'there')},\n\nThanks for your message. "
"We'll reply properly within one working day.\n\nNorthwind team")
if score >= 70:
notify.email_me(f"High-value lead: {lead.get('company') or lead['email']} ({score})", f"{lead}")
return {"score": score}FAQ
Common questions
How is a lead scored?
What does the reply say?
What counts as high value?
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
Update stock in Supabase and email a reorder for approval
Each stock movement updates your Supabase inventory table, and when an item falls below its reorder level the manager gets an email with Approve and Reject links.
See how it worksEmail renewal reminders from your Supabase subscriptions
Every morning, customers whose subscription renews within 7 days get a reminder email, and you get a list of the at-risk ones.
See how it worksFind Reddit posts from likely customers and email the best ones
Every hour, Reddit posts about the problem your product solves are scored, saved in Supabase, and the promising ones are emailed to you.
See how it worksKeep exploring
Set up “Save form leads to Supabase and reply to them by email” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.