mcpField
C
crm-lookup

crm-lookup

github.com/hubspot营销与增长281.9k 次安装今天更新
代码仓库

关于 crm-lookup

面向 HubSpot CRM 查询的只读技能,指导使用 hubspot CLI 按 ID、精确值、部分名称及关联记录查找对象,并按实时属性架构选择字段。

主要功能

  1. 01按 ID 批量获取记录
  2. 02按邮箱或域名精确查询
  3. 03按部分名称筛选对象
  4. 04查询关联记录及对象
  5. 05依据实时架构选择属性

适用场景

  1. 01查找联系人、公司、交易或工单
  2. 02查看公司关联的联系人
  3. 03按交易名称定位记录

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/hubspot/agent-cli-skills --skill crm-lookup

安装后在 Claude Code 中输入/crm-lookup确认已加载。

详细介绍

信息源

hubspot <command> --help 是权威依据。请先阅读 bulk-operations/SKILL.md——该文档说明 JSONL 管道、分页、通过标准输入批量获取记录,以及查找后进行任何写入操作的安全流程。本技能为只读。

根据实时架构选择属性

架构会发生变化。运行 hubspot properties list --type <type> 获取实时属性集合。简要查询可先使用以下 --properties:

对象--properties
contactsemail,firstname,lastname,company,phone,lifecyclestage,hubspot_owner_id
companiesname,domain,industry,annualrevenue,numberofemployees,hubspot_owner_id
dealsdealname,amount,dealstage,closedate,hubspot_owner_id,hs_is_closed_won
ticketssubject,hs_pipeline_stage,hs_ticket_priority,hubspot_owner_id

联系人的广告/营销活动归因数据位于 hs_analytics_* 属性中(例如 hs_analytics_source、hs_analytics_source_data_1/_2、hs_analytics_first_touch_converting_campaign、hs_analytics_last_touch_converting_campaign)。完整列表:hubspot properties list --type contacts | grep hs_analytics_。

1. 按 ID 查找

单次批量调用最多约 100 个 ID:

hubspot objects get --type contacts 12345 67890 23456 --properties email,firstname,lastname,company,phone,lifecyclestage

2. 按邮箱/域名查找(精确匹配)

email/domain 使用精确匹配——请统一转换为小写。多个 --filter 标志之间为 OR 关系。

hubspot objects search --type contacts --filter "[email protected]" \
  --properties email,firstname,lastname,company,lifecyclestage,hubspot_owner_id

hubspot objects search --type companies --filter "domain=acme.com" \
  --properties name,domain,industry,annualrevenue,hubspot_owner_id

# OR — multiple emails in one call
hubspot objects search --type contacts \
  --filter "[email protected]" --filter "[email protected]" --properties email,firstname

3. 按部分名称查找(词元 + 客户端筛选)

~ 表示 CONTAINS_TOKEN——匹配以空格分隔的完整单词。dealname~acme 会找到 “Acme Renewal”,但不会找到 “AcmeCorp”。如需子串匹配,请将结果通过管道传给 jq。系统不会跨所有字段进行全文搜索——请指定属性。

hubspot objects search --type deals --filter "dealname~acme" --properties dealname,amount,dealstage \
| jq -c 'select(.properties.dealname | ascii_downcase | contains("acme corp"))'

4. 查找所有关联记录(调用两次 CLI,而不是使用 xargs)

模式:associations list → jq -c '{id}' → objects get 批量获取。切勿使用 xargs -I{} hubspot objects get …——这会为每条记录启动一个进程。在 --from 中使用复数(contacts:12345),格式以 --help 中的说明为准。

# All contacts at a company
hubspot associations list --from companies:67890 --to contacts \
| jq -c '{id}' \
| hubspot objects get --type contacts --properties email,firstname,lastname,jobtitle

# Open deals for a contact (filter client-side; "open" varies by pipeline)
hubspot associations list --from contacts:12345 --to deals | jq -c '{id}' \
| hubspot objects get --type deals --properties dealname,amount,dealstage,hs_is_closed \
| jq -c 'select(.properties.hs_is_closed != "true")'

5. 获取记录及其关联项

contact_id=12345
hubspot objects get --type contacts $contact_id --properties email,firstname,lastname,company,lifecyclestage

# Associated company (usually one)
hubspot associations list --from contacts:$contact_id --to companies | jq -c '{id}' | head -1 \
| hubspot objects get --type companies --properties name,domain,industry,annualrevenue

# Associated deals
hubspot associations list --from contacts:$contact_id --to deals | jq -c '{id}' \
| hubspot objects get --type deals --properties dealname,amount,dealstage,closedate

限制

  • 每页搜索结果不超过 100 条。需要更多结果时,请使用 bulk-operations/SKILL.md 中的分页循环。
  • ~ 基于词元匹配;子串筛选需在搜索后通过 jq 进行。
  • 如果查找结果将用于写入操作(更新、删除、合并),请遵循 bulk-operations/SKILL.md 中的 --dry-run → digest → --confirm 流程。

评论

支持 Markdown