Quick company/contact enrichment for missing fields using domain-based derivation or web scraping
From opspal-hubspotnpx claudepluginhub revpalsfdc/opspal-commercial --plugin opspal-hubspot<object-type> <field-name> [options]The /hsenrich command performs bulk enrichment of HubSpot records when critical fields are missing but derivable from other data (e.g., company name from domain).
/hsenrich <object-type> <field-name> [options]
companies, contacts, deals)name, industry, company, etc.)--confidence <level>: Minimum confidence threshold (50-100, default: 70)--method <type>: Enrichment method (domain, web, api)--preview: Show sample without executing updates--limit <n>: Limit to first N records (default: all)/hsenrich companies name
Finds all companies without names but with domains, derives names, and updates high-confidence matches.
/hsenrich contacts industry --preview
Shows sample of what would be enriched without making changes.
/hsenrich companies name --confidence 80
Only update companies with ≥80% confidence scores.
domain method: Fast derivation from domain/website (default for company names)web method: Web scraping for accurate data (slower, use for <100 records)api method: Third-party API enrichment (requires API keys)| Object | Field | Default Method | Notes |
|---|---|---|---|
| companies | name | domain | Derives from domain/website URL |
| companies | industry | web | Scrapes website for industry info |
| companies | employee_count | api | Uses Clearbit/LinkedIn APIs |
| contacts | company | domain | Derives from email domain |
| contacts | jobtitle | web | Scrapes LinkedIn profile |
| deals | amount | calculation | Calculates from line items |
The command generates:
enriched-data-{timestamp}.json - All results with confidence scoreshigh-confidence-{timestamp}.json - High-confidence subsetbatch-update-payload-{timestamp}.json - HubSpot API payloadenrichment-report-{timestamp}.md - Comprehensive reportverification-results-{timestamp}.json - Quality verification.env with HUBSPOT_API_KEY)crm.objects.companies.write scope (or equivalent)When the user runs /hsenrich <object> <field>:
Parse Parameters:
const objectType = args[0]; // companies, contacts, deals
const fieldName = args[1]; // name, industry, etc.
const options = parseOptions(args.slice(2));
Validate Prerequisites:
.env file exists and has HUBSPOT_API_KEYDiscover Records:
# Use run-with-env.sh for environment loading
./scripts/run-with-env.sh node -e "
const { deriveCompanyName } = require('./scripts/lib/hubspot-domain-name-deriver');
// Query and enrich logic here
"
Select Enrichment Strategy:
companies.name: Use hubspot-domain-name-deriver library (domain-based)Generate Preview:
domain → derived_name (confidence%)Execute Update (if approved):
./scripts/run-with-env.sh node ./scripts/execute-batch-update.js ./enriched-payload.json
Verify & Report:
instances/{portal}/ENRICHMENT_HISTORY.mdHandle Errors:
User: /hsenrich companies name
Claude:
🔍 Discovering companies without names...
✅ Found 680 companies with domains but no names
📊 Enrichment Preview (Sample):
1. apartmentiq.io → "Apartment IQ" (85%)
2. bwalk.com → "Bwalk" (85%)
3. sparrow-partners.com → "Sparrow Partners" (75%)
4. doranmanagement.com → "Doranmanagement" (75%)
...
Statistics:
- Total: 680 companies
- High confidence (≥75%): 646 (95.0%)
- Medium confidence (50-74%): 34 (5.0%)
- Ready to update: 673 companies
Proceed with updating 673 companies? (yes/no)
User: yes
Claude:
🔄 Executing batch update...
📦 Batch 1/7: ✅ 100 companies updated
📦 Batch 2/7: ✅ 100 companies updated
...
📦 Batch 7/7: ✅ 73 companies updated
✅ Update complete! 673 companies updated successfully.
🔍 Verifying updates (sample: 20 companies)...
✅ Verification: 20/20 matched (100%)
📄 Files generated:
- enriched-data-1759847833785.json
- batch-update-payload-1759847833785.json
- enrichment-report-1759847833785.md
📊 Summary: 99.0% of companies now have names (673/680)
--preview first for large datasetsENRICHMENT_HISTORY.md./scripts/run-with-env.sh--confidence set too high, filtered out most matches/hsmerge - Merge duplicate companies/hsdedup - Find and resolve duplicates/hssfdc-analyze - Analyze Salesforce sync configuration/reflect - Generate session improvement playbookThe enrichment uses:
scripts/lib/hubspot-domain-name-deriver.jsscripts/run-with-env.sh (environment loading)scripts/execute-batch-update.jsscripts/verify-updates.jsFrom production use (2025-10-07):
Version: 1.0.0 Last Updated: 2025-10-07 Maintained By: RevPal HubSpot Agent System