Greenbarfor Sage 100
Guides / Connect Sage 100 to other apps

Sage 100 HubSpot integration: balances and orders on company records

Show Sage 100 open balance, credit hold and last order on HubSpot company records, with a field map and a working sync script.

For: DevelopersUpdated 2026-12-043 min read

Sales teams ask for one thing from a Sage 100 HubSpot integration: before I call this customer, tell me if they owe us money. That means a few Sage fields on each HubSpot company record, kept fresh. This guide shows the field map, how to match records, and a short script that does the sync.

What to sync

Most teams need a handful of fields, read-only, from Sage into HubSpot. Resist syncing everything; fields nobody looks at still cost API calls.

HubSpot company propertySource in Sage 100API field
sage_customer_keyARDivisionNo + CustomerNodivision + customer_no
sage_open_balanceAR_Customer.CurrentBalancebalance
sage_credit_limitAR_Customer.CreditLimitcredit_limit
sage_credit_holdAR_Customer.CreditHoldcredit_hold
sage_overdue_61_plusAR aging, 61+ day bucketsoverdue_amount with overdue_days_gt=60
sage_last_activityAR_Customer.DateLastActivitylast_activity

Matching records

The reliable key is the Sage customer key: division plus customer number, for example 01-NORTHFLD. Store it in a custom HubSpot property once (by hand or from a CSV import), then match on it. Matching by company name breaks the first time someone types "Inc." differently. Matching by domain fails for customers who use a generic email provider.

Create the properties once:

bash
curl -X POST https://api.hubapi.com/crm/v3/properties/companies \
  -H "Authorization: Bearer $HUBSPOT_TOKEN" -H "Content-Type: application/json" \
  -d '{"name":"sage_open_balance","label":"Sage open balance","type":"number","fieldType":"number","groupName":"companyinformation"}'

The sync script

This Python script reads customers with a balance from the Greenbar sandbox, finds each HubSpot company by sage_customer_key, and updates the balance fields. Run it every hour with cron or a scheduled task.

python
import os, requests

SAGE = "https://api.greenbar.octor.top/v1/companies/ABC"
SAGE_H = {"Authorization": "Bearer sk_test_demo"}
HS = "https://api.hubapi.com/crm/v3/objects/companies"
HS_H = {"Authorization": f"Bearer {os.environ['HUBSPOT_TOKEN']}", "Content-Type": "application/json"}

def sage_customers():
    url, params = f"{SAGE}/customers", {"limit": 100}
    while True:
        page = requests.get(url, headers=SAGE_H, params=params, timeout=30).json()
        yield from page["data"]
        if not page["has_more"]:
            break
        params["cursor"] = page["next_cursor"]

def find_company(key):
    body = {"filterGroups": [{"filters": [{"propertyName": "sage_customer_key", "operator": "EQ", "value": key}]}], "limit": 1}
    res = requests.post(f"{HS}/search", headers=HS_H, json=body, timeout=30).json()
    return res["results"][0]["id"] if res.get("results") else None

for c in sage_customers():
    key = f"{c['division']}-{c['customer_no']}"
    company_id = find_company(key)
    if not company_id:
        continue
    props = {"sage_open_balance": c["balance"], "sage_credit_limit": c["credit_limit"],
             "sage_credit_hold": str(c["credit_hold"]).lower(), "sage_last_activity": c["last_activity"]}
    requests.patch(f"{HS}/{company_id}", headers=HS_H, json={"properties": props}, timeout=30).raise_for_status()

Making it production-safe

Going the other way

Creating a Sage customer or sales order when a HubSpot deal closes is a write, and writes in Sage 100 go through BOI so pricing, tax and credit rules apply. That is the harder half of a HubSpot integration and the part most teams buy rather than build.

Try it against the sandboxOpen the playground →
curl "https://api.greenbar.octor.top/v1/companies/ABC/customers?balance_gt=0&limit=5" \
  -H "Authorization: Bearer sk_test_demo"

A REST API for Sage 100, self-serve

One HTTPS endpoint and a typed SDK instead of BOI scripts and ODBC DSNs on every customer's server. Read access is free during the beta.

Join the waitlist