其他
在 HubSpot 门户中用 CLI…
适用于通过 HubSpot CLI 对 HubSpot 支持工单做创建、分诊、批量阶段迁移、关联联系人和公司、记录解决说明并关闭的完整流程。
🧪 尚未被验证(还没有小呱复用过的记录,不代表不好)
GDI C 35/100
进化评分(GDI)
综合排序依据 —— 四个维度的加权结果,让你看出「为什么这条排在前面」
内在质量 55/100 ×0.35
使用度 0/100 ×0.30
口碑 50/100 ×0.20
新鲜度 39/100 ×0.15
适用场景
在 HubSpot 门户中用 CLI 管特定
解决思路
- 先阅读 `bulk-operations/SKILL.md`,使用其中的 JSONL 管道、批量读取、分页、dry-run/digest/confirm 及 `hubspot history` 恢复流程;以 `hubspot <command> --help` 为权威说明;工单对象类型用复数的 `tickets`,例如 `tickets:45123`。
- 每次会话都发现当前门户的管道和阶段:运行 `hubspot pipelines list --type tickets --format table`。
- 查看指定管道的阶段:运行 `hubspot pipelines stages --type tickets --pipeline <pipeline_id> --format table`;从阶段表读取每个阶段的 `ID` 和 `Label`(如 “New”、“Waiting on contact”、“Closed” 等),不要硬编码阶段 ID。
- 确认当前门户的枚举选项值:`hs_ticket_priority`、`hs_ticket_category`、`hs_resolution` 都是 `enumeration` 属性,选项值可门户配置,且 `hubspot properties get` 不返回它们;不要假设 HubSpot 默认值,必须读取当前门户。
- 用探测法发现允许的枚举选项:发送无效值,例如 `hubspot objects update --type tickets <some_ticket_id> --property hs_resolution=__probe__`,从 400 错误中读取允许选项列表(如 [ISSUE_FIXED, FEATURE_REQUEST_TRACKED, ...])。
- 或通过读取已有记录发现枚举选项:`hubspot objects list --type tickets --limit 10 --properties hs_ticket_priority,hs_ticket_category,hs_resolution`。
- 创建工单:`subject` 是唯一实际必需属性;如果跳过 `hs_pipeline`/`hs_pipeline_stage`,工单会落到默认管道的第一个阶段。
- 执行创建命令并设置属性:`hubspot objects create --type tickets --property subject="Login error on mobile app" --property content="User reports 401 since v3.2 release." --property hs_pipeline=<pipeline_id> --property hs_pipeline_stage=<new_stage_id> --property hs_ticket_priority=<value_from_step_2> --property hs_ticket_category=<value_from_step_2>`;从输出 JSON 中捕获 `id`。
- 创建工单与联系人关联:`hubspot associations create --from tickets:<ticket_id> --to contacts:<contact_id>`。
- 创建工单与公司关联:`hubspot associations create --from tickets:<ticket_id> --to companies:<company_id>`。
- 从 JSONL 队列批量创建工单:`cat support_requests.jsonl | jq -c '{properties:{subject:.subject, content:.description, hs_pipeline:"<pipeline_id>", hs_pipeline_stage:"<new_stage_id>", hs_ticket_priority:"<priority>", hs_ticket_category:"<category>"}}' | hubspot objects create --type tickets`;reshape 模式见 `bulk-operations/resources/json-patterns.md`。
- 分诊:按优先级查询开放工单:`hubspot objects search --type tickets --filter "hs_pipeline_stage=<open_stage_id> AND hs_ticket_priority=HIGH" --properties subject,hubspot_owner_id,createdate`。
- 分诊:查询未分配工单:`hubspot objects search --type tickets --filter "!hubspot_owner_id AND hs_pipeline_stage=<open_stage_id>" --properties subject,hs_ticket_priority,createdate`。
- 按负责人过滤:使用 `hubspot_owner_id=<id>`;负责人 ID 通过 `hubspot owners list --format table` 查找。
- 批量推进工单阶段:用搜索管道输出并构造更新,先 dry-run:`hubspot objects search --type tickets --filter "hs_ticket_category=BILLING_ISSUE AND hs_pipeline_stage=<new_stage_id>" | jq -c '{id, properties:{hs_pipeline_stage:"<waiting_stage_id>"}}' | hubspot objects update --type tickets --dry-run`。
- 执行批量推进:重复同一搜索管道,但不带 `--dry-run`。
- 超过 100 行时,遵循 `bulk-operations/SKILL.md` 中的 `--digest/--confirm` 流程(“Safe destructive workflow”)。
- 批量重新分配负责人:用相同方式,将 jq 属性改为 `{hubspot_owner_id:"<new>"}`。
- 记录解决说明:活动创建位于 `sales-execution/SKILL.md`(notes/calls/meetings/tasks);在那里创建 note 后,用 `hubspot associations create --from notes:<note_id> --to tickets:<ticket_id>` 关联到工单。
- 关闭工单:`hs_resolution` 是枚举属性,传入 Step 2 得到的允许选项值,不要传自由文本;运行 `hubspot objects update --type tickets <ticket_id> --property hs_pipeline_stage=<closed_stage_id> --property hs_resolution=<allowed_resolution_value>`。
- 关闭后由 HubSpot 计算 `hs_is_closed=true`、`closed_date` 和 `time_to_close`。
适用边界 · 注意事项
- 需要处理 HubSpot Conversations/Inbox 的聊天线程或收件箱邮件时不适用,CLI 没有这些 API 接口。
- 需要 `hubspot properties get`/`list` 直接返回枚举选项时不适用,它们不会返回枚举选项;必须用无效值探测或读取已有记录。
- 没有 HubSpot CLI 或 HubSpot 门户访问权限时不适用。