跳转至

SetEntityProperty

设置或更新实体上的属性值。任务以 entity_type='document' 为目标。Tasks UI 中的项目是 entity_type='initiative';entity_type='project' 仍表示文件夹。Initiative 实体共享下面的 Assignees、Status、Priority 和 Due Date 定义及其清除行为。项目 Status 仅接受 Not Started (00000001-0000-0000-0002-000000000001)、In Progress (...0002) 和 Completed (...0004);In Review 和 Canceled 仅为任务选项。请提供 property_definition_id 以及恰好一个与该属性数据类型匹配的值字段。

对于多选属性(包括标签),优先使用 add_option_ids / remove_option_ids 而不是 option_ids:它们可以原子性地只添加或移除这些选项,并与并发编辑组合。option_ids 会替换整个值,因此过期的读取可能静默地丢失其他人刚刚添加的选项;仅当用户要求将值设置为完全给定的列表时才使用它。要应用标签,请在 add_option_ids 中传入标签集的 property_definition_id 和标签的选项 ID(两者均来自 ListTags);要移除标签,请使用 remove_option_ids。

任务始终具有这些系统属性(直接使用这些 property_definition_id 值):

  • Assignees (00000001-0000-0000-0000-000000000001):实体类型,多选。使用 entity_refs,其中 entity_type='user',人员使用 entity_id='macro|email@domain.com',代理使用 entity_id='bot|\'。添加代理会启动其会话并在任务讨论中回复。
  • Status (00000001-0000-0000-0000-000000000002):select_string,单选。选项:Not Started (00000001-0000-0000-0002-000000000001)、In Progress (...0002)、In Review (...0003)、Completed (...0004)、Canceled (...0005)。
  • Priority (00000001-0000-0000-0000-000000000003):select_string,单选。选项:Low (...0001)、Medium (...0002)、High (...0003)、Urgent (...0004)。选项 ID:00000001-0000-0000-0003-0000000000XX。
  • Due Date (00000001-0000-0000-0000-000000000004):日期,单选。使用带 ISO 8601 的 date_value。
  • Parent Task (00000001-0000-0000-0000-000000000005):实体,单选。使用 entity_type='task' 的 entity_ref。
  • Subtasks (00000001-0000-0000-0000-000000000006):实体,多选。使用 entity_type='task' 的 entity_refs。
  • Story Points (00000001-0000-0000-0000-000000000009):数字,单选。使用 number_value。

一个任务可以属于一个项目:

  • Project (00000001-0000-0000-0000-000000000014):实体,单选。使用 entity_type='initiative' 和项目 UUID 的 entity_ref;不发送任何值字段可将任务从其项目中移除。设置它需要对该任务和项目具有编辑权限,并且项目的代理会被分配给该任务。

CRM 公司(entity_type='company',entity_id 为公司 UUID)始终具有这些系统属性:

  • Stage (00000001-0000-0000-0000-000000000010):select_string,单选。使用 option_id。默认选项:Lead (00000001-0000-0000-0010-000000000001)、Qualified (...0002)、Demo (...0003)、Trial (...0004)、Negotiation (...0005)、Customer (...0006)、Churned (...0007)。团队可以自定义其阶段,因此最好先调用 GetCompany 或 GetEntityProperties 获取有效的阶段选项 ID。这是公司自己的 Stage,而不是 CRM 管线中商机的阶段:使用 UpdatePipelineEntries 移动管线商机。
  • Owner (00000001-0000-0000-0000-000000000011):实体,单选。使用 entity_type='user' 且 entity_id='macro|email@domain.com' 的 entity_ref。
  • Revenue (00000001-0000-0000-0000-000000000012):数字,单选。使用 number_value(美元)。

所属团队的任何成员都可以编辑可见的公司属性;隐藏记录仍仅限管理员/所有者访问。

任何实体(任务、文档、通话等)都可以通过以下系统属性与 CRM 记录关联:

  • Companies (00000001-0000-0000-0000-00000000000c):实体,多选。使用 entity_type='company' 及公司 UUID 的 entity_refs。
  • Contacts (00000001-0000-0000-0000-000000000013):实体,多选。使用 entity_type='contact' 及联系人 UUID 的 entity_refs。

对于非系统或自定义属性,请先调用 GetEntityProperties 以发现 property_definition_id 值和选项。

参数

参数 类型 必填 描述
entity_id string 是 要更新的实体的 ID。
entity_type "document" | "initiative" | "project" | "thread" | "channel" | "call" | "user" | "company" 是 AI 工具针对实体属性时所接受的标准实体类型。任务以 document 为目标;电子邮件线程(在 ListEntities 和搜索结果中类型为 email)以 thread 为目标。
property_definition_id string 是 属性定义 ID。从 GetEntityProperties 结果中获取。
boolean_value boolean 否 用于布尔属性。
date_value string 否 用于日期属性(ISO 8601 日期时间)。
date_range_value ToolDateRange 否 用于 date_range 属性:开始和结束(ISO 8601 日期时间);结束不得早于开始。
number_value number 否 用于数字属性。
string_value string 否 用于字符串属性。
option_id string 否 用于单选属性。来自可用选项的选项 UUID。
option_ids string[] 否 用于多选属性。用这些选项 UUID 替换整个值 — 添加或移除特定选项时,优先使用 add_option_ids / remove_option_ids。
add_option_ids string[] 否 用于多选属性(包括标签):在不触碰其他选项的情况下,将这些选项原子性地添加到当前值中。不能与其他值字段组合。
remove_option_ids string[] 否 用于多选属性(包括标签):在不触碰其他选项的情况下,将这些选项从当前值中原子性地移除。移除不存在的选项是空操作。不能与其他值字段组合。
entity_ref ToolEntityRef 否 用于单一实体引用属性。
entity_refs ToolEntityRef[] 否 用于多实体引用属性。
link_url string 否 用于单链接属性。
link_urls string[] 否 用于多链接属性。

本页原文 Markdown:在 AtomGit 查看·内容源自开源项目 macro3/macro