Skip to content

Every 10 minutes

Assign new HubSpot deals to the right rep

Deals without an owner are given to a rep based on the company's country and size, within minutes.

Runs
Every 10 minutes
Apps
HubSpot
AI
Not needed
Access
crm.objects.deals.read/write, crm.objects.companies.read, crm.objects.owners.read

Send this to your assistant

Create a ClickRuntime automation: every 10 minutes, find HubSpot deals with no owner. If the company is in the UK or Ireland, assign them to Sarah. If it has more than 500 employees, assign them to Tom. Otherwise assign them to Priya.

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 new deal with no owner is a deal nobody is working. In a HubSpot account where deals come from forms, imports and partner referrals, the unassigned ones pile up in a view that a sales manager checks twice a day. A $40,000 opportunity from a 500-person company sits for three hours while the manager is in a meeting, and by the time it is assigned the prospect has spoken to a competitor.

Every 10 minutes, deals without an owner are searched, the associated company is read for region and size, and your routing rules are applied: for example EMEA mid-market to one rep and North America enterprise to another. The deal's hubspot_owner_id is set to the right person.

It suits teams with territories or segments that want fast, fair routing without a manager acting as dispatcher.

What you get out of it

  • Leads get a quick first touch

    With ownership assigned in minutes, reps are notified by HubSpot and can reach out the same hour. Response time to new deals is one of the most reliable drivers of win rate.

  • No more manual dispatching

    Sales managers stop spending part of every day assigning deals. That time returns to coaching and pipeline reviews, which are higher-value work. Fewer interruptions for the manager also means fewer assignments delayed by a busy afternoon.

  • Territories are respected

    A deal from Germany goes to the German-speaking rep and an enterprise account goes to an enterprise specialist. Rules are applied the same way every time. Rules can reflect language, region or deal size, so the person best suited to the buyer gets the conversation.

  • Fairness is visible and consistent

    Reps trust a system that applies written rules. Disputes about who got the good lead fade, because the logic is explicit and the same for everybody. Written routing is easier to audit later, which makes quota and commission discussions simpler to resolve.

  • Nothing sits unowned overnight

    Deals created after hours or on weekends are assigned as soon as the next check runs, so Monday morning does not begin with a backlog. Waiting only for the next 10-minute check means even weekend deals get an owner and a HubSpot notification quickly.

How it works

What happens, step by step

  1. Every 10 minutes, the automation looks for HubSpot deals that don't have an owner yet.

  2. For each one, it reads the linked company's country and size.

  3. It applies your assignment rules, for example UK companies go to Sarah.

  4. The deal is given to that rep in HubSpot, usually within minutes of being created.

Before it runs live

  • Connect HubSpot

What you get

RunsEvery 10 minutes
Assign new HubSpot deals to the right reptoday, 9:00Succeeded
HubSpot · DealsNorthwind – Annual plan → assigned to Sarah (company in United Kingdom)

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
  • Add an AI step, for example to summarize, sort or draft a reply
  • Add another app, for example also send it to Slack
  • Combine it with other 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.
auto_assign_new_deals_to_the_right_rep.pyexample
from clickruntime import on_trigger, credentials, http, report_fetched

API = "https://api.hubapi.com/crm/v3/objects"
SARAH, TOM, PRIYA = "111111", "222222", "333333"  # HubSpot owner ids

@on_trigger
def run(event):
    headers = {"Authorization": f"Bearer {credentials.connection('hubspot', 'work')}"}
    deals = http.post(f"{API}/deals/search", headers=headers, json={"limit": 50, "filterGroups": [{"filters": [
        {"propertyName": "hubspot_owner_id", "operator": "NOT_HAS_PROPERTY"}]}]}).json()["results"]
    report_fetched(len(deals))
    if not deals:
        return {"assigned": 0}
    for deal in deals:
        links = http.get(f"{API}/deals/{deal['id']}/associations/companies", headers=headers).json()["results"]
        company = {}
        if links:
            company = http.get(f"{API}/companies/{links[0]['id']}", headers=headers,
                               params={"properties": "country,numberofemployees"}).json()["properties"]
        if (company.get("country") or "") in ("United Kingdom", "Ireland"):
            owner = SARAH
        elif int(company.get("numberofemployees") or 0) > 500:
            owner = TOM
        else:
            owner = PRIYA
        http.patch(f"{API}/deals/{deal['id']}", headers=headers,
                   json={"properties": {"hubspot_owner_id": owner}}).raise_for_status()
    return {"assigned": len(deals)}

FAQ

Common questions

What if a deal matches no rule?
It can go to a default owner or be left unassigned and reported to the manager. Choosing a catch-all is a good idea so nothing waits indefinitely, and it is a small part of the rules you set.
Can it do round-robin among reps?
Yes. Rotating among reps in a segment is a common variation, and the last assigned rep can be stored so each new deal goes to the next. Describe the group and approve the change. Rotation can also skip reps who are away.
Which company properties can the rules use?
Any property on the associated company in HubSpot, such as country, number of employees, industry or annual revenue. Rules work best on fields that are filled in consistently, so check completeness first. Missing fields are the most common problem.
What permissions does it need?
crm.objects.deals.read/write, crm.objects.companies.read, crm.objects.owners.read. Nothing else in your accounts is used.
Does it need AI?
No. It runs without AI, so it doesn't use your plan's AI allowance.
How many runs does it use?
One run each time it checks. Checks that find nothing new 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 “Assign new HubSpot deals to the right rep” from your assistant

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