The moment it happens
Log 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.
- Runs
- The moment it happens
- Apps
- HubSpot, WhatsApp Business
- AI
- Yes, uses the built-in AI allowance
- Access
- whatsapp_business_messaging; crm.objects.deals.write
Send this to your assistant
Create a ClickRuntime automation: when a customer sends an image on WhatsApp, read the invoice number, amount and date from it, add them as a note on their HubSpot deal, and reply to confirm we've logged it.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
Many small B2B customers pay by bank transfer and then send a photo of the remittance slip or stamped invoice on WhatsApp to say it's done. The photo sits in someone's phone, the deal in HubSpot still shows as unpaid, and finance chases a customer who has already paid.
This automation reads each image as it arrives, pulls out the invoice number, amount and date, and notes them on the customer's deal in HubSpot. The customer gets a reply confirming it's logged.
What you get out of it
No more chasing paid invoices
The payment is on the deal the moment the customer sends proof, so finance and sales see the same picture.
Nothing to retype
Invoice number, amount and currency are read from the photo, which saves typing and avoids mistakes with long reference numbers.
Customers get a receipt
A short WhatsApp reply confirms the details, so they know it arrived and don't send it again by email.
A clear record per deal
Each payment becomes a dated note on the deal, easy to find when reconciling at month end.
How it works
What happens, step by step
A customer sends a photo to your WhatsApp Business number.
The automation downloads the image and AI reads the invoice number, amount, currency and date.
It finds the customer in HubSpot by phone number and adds a note to their deal.
The customer gets a WhatsApp reply confirming what was logged.
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
import base64, json
from datetime import datetime, timezone
from clickruntime import on_event, credentials, http
API = "https://api.hubapi.com/crm/v3/objects"
WA = "https://graph.facebook.com/v21.0"
@on_event
def handle(event):
msg = (event.json["entry"][0]["changes"][0]["value"].get("messages") or [{}])[0]
if msg.get("type") != "image":
return {"skipped": "not an image"}
wa = {"Authorization": f"Bearer {credentials.secret('WHATSAPP_TOKEN')}"}
media = http.get(f"{WA}/{msg['image']['id']}", headers=wa).json()
img = base64.b64encode(http.get(media["url"], headers=wa).content).decode()
r = http.post("https://api.openai.com/v1/chat/completions", timeout=60, headers={"Authorization": f"Bearer {credentials.secret('OPENAI_API_KEY')}"}, json={
"model": "gpt-4o-mini", "response_format": {"type": "json_object"}, "messages": [{"role": "user", "content": [
{"type": "text", "text": "Read this invoice or receipt. Reply as JSON with invoice_number, amount, currency, date (YYYY-MM-DD)."},
{"type": "image_url", "image_url": {"url": f"data:{media['mime_type']};base64,{img}"}}]}]})
inv = json.loads(r.json()["choices"][0]["message"]["content"])
hs = {"Authorization": f"Bearer {credentials.connection('hubspot', 'work')}"}
found = http.post(f"{API}/contacts/search", headers=hs, json={"filterGroups": [{"filters": [
{"propertyName": "phone", "operator": "EQ", "value": f"+{msg['from']}"}]}]}).json()["results"]
deals = http.get(f"{API}/contacts/{found[0]['id']}/associations/deals", headers=hs).json()["results"] if found else []
details = f"invoice {inv.get('invoice_number')}, {inv.get('amount')} {inv.get('currency')} on {inv.get('date')}"
if deals:
http.post(f"{API}/notes", headers=hs, json={"properties": {"hs_note_body": f"Payment received on WhatsApp: {details}",
"hs_timestamp": datetime.now(timezone.utc).isoformat()}, "associations": [{"to": {"id": deals[0]["id"]}, "types": [
{"associationCategory": "HUBSPOT_DEFINED", "associationTypeId": 214}]}]}).raise_for_status()
reply = f"Thanks, we've logged {details}." if deals else "Thanks, we've received your document and the team will check it."
http.post(f"{WA}/123456789012345/messages", headers=wa, json={"messaging_product": "whatsapp", "to": msg["from"], "type": "text", "text": {"body": reply}})
return {"logged": bool(deals), "invoice": inv.get("invoice_number")}FAQ
Common questions
What does it use to read the image?
What if the photo is blurry or not an invoice?
Which deal does it update?
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 worksQualify 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.
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 “Log invoice photos from WhatsApp on HubSpot deals” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.