Skip to content

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.

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

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

  1. A customer sends a photo to your WhatsApp Business number.

  2. The automation downloads the image and AI reads the invoice number, amount, currency and date.

  3. It finds the customer in HubSpot by phone number and adds a note to their deal.

  4. 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

RunsThe moment it happens
Log invoice photos from WhatsApp on HubSpot dealsjust nowSucceeded
HubSpot · Deal notePayment received on WhatsApp: invoice INV-20431, 1,840.00 GBP on 2026-10-14

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 HubSpot and WhatsApp Business 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.
log_whatsapp_invoice_photos_as_hubspot_payments.pyexample
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?
An image-reading AI model through your own OpenAI API key, saved as a secret in your ClickRuntime dashboard. The image is sent only to read the invoice details.
What if the photo is blurry or not an invoice?
The fields it can't read are left empty in the note, and you can ask for a version that replies asking the customer to resend a clearer photo.
Which deal does it update?
The first deal linked to the contact whose phone number matches the sender. If the contact has several open deals, you can ask for it to match on the invoice number instead.
What permissions does it need?
whatsapp_business_messaging; crm.objects.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 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 “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.