发送卡片消息-交互卡片消息格式
字段属性说明 各参数详细说明请参考下表:
| 参数 | 是否必填 | 示例值 | 说明 |
|---|---|---|---|
| header | 否 | { "header": { "title": { "content": "This is header" }, "template": "red" } } | 用于配置卡片标题内容。 |
| elements | 是 | { "elements": [ { "tag": "rich_text", "content": { "type": "paragraph", "content": { "type": "text", "text": "文本" } } }, { "tag": "markdown", "content": "" }, { "tag": "action", "action": [ { "tag": "button", "text": { "content": "深度分析", "tag": "plain_text" }, "type": "view", "template": "white", "url": "mind.im30.net/" }, { "tag": "button", "text": { "content": "再次获取", "tag": "plain_text" }, "action_platform": "all", "type": "click", "template": "default", "event": "mind.message.event.guide", "value": { "card_id":"$card_id", "key": "value" //定义用户点击按钮后,POST回调地址的返回内容。参数中的key、value可以替换为任意值 } } ] } ] } | 卡片的正文内容,可选卡片内容 - @卡片 |
| config | 否 | { "config": { "enable_forward": true, "is_share_card":true, "data_visualization_mode": true, "enable_forward_external": false, "business_type": string } } | 用于配制卡片的属性,包括是否允许被转发、 是否为共享卡片等。 |
卡片配置
| 参数 | 是否必须 | 类型 | 描述 |
|---|---|---|---|
| enable_forward | 否 | Boolean | 是否允许卡片被转发。取值: - true:允许 - false:不允许 默认 true,客户端版本要求为3.31.0。 转发后卡片上的回传交互组件将自动置为禁用态。用户不能在转发后的卡片操作提交数据。 |
| is_share_card | 否 | Boolean | 是否为共享卡片,取值: - true:是共享卡片,更新卡片的内容对所有收到这张卡片的人员可见。 - false:是独享卡片,即仅操作用户可见卡片的更新内容。 默认为false。 |
| data_visualization_mode | 否 | Boolean | 是否允许卡片预览详情。取值: - true:允许 - false:不允许 |
| enable_forward_external | 否 | Boolean | 是否允许卡片被转发外部群/外部联系人。取值: - true:允许 - false:不允许 默认 false |
| business_type | 否 | string | 标识卡片的业务类型 |
卡片标题
消息卡片标题是通过一段JSON描述的卡片模块,本文介绍如何构建卡片标题。
字段属性说明
| 参数 | 是否必须 | 类型 | 示例值 | 描述 |
|---|---|---|---|---|
| title | 是 | Object | 配置卡片标题内容。 | |
| └ content | 否 | String | 这是标题 | 卡片标题文案内容。 |
| template | 否 | String | blue | red/green/blue/purple/orange 标题主题颜色,详情请参考标题样式表。 |
{
//在header中描述卡片的标题
"header": {
"title": {
"content": "XX项目3日留存"//卡片标题文案内容
},
"template":"red"//卡片标题的主题色
}
}
标题样式表
| template取值 | 样式 |
|---|---|
| green | ![]() |
| orange | ![]() |
| red | ![]() |
| purple | ![]() |
| blue | ![]() |
内容模块
内容模块以文本内容为主体,同时可以选择组合图片、按钮等交互组件,实现内容混排的效果。elements 模块标签为 rich_text
| 参数 | 是否必须 | 类型 | 示例值 | 说明 |
|---|---|---|---|---|
| tag | 是 | String | rich_text | 模块标签,固定值rich_text。 |
| content | 是 | Object | { "tag": "rich_text", "content": [ { "type": "paragraph", "content": [ { "type": "text", "marks": [ { "type": "bold" } ], "text": "所有项目180天收入" } ] } ] } | 富文本内容 |
设置富文本格式 查看富文本格式 消息卡片中支持 加粗、斜体、删除线、超链接、@人、@所有人 等富文本格式。
{"elements": [
{
"tag": "rich_text",
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"marks": [
{
"type": "bold"
}
],
"text": "所有项目180天收入"
},
{ // @用户
"type": "mention",
"attrs": {
"id": "9h1y8qd933bwtkip_nf4xw6i763dqfmcw",
"label": "帆导2号"
}
}
]
},
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "最后更新时间:2023-7-7发布人:桃子(每月3日09:15 推送)"
}
]
}
]
}
]
}
Markdown模块
你可以使用标准Markdown语法标签,快捷地构造消息卡片内容,Markdown模块可用于渲染文本格式、图片、分割线等元素。本文介绍如何使用Markdown模块。 可使用Markdown标签的内容模块包括: - 使用独立的Markdown模块,用一段Markdown标签构造包含格式化文本、图片、分割线的消息卡片内容。
字段属性说明
| 参数 | 是否必须 | 类型 | 示例值 | 说明 |
|---|---|---|---|---|
| tag | 是 | String | markdown | 模块标签,固定值markdown。 |
| content | 是 | String | Markdown标签内容 | 使用已支持的Markdown语法构造Markdown内容。 |
{
"elements":[{
"tag": "markdown",
"content": "**总结性分析总览**\n 哈哈哈哈 <at user_id='xxxx'>用户名</at> 解决了 <at user_id='all'>所有人</at> "
}]
}
操作按钮模块
字段属性说明
| 参数 | 是否必须 | 类型 | 示例值 | 说明 |
|---|---|---|---|---|
| tag | 是 | String | action | 模块标签,固定值action。 |
| action | 是 | Array | { "tag": "button", "text": { "content": "深度分析", "tag": "plain_text" }, "action_platform": "all", "type": "view", "template": "white", "url": "mind.im30.net/", "open_platform": "browser" } |
{"elements":[
{
"tag": "action",
"action": [
{
"tag": "button",
"text": {
"content": "深度分析",
"tag": "plain_text"
},
"action_platform": "all",
"type": "view",
"template": "red",
"url": "https://mind.im30.net/"
},
{
"tag": "button",
"text": {
"content": "再次获取",
"tag": "plain_text"
},
"action_platform": "all",
"type": "click",
"template": "red",
"event": "mind.message.event.guide",
"value": {
"card_id":"$card_id",
"key": "value" //定义用户点击按钮后,POST回调地址的返回内容。参数中的key、value可以替换为任意值
}
}
]
}
]
}
Button
字段说明
| 参数 | 是否必须 | 类型 | 示例值 | 说明 | |
|---|---|---|---|---|---|
| tag | 是 | String | button | 模块标签,固定值button。 | |
| text | 是 | String | |||
| └ content | 是 | String | 文本 | 按钮文本 | |
| └ tag | 否 | String | plain_text | 按钮类型 | |
| type | 是 | String | view | click | 按钮操作类型: view: 打开url连接, type为view时要配置url地址 click: 事件按钮,type为click时要配置event事件 | |
| template | 否 | String | red | 按钮颜色,支持red/green/blue/purple/orange,默认白色背景黑色字体。 | |
| event | 否 | String | 按钮 | ||
| value | 否 | Object | 触发事件时所需的参数 | ||
| action_platform | 否 | String | all | 按钮在那个平台显示: pc:按钮在pc端展示 mobile:按钮在移动端端展示 all: 按钮在两端都展示 默认值:all | |
| url | 否 | String | mind.im30.net/ mind内部业务地址:mind://msg/goal-detail?goal-id=123 | 跳转的连接 mind内部业务系统地址说明: 1. 自定义业务入口标识:用protocol,只要是mind:// 开头就是内部业务入口 2. 自定义业务区分标识:使用中间的路由 msg/goal-detail,( ?和协议之间全量路由部分) 3. 自定义业务参数来源: ?后 key=value,多key直接 &拼接 (和正常URL规则一致) | |
| open_platform | 否 | string | browser | app | url连接在哪里打开 browser: 在浏览器打开 app:在客户端内打开,新窗口或者tab页签打开 |
更新时间:2026-03-26




