Skip to content

Every 10 minutes

Turn lead notification emails into HubSpot contacts and deals

Lead emails from your shop, property portal or directory listing become HubSpot contacts with a deal attached, without any copying and pasting.

Runs
Every 10 minutes
Apps
Gmail, HubSpot
AI
Yes, uses the built-in AI allowance
Access
Gmail gmail.readonly; HubSpot contacts+deals write

Send this to your assistant

Create a ClickRuntime automation: when a lead notification email arrives in my Gmail, pull out the person's details and create a HubSpot contact and a deal for them.

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

Plenty of lead sources don't connect to a CRM. A property portal, a marketplace listing or a booking site sends you an email with the enquirer's name, phone number and what they want, and someone has to copy it into HubSpot. On a busy week some never make it in.

This reads those notification emails as they arrive, uses AI to pull out the contact details and what they asked for, and creates the contact and a deal in HubSpot linked together, so every enquiry is in your pipeline within minutes.

What you get out of it

  • No more copying from emails

    Name, email, phone and the enquiry are taken from the email and entered for you.

  • Every enquiry becomes a deal

    A deal is created and linked to the contact, so it shows in your pipeline straight away.

  • Handles messy formats

    AI reads the email the way a person would, so changes in the portal's layout don't break it.

  • Existing contacts are updated, not duplicated

    Contacts are matched on email, so repeat enquirers get a new deal on their existing record.

How it works

What happens, step by step

  1. Every 10 minutes, ClickRuntime checks Gmail for new lead notification emails from the senders you choose.

  2. It remembers which emails it has handled, so each lead is created once.

  3. AI reads each email and pulls out the person's name, email, phone and what they're interested in.

  4. A contact is created or updated in HubSpot, and a new deal is added and linked to it.

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 HubSpot

What you get

RunsEvery 10 minutes
Turn lead notification emails into HubSpot contacts and dealstoday, 9:00Succeeded
HubSpot · DealsNew deal: Chris Moore: 3-bed house viewing, Elm Street Contact chris.moore@example.com, 07700 900123, from your property portal.

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 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.
lead_emails_from_gmail_into_hubspot_contacts_and_deals.pyexample
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_trigger, credentials, http, state, ai, report_fetched

QUERY = 'from:leads@portal.example newer_than:2d'
SCHEMA = {"type": "object", "properties": {k: {"type": "string"} for k in ["name", "email", "phone", "interest"]}, "required": ["email"]}

def hs(method, path, **kw):
    r = http.request(method, f"https://api.hubapi.com{path}", headers={"Authorization": f"Bearer {credentials.connection('hubspot', 'work')}"}, **kw)
    return r.raise_for_status() or (r.json() if r.content else {})

@on_trigger
def run(event):
    g = build("gmail", "v1", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False)
    seen = set(state.get("seen") or [])
    ids = [m["id"] for m in g.users().messages().list(userId="me", q=QUERY).execute().get("messages", []) if m["id"] not in seen]
    report_fetched(len(ids))
    if not ids:
        return {"created": 0}
    for mid in ids:
        snippet = g.users().messages().get(userId="me", id=mid, format="full").execute()["snippet"]
        lead = ai.generate("Extract the lead's details from this email:\n" + snippet[:2000], json_schema=SCHEMA, max_output_tokens=150).json
        if lead.get("email"):
            c = hs("POST", "/crm/v3/objects/contacts/batch/upsert", json={"inputs": [{"idProperty": "email", "id": lead["email"],
                   "properties": {"email": lead["email"], "firstname": lead.get("name", ""), "phone": lead.get("phone", "")}}]})["results"][0]
            hs("POST", "/crm/v3/objects/deals", json={"properties": {"dealname": f"{lead.get('name')}: {lead.get('interest', '')}"[:100], "dealstage": "appointmentscheduled", "pipeline": "default"},
               "associations": [{"to": {"id": c["id"]}, "types": [{"associationCategory": "HUBSPOT_DEFINED", "associationTypeId": 3}]}]})
    state.set("seen", (list(seen) + ids)[-500:])
    return {"created": len(ids)}

FAQ

Common questions

Which emails does it read?
Only the ones you point it at, using a Gmail search such as a sender address or a label. Other mail is ignored.
What happens if an email has no email address in it?
If the AI can't find an email address, the message is skipped and listed in the run log so you can add it by hand.
Which pipeline and stage do new deals go into?
You choose the pipeline and starting stage, for example New enquiry. The deal is named after the person and what they asked about.
What permissions does it need?
Gmail gmail.readonly; HubSpot contacts+deals 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 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 “Turn lead notification emails into HubSpot contacts and deals” from your assistant

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