mcpField
C
custom-object-management

custom-object-management

github.com/hubspot数据与数据库281.7k 次安装今天更新
代码仓库

关于 custom-object-management

这套技能用于管理 HubSpot 自定义对象架构,涵盖发现、查看、创建、更新元数据和删除,适合需要定义自定义记录类型并通过标准对象命令操作的 HubSpot 用户。

主要功能

  1. 01列出并查看自定义架构
  2. 02创建带属性和标签的架构
  3. 03更新架构标签与描述
  4. 04通过保护流程删除架构
  5. 05使用对象命令操作自定义类型

适用场景

  1. 01确认自定义对象类型是否已存在
  2. 02为新的记录类型定义架构
  3. 03修改标签或描述而不改属性
  4. 04通过保护流程删除架构及其记录

安装

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

$npx skills add https://github.com/hubspot/agent-cli-skills --skill custom-object-management

安装后在 Claude Code 中输入/custom-object-management确认已加载。

详细介绍

权威依据

hubspot schemas --help 是权威依据。子命令:list、get、create、update(仅元数据)和 delete(破坏性操作)。schemas list/get/create/update 可在 OAuth 登录或使用服务密钥时运行;schemas delete 仅支持服务密钥(AppTokenOnly)——请设置 HUBSPOT_ACCESS_TOKEN。请先阅读 bulk-operations/SKILL.md——此处的每条命令都使用其中的 JSONL 约定,且 schemas delete 使用其 dry-run / digest / confirm 流程。

查找现有架构

hubspot schemas list                                       # JSONL: name, label, singular, objectTypeId, source
hubspot schemas list | jq 'select(.source=="custom")'      # custom only
hubspot objects types | jq -c 'select(.source=="custom")'  # same set, also shown to confirm `--type` resolves

name 是其他所有命令所需的值。objectTypeId(例如 2-12345678)仅在工作流 PLATFORM_FLOW 目标中需要。

检查单个架构

hubspot schemas get --type pets

返回完整定义——属性、关联、标签、requiredProperties、primaryDisplayProperty、fullyQualifiedName。根据需要使用 jq 重塑数据(参见 bulk-operations/resources/json-patterns.md)。

创建架构

构建 JSON 请求体并通过管道传入(或传递 --file)。最简有效请求体:

{
  "name": "equipment",
  "labels": {"singular": "Equipment", "plural": "Equipment"},
  "primaryDisplayProperty": "equipment_name",
  "requiredProperties": ["equipment_name"],
  "properties": [
    {"name": "equipment_name", "label": "Name", "type": "string", "fieldType": "text"}
  ],
  "associatedObjects": ["contacts"]
}
cat equipment-schema.json | hubspot schemas create --dry-run   # preview
hubspot schemas create --file equipment-schema.json            # execute

之后可使用 hubspot properties create --type <name> ... 添加更多属性。

更新架构元数据

update 仅更新标签 / 描述。属性编辑应通过 hubspot properties 进行。

echo '{"labels":{"singular":"Device","plural":"Devices"}}' | hubspot schemas update --type equipment

update 也支持 --dry-run → digest → 使用 --digest --confirm <name> 重新运行(有关此模式,请参见 bulk-operations/SKILL.md)。

删除架构(破坏性操作)

删除架构具有破坏性且不可逆——它会永久删除该架构及该类型的所有记录。此操作受 MetadataDestroy 限制:每次删除都必须先运行 --dry-run,然后在 5 分钟内使用 --digest <hash> --confirm <name> 重新运行。

请遵循 bulk-operations/SKILL.md(“Safe destructive workflow”)中所述的三步流程。对于架构,确认值为架构名称:

hubspot schemas delete --type equipment --dry-run
# → digest=blast-... ; apply_command_hint shows: --digest <hash> --confirm 'equipment'
hubspot schemas delete --type equipment --digest <hash> --confirm equipment

运行 hubspot history --since 24h --kind MetadataDestroy,审计近期架构删除操作。

创建架构后的使用方式

架构创建后,所有 hubspot objects ... 命令都接受其 name 作为 --type(例如 --type pets)。记录 CRUD、搜索、关联、批量 upsert——这些操作都与标准对象相同。请勿在此处重新实现这些流程;参见 bulk-operations/SKILL.md 和 crm-lookup。

评论

支持 Markdown