Loading...
Loading...
Match external CSV/JSONL records to CRM contacts (by email) or companies (by domain) and write enriched data back in one pass using `hubspot objects upsert`.
npx skill4agent add hubspot/agent-cli-skills data-enrichmentbulk-operations/SKILL.mdhubspot objects upsert --type X --id-property <natural-key>searchcreate{"id":"jane@example.com","properties":{"firstname":"Jane","jobtitle":"VP"}}{"id":"123","ok":true,"data":{...,"new":true|false}}{"ok":false,"error":{...}}jq--dry-runhubspot properties list --type contactsbulk-operations/resources/json-patterns.md# CSV → JSONL (any tool); example using csvkit
csvjson external.csv | jq -c '.[]' > external.jsonl
# Preview
cat external.jsonl \
| jq -c '{id:(.email|ascii_downcase), properties:{firstname:.first, lastname:.last, jobtitle:.title, company:.company}}' \
| hubspot objects upsert --type contacts --id-property email --dry-run | head
# Execute (same pipeline, drop --dry-run, capture results)
cat external.jsonl \
| jq -c '{id:(.email|ascii_downcase), properties:{firstname:.first, lastname:.last, jobtitle:.title, company:.company}}' \
| hubspot objects upsert --type contacts --id-property email \
| tee /tmp/upsert.results.jsonl--type companies --id-property domain.domain|ascii_downcaseidjqjq -c 'select(.ok==true)' /tmp/upsert.results.jsonl > /tmp/upsert.ok.jsonl
jq -c 'select(.ok==false)' /tmp/upsert.results.jsonl > /tmp/upsert.failed.jsonl
jq -r '.error.status' /tmp/upsert.failed.jsonl | sort | uniq -c # status → count
jq -r '.data.new' /tmp/upsert.ok.jsonl | sort | uniq -c # created vs updatedbulk-operationsupsert--dry-runbulk-operations/SKILL.mdhubspot history --since 1h--filter400 too many filterGroups (count: N, max allowed: 5)# emails.txt: one lowercased email per line
xargs -n5 < emails.txt | while read -r e1 e2 e3 e4 e5; do
args=()
for e in "$e1" "$e2" "$e3" "$e4" "$e5"; do [ -n "$e" ] && args+=(--filter "email=$e"); done
hubspot objects search --type contacts "${args[@]}" --properties email,firstname,company
done > /tmp/matches.jsonl
jq -c '{id, properties:{lifecyclestage:"marketingqualifiedlead"}}' /tmp/matches.jsonl \
| hubspot objects update --type contacts --dry-runupsert