sales-execution

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Resources

资源

FileWhen to use
resources/activity-properties-reference.md
Property names and enum values for calls/notes/meetings/tasks. Keep open while writing
objects create
— enum values are not discoverable via
hubspot properties get
today.
Read
bulk-operations/SKILL.md
first — this skill assumes its batching, pipe, and dry-run patterns.
文件使用场景
resources/activity-properties-reference.md
通话/笔记/会议/任务的属性名称和枚举值。在编写
objects create
命令时请保持该文档打开——目前无法通过
hubspot properties get
获取枚举值。
请先阅读
bulk-operations/SKILL.md
——本技能默认你已了解其中的批量处理、管道和试运行模式。

The two non-obvious rules

两个容易忽略的规则

1. Activities are invisible until associated.
hubspot objects create --type calls ...
alone produces a record nobody can see in the CRM UI. Always follow with
hubspot associations create --from calls:<id> --to contacts:<id>
(and the deal, if relevant) before stopping.
2. Timestamps differ between write and read.
PathFieldFormat
objects create --property hs_timestamp=...
hs_timestamp
Unix ms (13 digits)
objects get --type calls <id>
returns
properties.hs_timestamp
Unix ms (string)
activities list --contact <id>
returns
timestamp
(flat, top-level)
ISO 8601 (e.g.
2024-01-15T10:00:00Z
)
Current Unix ms:
$(date +%s)000
(macOS) or
$(date +%s%3N)
(Linux).
activities list
rows are
{"id","type","timestamp","title","body","status","owner_id"}
— the cross-type timeline read shape, no raw property names.
1. 活动关联后才可见。仅执行
hubspot objects create --type calls ...
会生成一条在CRM界面中无人可见的记录。在操作结束前,务必接着执行
hubspot associations create --from calls:<id> --to contacts:<id>
(如果涉及交易,也要关联交易)。
2. 写入和读取的时间戳格式不同
路径字段格式
objects create --property hs_timestamp=...
hs_timestamp
Unix毫秒(13位数字)
objects get --type calls <id>
返回值
properties.hs_timestamp
Unix毫秒(字符串格式)
activities list --contact <id>
返回值
timestamp
(顶层扁平字段)
ISO 8601(例如:
2024-01-15T10:00:00Z
当前Unix毫秒时间:
$(date +%s)000
(macOS)或
$(date +%s%3N)
(Linux)。
activities list
返回的行格式为
{"id","type","timestamp","title","body","status","owner_id"}
——这是跨类型时间线读取的统一格式,不包含原始属性名称。

Create + associate, by type

按类型执行创建+关联操作

bash
undefined
bash
undefined

CALL

通话

call_id=$(hubspot objects create --type calls
--property hs_call_title="Discovery call"
--property hs_call_body="Confirmed $50K budget, Q2 timeline."
--property hs_call_direction=OUTBOUND
--property hs_call_status=COMPLETED
--property hs_call_duration=1800000
--property hs_timestamp=$(date +%s)000
--format json | jq -r '.id') hubspot associations create --from calls:$call_id --to contacts:149 hubspot associations create --from calls:$call_id --to deals:456
call_id=$(hubspot objects create --type calls
--property hs_call_title="Discovery call"
--property hs_call_body="Confirmed $50K budget, Q2 timeline."
--property hs_call_direction=OUTBOUND
--property hs_call_status=COMPLETED
--property hs_call_duration=1800000
--property hs_timestamp=$(date +%s)000
--format json | jq -r '.id') hubspot associations create --from calls:$call_id --to contacts:149 hubspot associations create --from calls:$call_id --to deals:456

NOTE

笔记

note_id=$(hubspot objects create --type notes
--property hs_note_body="Sent proposal. Follow-up Friday."
--property hs_timestamp=$(date +%s)000
--format json | jq -r '.id') hubspot associations create --from notes:$note_id --to deals:456
note_id=$(hubspot objects create --type notes
--property hs_note_body="Sent proposal. Follow-up Friday."
--property hs_timestamp=$(date +%s)000
--format json | jq -r '.id') hubspot associations create --from notes:$note_id --to deals:456

MEETING — start/end in Unix ms; reuse start as hs_timestamp

会议 — 开始/结束时间为Unix毫秒;将开始时间复用为hs_timestamp

start=$(date +%s)000; end=$(( ${start%000} + 3600 ))000 meeting_id=$(hubspot objects create --type meetings
--property hs_meeting_title="Demo — Acme" --property hs_meeting_outcome=COMPLETED
--property hs_meeting_start_time=$start --property hs_meeting_end_time=$end
--property hs_timestamp=$start --format json | jq -r '.id') hubspot associations create --from meetings:$meeting_id --to contacts:149
start=$(date +%s)000; end=$(( ${start%000} + 3600 ))000 meeting_id=$(hubspot objects create --type meetings
--property hs_meeting_title="Demo — Acme" --property hs_meeting_outcome=COMPLETED
--property hs_meeting_start_time=$start --property hs_meeting_end_time=$end
--property hs_timestamp=$start --format json | jq -r '.id') hubspot associations create --from meetings:$meeting_id --to contacts:149

TASK — hs_timestamp is the DUE DATE, not creation time

任务 — hs_timestamp为截止日期,而非创建时间

due=$(( $(date -v+7d +%s) * 1000 )) # macOS; Linux: date -d '7 days' +%s task_id=$(hubspot objects create --type tasks
--property hs_task_subject="Confirm proposal received"
--property hs_task_priority=HIGH
--property hs_task_status=NOT_STARTED
--property hs_task_type=CALL
--property hs_timestamp=$due
--format json | jq -r '.id') hubspot associations create --from tasks:$task_id --to deals:456
undefined
due=$(( $(date -v+7d +%s) * 1000 )) # macOS系统;Linux系统:date -d '7 days' +%s task_id=$(hubspot objects create --type tasks
--property hs_task_subject="Confirm proposal received"
--property hs_task_priority=HIGH
--property hs_task_status=NOT_STARTED
--property hs_task_type=CALL
--property hs_timestamp=$due
--format json | jq -r '.id') hubspot associations create --from tasks:$task_id --to deals:456
undefined

Open tasks for a contact — two CLI calls, no xargs

查询联系人的未完成任务——两次CLI调用,无需xargs

associations list
emits
{"id","type"}
per row;
objects get
reads from stdin in one batch call (see
bulk-operations/SKILL.md
"Read in batch").
bash
hubspot associations list --from contacts:149 --to tasks \
| hubspot objects get --type tasks \
    --properties hs_task_subject,hs_task_status,hs_task_priority,hs_timestamp \
| jq -c 'select(.properties.hs_task_status != "COMPLETED")'
associations list
每行输出
{"id","type"}
objects get
通过标准输入批量读取(详见
bulk-operations/SKILL.md
中的“批量读取”部分)。
bash
hubspot associations list --from contacts:149 --to tasks \
| hubspot objects get --type tasks \
    --properties hs_task_subject,hs_task_status,hs_task_priority,hs_timestamp \
| jq -c 'select(.properties.hs_task_status != "COMPLETED")'

Bulk: follow-up task per deal in a stage

批量操作:为某一阶段的每个交易创建跟进任务

The deal ID and the task ID must travel together. Persist the deal payload to a file, create tasks (output order matches input order — see bulk-operations), then zip the two ID lists line-by-line and stream association pairs in one call.
bash
due=$(( $(date -v+7d +%s) * 1000 ))
交易ID和任务ID必须一一对应。将交易负载保存到文件中,创建任务(输出顺序与输入顺序一致——详见批量操作文档),然后将两个ID列表逐行配对,并通过一次调用批量提交关联对。
bash
due=$(( $(date -v+7d +%s) * 1000 ))

1. Per-deal payload, deal_id retained alongside the create payload.

1. 每个交易的负载,保留deal_id与创建负载一起。

hubspot objects search --type deals --filter "dealstage=appointmentscheduled"
--properties dealname
| jq -c --argjson due "$due" '{deal_id: .id, payload: {properties: { hs_task_subject: ("Follow up: " + .properties.dealname), hs_task_priority: "HIGH", hs_task_status: "NOT_STARTED", hs_task_type: "CALL", hs_timestamp: ($due|tostring) }}}' > /tmp/deal_tasks.jsonl
hubspot objects search --type deals --filter "dealstage=appointmentscheduled"
--properties dealname
| jq -c --argjson due "$due" '{deal_id: .id, payload: {properties: { hs_task_subject: ("Follow up: " + .properties.dealname), hs_task_priority: "HIGH", hs_task_status: "NOT_STARTED", hs_task_type: "CALL", hs_timestamp: ($due|tostring) }}}' > /tmp/deal_tasks.jsonl

2. Create tasks; one CLI call for the whole batch.

2. 创建任务;一次CLI调用完成整个批量操作。

jq -c '.payload' /tmp/deal_tasks.jsonl
| hubspot objects create --type tasks > /tmp/created_tasks.jsonl
jq -c '.payload' /tmp/deal_tasks.jsonl
| hubspot objects create --type tasks > /tmp/created_tasks.jsonl

3. Zip and stream association pairs through stdin.

3. 配对并通过标准输入流式传输关联对。

paste
<(jq -r '.deal_id' /tmp/deal_tasks.jsonl)
<(jq -r '.id' /tmp/created_tasks.jsonl)
| jq -Rc 'split("\t") | {from:("tasks:"+.[1]), to:("deals:"+.[0])}'
| hubspot associations create

For >100 rows, apply the dry-run / digest / confirm pattern from `bulk-operations/SKILL.md`.
paste
<(jq -r '.deal_id' /tmp/deal_tasks.jsonl)
<(jq -r '.id' /tmp/created_tasks.jsonl)
| jq -Rc 'split("\t") | {from:("tasks:"+.[1]), to:("deals:"+.[0])}'
| hubspot associations create

如果行数超过100,请应用`bulk-operations/SKILL.md`中的试运行/摘要/确认模式。

Known constraints

已知限制

Activities must be associated immediately or they're invisible in the CRM UI.
properties get
doesn't return enum option values for activity types — use the reference. No sequences/cadences in the CLI.
活动必须立即关联,否则在CRM界面中不可见。
properties get
不会返回活动类型的枚举选项值——请使用参考文档。CLI不支持序列/节奏功能。