The moment it happens
Qualify WhatsApp enquiries into HubSpot
People who message your WhatsApp number are asked the right questions, saved in HubSpot with a score, and hot leads are posted to #sales.
- Runs
- The moment it happens
- Apps
- HubSpot, WhatsApp Business
- AI
- Yes, uses the built-in AI allowance
- Access
- whatsapp_business_messaging; crm.objects.contacts.write
Send this to your assistant
Create a ClickRuntime automation: when someone messages our WhatsApp number, reply to find out their name, what they need and their budget, create or update them in HubSpot with a lead score, and post hot leads to #sales.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A kitchen fitter puts its WhatsApp number on every van and flyer. Messages arrive at all hours: "how much for a small kitchen?", "do you cover Leeds?", a photo of a ceiling. Whoever is free replies when they can, and nothing gets into HubSpot, so the next morning nobody knows which chats were serious.
This automation answers each message straight away, asks for whatever it still needs to know, and keeps a HubSpot contact up to date as the chat goes on. When a lead looks ready to buy, sales hears about it in Slack.
What you get out of it
Instant first reply
Every enquiry gets a helpful answer within seconds, even at 10 p.m., which keeps people from messaging the next company on their list.
HubSpot fills itself in
Name, need and budget are saved on the contact as they come up in the chat, so nobody has to copy a conversation into the CRM.
Sales sees only the good ones
A lead is posted to #sales once, when its score reaches 8 out of 10, rather than for every message.
Conversations carry on naturally
The automation remembers the last few messages from each person, so it doesn't ask the same question twice.
How it works
What happens, step by step
Someone sends a message to your WhatsApp Business number.
AI reads the conversation so far, notes their name, need and budget, and scores the lead from 1 to 10.
It replies on WhatsApp, asking for anything still missing.
The contact is created or updated in HubSpot, matched by phone number.
The first time a lead scores 8 or more, it's posted to #sales.
Before it runs live
- Connect HubSpot
- Connect WhatsApp Business
- 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 HubSpot and WhatsApp Business steps into one automation
Under the hood
The code that runs this automation
from clickruntime import on_event, credentials, http, state, ai, notify
API = "https://api.hubapi.com/crm/v3/objects/contacts"
WA = "https://graph.facebook.com/v21.0/123456789012345/messages" # your phone number ID
SCHEMA = {"type": "object", "properties": {k: {"type": "string"} for k in ["name", "need", "budget", "reply"]} | {
"score": {"type": "integer"}}, "required": ["name", "need", "budget", "score", "reply"]}
@on_event
def handle(event):
value = event.json["entry"][0]["changes"][0]["value"]
if "messages" not in value:
return {"skipped": "status update"}
sender = (msg := value["messages"][0])["from"]
chat = (state.get(f"chat:{sender}") or []) + [f"Customer: {msg.get('text', {}).get('body', '')}"]
out = ai.generate("\n".join(chat[-16:]), json_schema=SCHEMA, max_output_tokens=300, system=(
"You qualify sales enquiries on WhatsApp. Fill in name, need and budget if known (else empty), "
"score the lead 1-10, and write a short friendly reply asking for whatever is still missing.")).json
http.post(WA, headers={"Authorization": f"Bearer {credentials.secret('WHATSAPP_TOKEN')}"}, json={
"messaging_product": "whatsapp", "to": sender, "type": "text", "text": {"body": out["reply"]}}).raise_for_status()
state.set(f"chat:{sender}", (chat + [f"Us: {out['reply']}"])[-16:])
headers = {"Authorization": f"Bearer {credentials.connection('hubspot', 'work')}"}
props = {"phone": f"+{sender}", "firstname": out["name"],
"message": f"Need: {out['need']}\nBudget: {out['budget']}\nAI score: {out['score']}/10"}
found = http.post(f"{API}/search", headers=headers, json={"filterGroups": [{"filters": [
{"propertyName": "phone", "operator": "EQ", "value": f"+{sender}"}]}]}).json()["results"]
url, call = (f"{API}/{found[0]['id']}", http.patch) if found else (API, http.post)
call(url, headers=headers, json={"properties": props}).raise_for_status()
if out["score"] >= 8 and not state.get(f"alerted:{sender}"):
notify.slack(f"Hot WhatsApp lead ({out['score']}/10): {out['name'] or '+' + sender}\n"
f"Need: {out['need']} | Budget: {out['budget']}", channel="#sales")
state.set(f"alerted:{sender}", True)
return {"score": out["score"], "contact_existed": bool(found)}FAQ
Common questions
What questions does it ask?
Can a person take over the chat?
Where is the lead score kept?
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
Get call summaries in HubSpot and on WhatsApp
After every sales call, a short summary with next steps is saved on the HubSpot contact and sent to the rep on WhatsApp.
See how it worksLog invoice photos from WhatsApp on HubSpot deals
When a customer sends a photo of an invoice or receipt on WhatsApp, its number, amount and date are recorded on their HubSpot deal and they get a confirmation.
See how it worksWelcome hot leads on WhatsApp the moment they sign up
New leads from your form are scored and saved in HubSpot, and the hot ones get a WhatsApp welcome straight away with a heads-up in #sales.
See how it worksKeep exploring
Set up “Qualify WhatsApp enquiries into HubSpot” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.