Skip to content

The moment it happens

Score new leads and assign them to a rep from your Airtable team table

Each inbound lead is scored by AI and created in HubSpot with the right owner, chosen from your Airtable sales team table.

Runs
The moment it happens
Apps
Airtable, HubSpot
AI
Yes, uses the built-in AI allowance
Access
crm.objects.contacts.write; Airtable read/write

Send this to your assistant

Create a ClickRuntime automation: give me a link my lead form can send to. Score each lead with AI, pick the owner from my Airtable 'Sales team' table based on region and deal size, create the contact in HubSpot with that owner, and log it in Airtable.

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 sales team splits leads by region and deal size, with a sales manager keeping the roster in Airtable: who covers EMEA, who takes enterprise, who's on holiday this week. Every new lead waits until the manager reads it, works out who should have it and assigns it in HubSpot, which can take half a day.

This scores each lead as it arrives, reads the current roster from Airtable to find the right rep, and creates the HubSpot contact already assigned to them. The manager changes the routing by editing the Airtable table, with no change to the automation.

What you get out of it

  • Leads reach the right rep in seconds

    The owner is set in HubSpot as the lead is created, so the rep sees it straight away.

  • Routing rules live in a table you already edit

    Change who covers a region or mark someone away in Airtable, and the next lead follows the new rules.

  • Each lead arrives with a score

    AI rates fit and intent from the message, so reps know which to call first.

  • An audit trail of every assignment

    Each lead is logged in Airtable with the score and assigned rep, so you can check fairness and response times.

How it works

What happens, step by step

  1. When someone submits your lead form, ClickRuntime receives their details straight away.

  2. AI reads the lead and gives it a score and an estimated deal size.

  3. It reads your Airtable sales team table and picks the active rep who covers that region and size with the fewest recent leads.

  4. The contact is created in HubSpot with that rep as owner, and the lead is logged in Airtable.

Before it runs live

  • Connect Airtable
  • Connect HubSpot
  • Paste your automation's link into the other app's webhook settings

What you get

RunsThe moment it happens
Score new leads and assign them to a rep from your Airtable team tablejust nowSucceeded
Airtable · Lead logmaya@contoso-health.example, score 8, Enterprise, assigned to Ben Carter (EMEA).

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 Airtable and HubSpot 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.
ai_qualify_leads_and_route_using_an_airtable_team_table.pyexample
from clickruntime import on_event, credentials, http, ai, state

BASE_ID = "appXXXXXXXXXXXXXX"
SCHEMA = {"type": "object", "properties": {"score": {"type": "integer"}, "size": {"type": "string", "enum": ["SMB", "Mid-market", "Enterprise"]}}, "required": ["score", "size"]}

def at(method, path="", **kw):
    r = http.request(method, f"https://api.airtable.com/v0/{BASE_ID}/{path}", headers={"Authorization": f"Bearer {credentials.connection('airtable', 'work')}"}, **kw)
    return r.raise_for_status() or r.json()

@on_event
def handle(event):
    lead = event.json or {}
    if not lead.get("email"):
        return {"skipped": "no email"}
    res = ai.generate(f"Score this lead 1-10 and estimate its size.\n{str(lead)[:1500]}", json_schema=SCHEMA, max_output_tokens=60).json
    region = lead.get("region", "EMEA")
    reps = at("GET", "Sales team", params={"filterByFormula": f"AND({{Active}}, {{Region}} = '{region}', FIND('{res['size']}', ARRAYJOIN({{Sizes}})))"})["records"]
    counts = state.get("counts") or {}
    rep = min(reps, key=lambda r: counts.get(r["id"], 0)) if reps else None
    props = {"email": lead["email"], "firstname": lead.get("name", ""), "company": lead.get("company", ""), "lead_score": str(res["score"])}
    if rep:
        props["hubspot_owner_id"] = rep["fields"]["HubSpot owner ID"]
        counts[rep["id"]] = counts.get(rep["id"], 0) + 1
        state.set("counts", counts)
    r = http.post("https://api.hubapi.com/crm/v3/objects/contacts", json={"properties": props},
                  headers={"Authorization": f"Bearer {credentials.connection('hubspot', 'work')}"})
    r.raise_for_status()
    at("POST", "Lead log", json={"records": [{"fields": {"Email": lead["email"], "Score": res["score"], "Size": res["size"],
       "Rep": rep["fields"]["Name"] if rep else "Unassigned", "HubSpot ID": r.json()["id"]}}]})
    return {"score": res["score"], "rep": rep["fields"]["Name"] if rep else None}

FAQ

Common questions

What does the Airtable team table need?
One row per rep with their name, HubSpot owner ID, region, the deal sizes they cover and an Active checkbox. Reps who aren't active are skipped.
How is the rep chosen when several match?
Among the reps who cover that region and size, the one with the fewest leads assigned recently gets it, so work is spread evenly.
What does the AI look at?
The lead's message, company and any size or budget fields on the form. It returns a score and an estimated deal size used for routing.
What permissions does it need?
crm.objects.contacts.write; Airtable read/write. Nothing else in your accounts is used.
Does it need AI?
Yes. It uses ClickRuntime's built-in AI, so you don't need an OpenAI or Anthropic key. Every plan includes a monthly 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 “Score new leads and assign them to a rep from your Airtable team table” from your assistant

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