Enrich company name

From TomGranot/hubspot-admin-skills · View interactive version

Enrich company name is an AI agent skill from the GitHub repository TomGranot/hubspot-admin-skills. Populate missing contact company name fields from associated company records using a HubSpot workflow with optional API backfill. Ensures contacts inherit their company name for segmentation, personalization, and ICP classification.

How to use this skill

Skill file

Enrich Contact Company Name from Associated Company

Populate missing contact-level company name fields by copying the value from the associated company record. Uses a HubSpot workflow for ongoing enrichment and optionally an API backfill script for immediate results.

Why This Matters

Contacts missing a company name cannot be matched to ICP-classified companies, break email personalization tokens, and are invisible to company-based segmentation. In a typical neglected CRM, 40-60% of contacts may be missing this field even though the vast majority have a company association.

Prerequisites

Scripts

Script paths are relative to this skill's directory. Run them from your project directory so .env, data/, and reports/ resolve there: prefix each path with wherever this skill is installed (skills/enrich-company-name/ in a clone of the repo).

| Stage | Script | Run with |

|-------|--------|----------|

| Before | CODE0 | uv run scripts/before.py |

| After | CODE0 | uv run scripts/after.py |

There is no execute script: the enrichment itself runs as a HubSpot workflow (see Execute below), which handles both the backlog and future contacts.

Plan

  1. Enable auto-association if not already on
  2. Audit how many contacts are missing company name (before state)
  3. Build a workflow that copies company name from the associated company record
  4. Optionally run an API backfill script for immediate results
  5. Verify enrichment results (after state)

Before

Run the before-state audit to capture the baseline: uv run scripts/before.py

The core query it runs:

resp = requests.post(f"{BASE}/crm/v3/objects/contacts/search", headers=HEADERS, json={
    "filterGroups": [{"filters": [
        {"propertyName": "company", "operator": "NOT_HAS_PROPERTY"},
    ]}],
    "limit": 1,
})
print(f"Contacts missing company name: {resp.json()['total']}")

Manual approach: Go to Contacts > filter by Company name > is unknown. Record the count.

Save the count. This is your baseline for measuring success.

Execute

Method 1: HubSpot Workflow (Recommended — Handles Backlog + Future)

  1. Go to Automation > Workflows > Create workflow
  2. Select Contact-based > Blank workflow
  3. Name: AUTO-ENRICH: Copy Company Name from Association

Enrollment trigger:

Re-enrollment:

Action 1: Delay 10 minutes

Action 2: If/then branch

Activate:

Method 2: API Backfill Script (Optional — Immediate Results)

Use this if you need the data populated immediately rather than waiting for workflow processing.

# Pattern: fetch contacts missing company name,
# look up their associated company, copy the name.
# 1. POST /crm/v3/objects/contacts/search  (company NOT_HAS_PROPERTY)
# 2. POST /crm/v4/associations/contacts/companies/batch/read  (get associations)
# 3. POST /crm/v3/objects/companies/batch/read  (fetch company names)
# 4. POST /crm/v3/objects/contacts/batch/update  (write the contact's company property)

Key API notes:

Why Do Both?

After

Wait 1-2 hours after activating the workflow (longer for very large databases), then verify: uv run scripts/after.py (re-runs the before-state query and compares against the baseline).

Verification checklist:

  1. The "missing company name" count should have dropped dramatically (typically from 40-60% to under 10%)
  2. Remaining contacts without company names should primarily be those with personal email addresses (gmail.com, yahoo.com, etc.)
  3. Spot-check 10-20 contacts to confirm the company name matches their associated company record
  4. Check workflow history for errors:
  1. Verify the workflow continues processing new contacts by checking for recent enrollments

Rollback

Key Technical Learnings

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.