Enrich Company Name
by @tomgranot
Populate missing contact company name fields from associated company records using a HubSpot workflow with optional API backfill. Ensures contacts inherit th...
clawhub install enrich-company-nameπ About This Skill
name: enrich-company-name description: "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." license: MIT metadata: author: tomgranot version: "1.0" category: data-enrichment
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
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 State
Run a before-state audit to capture the baseline.
Script approach (recommended):
import os
from hubspot import HubSpot
from dotenv import load_dotenvload_dotenv()
api_client = HubSpot(access_token=os.getenv("HUBSPOT_API_TOKEN"))
Count contacts missing company name
result = api_client.crm.contacts.search_api.do_search(
public_object_search_request={
"filterGroups": [{
"filters": [{
"propertyName": "company",
"operator": "NOT_HAS_PROPERTY"
}]
}],
"limit": 0
}
)
print(f"Contacts missing company name: {result.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
from hubspot import HubSpotapi_client = HubSpot(access_token=os.getenv("HUBSPOT_API_TOKEN"))
1. Search for contacts missing company name
2. For each, get associations to companies
3. Fetch the primary company's name
4. Batch update the contact's company property
Key API notes:
company NOT_HAS_PROPERTYcreatedate ranges if needed.crm.contacts.batch_api.updateWhy Do Both?
After State
Wait 1-2 hours after activating the workflow (longer for very large databases), then verify.
Script approach:
# Same search as before-state script
result = api_client.crm.contacts.search_api.do_search(
public_object_search_request={
"filterGroups": [{
"filters": [{
"propertyName": "company",
"operator": "NOT_HAS_PROPERTY"
}]
}],
"limit": 0
}
)
print(f"Contacts still missing company name: {result.total}")
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: - Property type mismatch (copying to wrong field type) - Multiple associated companies (HubSpot uses the primary company) 5. Verify the workflow continues processing new contacts by checking for recent enrollments