curl --request PATCH \
--url https://agent-api.bigmodel.cn/api/agent/forward/v0/channels/{channelId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'zai-beta: <zai-beta>' \
--header 'zai-version: <zai-version>' \
--data '
{
"channel_config": {
"group_prompt_template": "{{context_note}}\n{{messages}}"
}
}
'{
"id": "channel_feishu_xxx",
"type": "channel",
"channel_type": "feishu",
"name": "飞书 Channel xxx",
"template": {
"agent": {
"type": "agent",
"id": "agent_xxx",
"version": 3
},
"environment_id": "env_xxx",
"vault_ids": [],
"file_ids": [],
"memory_stores": []
},
"enabled": true,
"binding_status": "bound",
"connection_status": "disconnected",
"channel_config": {
"response_options": {
"include_tool_calls": false,
"include_process": false,
"card_output": true
},
"private_memory_store_enabled": false,
"group_prompt_template": null,
"group_reply_in_thread": true
},
"last_error": null,
"created_at": "2026-10-30T00:00:00.000Z",
"updated_at": "2026-10-30T00:00:00.000Z"
}Channel
更新 Channel 配置
局部更新 Channel 的群聊提示模板、飞书普通群话题开关或钉钉互动卡片配置。省略字段保留原值,不做配置整体替换。成功返回完整安全 Channel。
PATCH
/
agent
/
forward
/
v0
/
channels
/
{channelId}
curl --request PATCH \
--url https://agent-api.bigmodel.cn/api/agent/forward/v0/channels/{channelId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'zai-beta: <zai-beta>' \
--header 'zai-version: <zai-version>' \
--data '
{
"channel_config": {
"group_prompt_template": "{{context_note}}\n{{messages}}"
}
}
'{
"id": "channel_feishu_xxx",
"type": "channel",
"channel_type": "feishu",
"name": "飞书 Channel xxx",
"template": {
"agent": {
"type": "agent",
"id": "agent_xxx",
"version": 3
},
"environment_id": "env_xxx",
"vault_ids": [],
"file_ids": [],
"memory_stores": []
},
"enabled": true,
"binding_status": "bound",
"connection_status": "disconnected",
"channel_config": {
"response_options": {
"include_tool_calls": false,
"include_process": false,
"card_output": true
},
"private_memory_store_enabled": false,
"group_prompt_template": null,
"group_reply_in_thread": true
},
"last_error": null,
"created_at": "2026-10-30T00:00:00.000Z",
"updated_at": "2026-10-30T00:00:00.000Z"
}| channel_config 字段 | 适用渠道 | 类型与效果 |
|---|---|---|
group_prompt_template | Feishu / WeCom / DingTalk | string 自定义,null 恢复默认 |
group_reply_in_thread | 仅 Feishu | boolean;true 开启普通群话题回复,false 关闭 |
card_template_id | 仅 DingTalk | string 设置已发布模板;null 关闭 |
card_content_key | 仅 DingTalk | string 指定 Markdown 正文变量;null 恢复 content |
校验与状态码
- 顶层只接受
channel_config,内部至少一个可更新字段。未知字段、空更新或类型错误返回 400。 - 非 Feishu 传
group_reply_in_thread返回 400,即使值为 false;该字段不接受 null。 - 非 DingTalk 传卡片字段返回 400;WeChat 不支持此 PATCH,返回 400。
- 不能修改 credentials、Agent/template、name、response_options、private_memory_store_enabled 或 enabled。需要更换这些设置时删除并重建 Channel。
- 群聊模板最多 4096 个 UTF-16 code units;
{{context_note}}与{{messages}}各出现一次。空串、缺失/重复、未知或残缺占位符返回 400。只做一次文本替换,不支持表达式。 - 模板 ID trim 后 1–256 字符,仅字母/数字/下划线/点/冒号/连字符;正文变量 trim 后 1–64 字符,字母开头,后续仅字母/数字/下划线。
- 不存在、已删除或不属于当前账号的 Channel 返回 404;并发归档或更新冲突返回 409;超限返回 429。
更新示例
- 群聊模板
- 飞书话题
- 钉钉卡片
curl --request PATCH "https://agent-api.bigmodel.cn/api/agent/forward/v0/channels/$CHANNEL_ID" \
--header "Authorization: Bearer $ZHIPUAI_API_KEY" \
--header "zai-version: 2026-05-26" \
--header "zai-beta: managed-agents-2026-05-26" \
--header "Content-Type: application/json" \
--data '{
"channel_config": {
"group_prompt_template": "请根据当前消息回答,引用仅作参考。\n{{context_note}}\n{{messages}}"
}
}'
curl --request PATCH "https://agent-api.bigmodel.cn/api/agent/forward/v0/channels/$CHANNEL_ID" \
--header "Authorization: Bearer $ZHIPUAI_API_KEY" \
--header "zai-version: 2026-05-26" \
--header "zai-beta: managed-agents-2026-05-26" \
--header "Content-Type: application/json" \
--data '{
"channel_config": {
"group_reply_in_thread": true
}
}'
curl --request PATCH "https://agent-api.bigmodel.cn/api/agent/forward/v0/channels/$CHANNEL_ID" \
--header "Authorization: Bearer $ZHIPUAI_API_KEY" \
--header "zai-version: 2026-05-26" \
--header "zai-beta: managed-agents-2026-05-26" \
--header "Content-Type: application/json" \
--data '{
"channel_config": {
"card_template_id": "xxx.schema",
"card_content_key": "content"
}
}'
Authorizations
标准的 HTTP Bearer 认证方式,在 API Keys 页面获取密钥。
Headers
Body
application/json
Response
请求成功。
- 飞书
- 企业微信
- 钉钉
- 个人微信
固定 Agent 版本和渠道安全配置。不回显 credentials、扫码 token、平台消息 ID、内部 Session ID 或计费字段。
Was this page helpful?