机器人发送私聊卡片消息
使用限制
需要在后台进行数据权限订阅-发送私聊消息
接口地址
域名:https://open.mindoffice.cn
uri : /open-platform/api/robot/send/message
请求地址
https://open.mindoffice.cn/open-platform/api/robot/send/message请求方式
POST+JSON
请求Header
app-id 系统分配
app-secret 系统分配
x-request-id 请求id 短时间内幂等
请求Body参数
| 字段 | 类型 | 必须 | 描述 | 默认 | 示例值 |
|---|---|---|---|---|---|
| receive_open_ids | []string | 是 | 接收人的open_ids,可以传多个用户 | 无 | |
| msg_type | string | 是 | 消息类型(text、markdown、rich_text、interactive ) | 无 | markdown |
| content | string | 是 | 消息内容 | 无 |
text 格式
{
"receive_open_ids": ["ccc"],
"content": "{\"text\":\" 1123222233333 \"}",
"msg_type": "text"
}
#### markdown 格式
```json
{
"receive_open_ids": ["ccc"],
"content": "{\"text\":\" #### markdown格式的文本 \\n + 11111 \\n + 222233333 \"}",
"msg_type": "markdown"
}
// 彩色字体 <font color='red' >红色的字体 </font>
{
"receive_open_ids": ["ccc"],
"content": "{\"text\":\" firstline second l \"}",
"msg_type": "markdown"
}
rich_text 格式 查看富文本消息格式
{
"receive_open_ids": ["ccc"],
"content": "[{\"content\":[{\"text\":\"test\",\"type\":\"text\"}],\"type\":\"paragraph\"}]",
"msg_type": "rich_text"
}
{
"receive_open_ids": ["ccc"],
"content": "[{\"type\":\"paragraph\",\"content\":[{\"type\":\"mention\",\"attrs\":{\"id\":\"all\",\"label\":\"所有人\"}},{\"type\":\"mention\",\"attrs\":{\"id\":\"{{robot-team-user-id}}\",\"label\":\"{{name}}\"}}]},{\"type\":\"paragraph\",\"content\":[{\"type\":\"text\",\"text\":\"文本\"}]},{\"type\":\"paragraph\",\"content\":[{\"type\":\"text\",\"marks\":[{\"type\":\"bold\"}],\"text\":\"加粗文本\"}]},{\"type\":\"image\",\"attrs\":{\"src\":\"https://new-mind-test-1252325870.cos.ap-beijing.myqcloud.com/xxxx/16692901972731669290196941/image.png\",\"alt\":null,\"title\":null}}]",
"msg_type": "rich_text"
}
interactive 交互卡片格式 点我看详情
{
"receive_open_ids": ["ccc"],
"content": "{\"config\":{\"enable_forward\":true,\"wide_screen_mode\":true},\"elements\":[{\"tag\":\"markdown\",\"content\":\"触发时间:2024-07-2509:45:00\n 收到一条通知,请查看\n\n\",\"action\":null},{\"tag\":\"action\",\"content\":\"\",\"action\":[{\"tag\":\"button\",\"template\":\"red\",\"text\":{\"content\":\"未处理\",\"tag\":\"plain_text\"},\"type\":\"click\",\"event\":\"12345\"}]}],\"header\":{\"template\":\"red\",\"title\":{\"content\":\"触发中\"}}}",
"msg_type": "interactive"
}
返回参数
| 字段 | 类型 | 必须 | 描述 | 默认 | 示例值 |
|---|---|---|---|---|---|
| code | string | 是 | 状态码 | 200 | 200:成功非200:失败 |
| msg | string | 是 | 提示 | ||
| data | object | 是 |
data参数
| 字段 | 类型 | 必须 | 描述 | 默认 | 示例值 |
|---|
{
"code": 200,
"msg": "OK",
"data": {
}
}
Curl 格式
curl -X POST --location "https://open.mindoffice.cn/open-platform/api/robot/send/message " \ -H "Content-Type: application/json" \ -H "APP-ID: robot_1szducrqcvcq6sog" \ -H "APP-Secret: mwEJCutyx44evO87K8g1lubhyHzCmTUN" \ -H "X-Request-ID: 1" \ -d "{ \"receive_open_ids\": [\"ou_258e96bd6b67ac866a45d08dce22f7ea\"], \"content\": \"{\\\"config\\\":{\\\"enable_forward\\\":true,\\\"wide_screen_mode\\\":true},\\\"elements\\\":[{\\\"content\\\":[{\\\"attrs\\\":{\\\"id\\\":\\\"all\\\",\\\"label\\\":\\\"所有人\\\"},\\\"type\\\":\\\"mention\\\"},{\\\"attrs\\\":{\\\"id\\\":\\\"FwxaCEI9BUYFRAsPRBxCRgVdFAUDBwgcBAc\\\",\\\"label\\\":\\\"如易\\\"},\\\"type\\\":\\\"mention\\\"},{\\\"content\\\":[{\\\"text\\\":\\\"帖子发布人:\\\",\\\"type\\\":\\\"text\\\"}],\\\"type\\\":\\\"paragraph\\\"},{\\\"content\\\":[{\\\"text\\\":\\\"FreakyFknTachy\\\",\\\"type\\\":\\\"text\\\"}],\\\"type\\\":\\\"paragraph\\\"},{\\\"content\\\":[{\\\"text\\\":\\\" \\\",\\\"type\\\":\\\"text\\\"}],\\\"type\\\":\\\"paragraph\\\"},{\\\"content\\\":[{\\\"text\\\":\\\"操作人:\\\",\\\"type\\\":\\\"text\\\"}],\\\"type\\\":\\\"paragraph\\\"},{\\\"content\\\":[{\\\"text\\\":\\\"xxx\\\",\\\"type\\\":\\\"text\\\"}],\\\"type\\\":\\\"paragraph\\\"},{\\\"content\\\":[{\\\"text\\\":\\\" \\\",\\\"type\\\":\\\"text\\\"}],\\\"type\\\":\\\"paragraph\\\"},{\\\"content\\\":[{\\\"text\\\":\\\"状态调整:\\\",\\\"type\\\":\\\"text\\\"}],\\\"type\\\":\\\"paragraph\\\"},{\\\"content\\\":[{\\\"text\\\":\\\"已接收\\\",\\\"type\\\":\\\"text\\\"}],\\\"type\\\":\\\"paragraph\\\"}],\\\"tag\\\":\\\"rich_text\\\"},{\\\"action\\\":[{\\\"tag\\\":\\\"button\\\",\\\"template\\\":\\\"green\\\",\\\"text\\\":{\\\"content\\\":\\\"点击查看\\\",\\\"tag\\\":\\\"plain_text\\\"},\\\"type\\\":\\\"view\\\",\\\"url\\\":\\\"http://www.im30.net/111?project_id=7\\\\u0026id=2110085\\\ "}],\\\"tag\\\":\\\"action\\\"}],\\\"header\\\":{\\\"template\\\":\\\"green\\\",\\\"title\\\":{\\\"content\\\":\\\"您收到一个新的工单[20085]: 我们能否有办法根据 CP 或字母顺序对联盟成员进行排序?\\\"}}} \", \"msg_type\": \"interactive\" }"
更新时间:2026-03-26