Skip to content

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.

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

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

  1. Your form sends each new lead to your automation's link.

  2. ClickRuntime checks the email address looks real and skips obvious junk.

  3. It scores the lead from its details, with AI reading the message if available.

  4. It saves the lead to your Supabase leads table and sends them a reply from your Gmail address.

  5. 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

RunsThe moment it happens
Save form leads to Supabase and reply to them by emailjust nowSucceeded
Email · High-value leadHigh-value lead: Acme Corp (82) – 120 employees, budget set, wants a demo this month

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 Slack
  • Combine it with other Gmail 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.
capture_and_route_leads_into_supabase_with_email_follow_up.pyexample
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?
With simple rules such as company size and budget fields, plus an AI read of the message if available. Without AI, the rules alone set the score.
What does the reply say?
A short thank-you with what happens next. Give your AI assistant your preferred wording.
What counts as high value?
A score of 70 or more by default, which you can change.
What permissions does it need?
Supabase write; Gmail send. 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 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 “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.