发送卡片消息
接口地址
域名:https://open.mindoffice.cn
uri : /open-platform/api/open-apis/send_message
请求地址
https://open.mindoffice.cn/open-platform/api/open-apis/send_message请求方式
POST+JSON
请求Header
app-id 系统分配
app-secret 系统分配
x-request-id 时间戳(毫秒) 或者 uuid.v4
请求Body参数
| 字段 | 类型 | 必须 | 描述 | 默认 | 示例值 |
|---|---|---|---|---|---|
| content | string | 是 | 消息内容 | 无 | |
| receive_ids | []string | 否 | 批量接收人open_id 优先级高于 receive_id | 无 | ["on_xx","on_xx"] |
| receive_id | string | 否 | 接收人open_id 接收人都不传,则发送全量订阅用户 | 无 | on_xx |
| receive_type | int | 是 | 接受类型 1:订阅用户 | 无 | 1 |
| msg_type | string | 是 | 消息类型 text | 无 | text、markdown、rich_text 、interactive |
参数示例
{
"receive_id": "ou_7d8a6e6df7621556ce0d21922b676706ccs", // 用户 OpenId,如果为空则发送所有人
"receive_type": 1, // 1个人
"content": "{\"text\":\"### 这是markdown \\n *好主意* \\n\"}", // 消息内容
"msg_type": "text" // 消息类型
}
{
"receive_id":"ou_6a5905698688e15e8f9b63c1043d1ee9",
"receive_type":1,
"msg_type":"markdown",
"content": "{\"text\":\"### 这是markdown \\n *好主意* \\n\"}"
}
text 格式
| 字段 | 类型 | 必须 | 描述 | 默认 | 示例值 |
|---|---|---|---|---|---|
| text | 是 | String | 文章内容 | 纯文本内容 |
## content 内容 ,json格式字符串解析后
content的值 "{\"text\":\" test content\"}"
{
"text": "", //卡片内容
}
markdown 格式
| 字段 | 类型 | 必须 | 描述 | 默认 | 示例值 |
|---|---|---|---|---|---|
| text | 是 | String | 文章内容 | 纯文本内容 |
content的值 :"{\"text\":\"### 这是markdown \\n *好主意* \\n\"}"
## content的值 json 格式字符串解析后
{
"text": "### 这是markdown \n *好主意* \n", //卡片内容
}
rich_text 格式
{
"msg_type": "rich_text",
"content": "[
{
\"type\": \"paragraph\",
\"content\": [
{
\"type\": \"text\",
\"text\": \"文本\"
}
]
},
{
\"type\": \"paragraph\",
\"content\": [
{
\"type\": \"text\",
\"marks\": [
{
\"type\": \"bold\"
}
],
\"text\": \"加粗文本\"
}
]
},
{
\"type\": \"paragraph\",
\"content\": [
{
\"type\": \"mention\",
\"attrs\": {
\"id\": \"zzz\",
\"label\": \"Mind Work Center\"
}
},
{
\"type\": \"text\",
\"text\": \" \"
}
]
},
{
\"type\": \"paragraph\",
\"content\": [
{
\"type\": \"text\",
\"text\": \"链接 \"
},
{
\"type\": \"text\",
\"marks\": [
{
\"type\": \"link\",
\"attrs\": {
\"href\": \"http://www.baidu.com\",
\"target\": \"_blank\",
\"class\": \"me-link\"
}
}
],
\"text\": \"http://www.baidu.com\"
},
{
\"type\": \"text\",
\"text\": \" \"
}
]
},
{
\"type\": \"bulletList\",
\"content\": [
{
\"type\": \"listItem\",
\"content\": [
{
\"type\": \"paragraph\",
\"content\": [
{
\"type\": \"text\",
\"text\": \"无序列表 (* 、+ 、- 空格)\"
}
]
}
]
}
]
},
{
\"type\": \"orderedList\",
\"attrs\": {
\"start\": 1
},
\"content\": [
{
\"type\": \"listItem\",
\"content\": [
{
\"type\": \"paragraph\",
\"content\": [
{
\"type\": \"text\",
\"text\": \"有序列表1\"
}
]
}
]
},
{
\"type\": \"listItem\",
\"content\": [
{
\"type\": \"paragraph\",
\"content\": [
{
\"type\": \"text\",
\"text\": \"有序列表2\"
}
]
}
]
}
]
},
{
\"type\": \"heading\",
\"attrs\": {
\"level\": 1,
\"id\": \"hotuh\"
},
\"content\": [
{
\"type\": \"text\",
\"text\": \"一级标题 (#空格)\"
}
]
},
{
\"type\": \"paragraph\",
\"content\": [
{
\"type\": \"text\",
\"text\": \"自定义表情 \"
},
{
\"type\": \"emoji\",
\"attrs\": {
\"alt\": \"鼓掌\",
\"src\": \"/images/emoji_applaud.png\"
}
},
{
\"type\": \"text\",
\"text\": \" \"
}
]
},
{
\"type\": \"image\",
\"attrs\": {
\"src\": \"https://new-mind-test-1252325870.cos.ap-beijing.myqcloud.com/xxxx/16692901972731669290196941/image.png\",
\"alt\": null,
\"title\": null
}
}
]"
}
interactive 交互卡片
交互卡片结构:work.mindoffice.cn/d...
{"receive_id":"oc_820faa21d7ed275b53d1727a0feaa917",
"receive_type":1,
"msg_type":"interactive",
"content":{\"config\":{\"enable_forward\":true,\"is_share_card\":false,\"data_visualization_mode\":true},\"header\":{\"template\":\"red/green/blue/purple/yellow\",\"title\":{\"content\":\"Mind富文本消息\"}},\"elements\":[{\"tag\":\"rich_text\",\"content\":[{\"type\":\"paragraph\",\"content\":[{\"type\":\"text\",\"marks\":[{\"type\":\"bold\"}],\"text\":\"所有项目180天收入\"}]},{\"type\":\"paragraph\",\"content\":[{\"type\":\"text\",\"text\":\"最后更新时间:2023-7-7发布人:桃子(每月3日09:15 推送)\"}]}]},{\"tag\":\"markdown\",\"content\":\"**总结性分析总览**\\n\"},{\"tag\":\"action\",\"action\":[{\"tag\":\"button\",\"text\":{\"content\":\"深度分析\",\"tag\":\"plain_text\"},\"type\":\"view\",\"template\":\"white\",\"url\":\"https://mind.im30.net/\"},{\"tag\":\"button\",\"text\":{\"content\":\"再次获取\",\"tag\":\"plain_text\"},\"type\":\"click\",\"template\":\"default\",\"event\":\"mind.message.event.guide\",\"value\":{\"card_id\":\"$card_id\",\"key\":\"value\"}}]}]}}
返回参数
| 字段 | 类型 | 必须 | 描述 | 默认 | 示例值 |
|---|---|---|---|---|---|
| code | string | 是 | 状态码 | 200 | 200:成功非200:失败 |
| msg | string | 是 | 提示 | ||
| data | object | 否 |
{
"code": 200,
"msg": "OK",
"data":{}
}
Curl 格式
curl -X POST --location "https://open.mindoffice.cn/open-platform/api/open-apis/send_message" \
-H "Content-Type: application/json" \
-H "APP-ID: mind_y2rbhgo9no60u2yd" \
-H "APP-Secret: xxxx" \
-H "X-Request-ID: 1" \
-d "{
\"receive_id\":\"ou_34226fdac1dae283c4e1b01645d9a6f2\",
\"receive_type\":1,
\"content\":\"{\\\"header\\\":{\\\"title\\\":{\\\"content\\\":\\\"紧急通知\\\"},\\\"template\\\":\\\"blue\\\"},\\\"config\\\":{\\\"enable_forward\\\":false,\\\"is_share_card\\\":false,\\\"data_visualization_mode\\\":false},\\\"elements\\\":[{\\\"tag\\\":\\\"markdown\\\",\\\"content\\\":\\\"<font color=\\\\\\\"#006DF9\\\\\\\">以下内容需查看详情并回复\\\\\\\"我已知悉\\\\\\\":</font> \\\\n <small><font color=\\\\\\\"#808080\\\\\\\">2024.12.1</font></small> \\\\n <content style=\\\\\\\"-webkit-box-orient: vertical;-webkit-line-clamp: 6;display: -webkit-box;overflow: hidden;text-overflow: ellipsis;\\\\\\\">222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221231231231222222222222222222222222222222222222222222222222222222231311111111111111111111111111111111111111111111111111111111111111231232111111</content>\\\"},{\\\"tag\\\":\\\"action\\\",\\\"action\\\":[{\\\"tag\\\":\\\"button\\\",\\\"text\\\":{\\\"content\\\":\\\"查看详情\\\",\\\"tag\\\":\\\"plain_text\\\"},\\\"type\\\":\\\"view\\\",\\\"template\\\":\\\"default\\\",\\\"url\\\":\\\"https:///\\\"}]}]}\",
\"msg_type\":\"interactive\"
}"
更新时间:2026-03-26