使用限制

机器人必须在话题内,才可以在话题内发送卡片消息

接口地址

域名:https://open.mindoffice.cn
uri : /open-platform/api/robot/group/send/card_message

请求地址

https://open.mindoffice.cn/open-platform/api/robot/group/send/card_message

请求方式

POST+JSON

请求Header

app-id 系统分配
app-secret 系统分配
x-request-id 请求id 短时间内幂等

请求Body参数

 

字段类型必须描述默认示例值
group_idstring群组id
msg_typestring消息类型(text、markdown、rich_text、interactive
markdown
contentstring消息内容

text 格式

@格式要求 完全按照如下格式,中间不能有多余的空格
// @ 单个用户 完全按照如下格式,中间不能有多余的空格
<at user_id="xxxxx">用户名</at>
<at user_id='xxxxx'>用户名</at>   

// @ 所有人 
<at user_id="all">所有人</at>
{
    "group_id": "ccc",
    "content": "{\"text\":\" 1123222233333 \"}",
    "msg_type": "text"
}

// @消息 文本里使用 <at user_id='all'>所有人</at> <at user_id='{{robot-team-user-id}}'>如易</at>
{
  "group_id": "{{group-id}}",
  "content": "{\"text\":\"## firstline  second l    ne  <at user_id='all'>所有人</at> <at user_id='{{robot-team-user-id}}'>如易</at> \"}",
  "msg_type": "text"
}

markdown 格式

@格式要求 完全按照如下格式,中间不能有多余的空格
// @ 单个用户 完全按照如下格式,中间不能有多余的空格
<at user_id="xxxxx">用户名</at>
<at user_id='xxxxx'>用户名</at>   

// @ 所有人 
<at user_id='all'>所有人</at>
{
    "group_id": "ccc",
    "content": "{\"text\":\" #### markdown格式的文本 \\n + 11111 \\n + 222233333 \"}",
    "msg_type": "markdown"
}

// 彩色字体 <font color='red' >红色的字体 </font>
// @消息 文本里使用 <at user_id='all'>所有人</at> <at user_id='{{robot-team-user-id}}'>如易</at>

{
  "group_id": "{{group-id}}",
  "content": "{\"text\":\" firstline  second l    ne  <at user_id='all'>所有人</at> <at user_id='{{robot-team-user-id}}'>如易</at> \"}",
  "msg_type": "markdown"
}

rich_text 格式 查看富文本消息格式

 

{
    "group_id": "xxx",
    "content": "[{\"content\":[{\"text\":\"test\",\"type\":\"text\"}],\"type\":\"paragraph\"}]",
    "msg_type": "rich_text"
}

## 富文本@消息
content 中 使用:
{"type":"paragraph","content":[{"type":"mention","attrs":{"id":"all","label":"所有人"}},{"type":"mention","attrs":{"id":"xxxx","label":"如易"}}]}

{
  "group_id": "{{group-id}}",
  "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 交互卡片格式 点我看详情

交互卡片消息-设置回调button ,需后台配置回调地址,回调格式
enter image description here

{
    "group_id": "xxx",
    "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\":\"view\",\"url\":\"http:/?id=1\"}]}],\"header\":{\"template\":\"red\",\"title\":{\"content\":\"触发中\"}}}",
    "msg_type": "interactive"
}

// 交互@消息
{
    "group_id": "{{group-id}}",
    "content": "{\"elements\":[{\"action\":null,\"content\":\" ### 触发时间:2024-07-25 09:45:00  收到一条报警 <at user_id=\\\"all\\\">所有人</at> <at user_id=\\\"{{robot-team-user-id}}\\\">如易</at> \",\"tag\":\"markdown\"},{\"content\":[{\"attrs\":{\"id\":\"all\",\"label\":\"所有人\"},\"type\":\"mention\"},{\"attrs\":{\"id\":\"{{robot-team-user-id}}\",\"label\":\"{{name}}\"},\"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\":\"red\",\"text\":{\"content\":\"未处理\",\"tag\":\"plain_text\"},\"type\":\"view\",\"url\":\"http:/?id=1\"}],\"content\":\"\",\"tag\":\"action\"}]}",
    "msg_type": "interactive"
}

 

返回参数

 

字段类型必须描述默认示例值
codestring状态码200200:成功
非200:失败
msgstring提示  
dataobject

 

data参数


字段 类型 必须 描述 默认 示例值
message_id string 消息id xxx

 

{
    "code": 200,
    "msg": "OK",
    "data": {
	       "message_id":"xxxx"
	 }
}

Curl 格式

curl -X POST --location "https://open.mindoffice.cn/open-platform/api/robot/group/send/card_message" \
    -H "Content-Type: application/json" \
    -H "APP-ID: robot_xxx" \
    -H "APP-Secret: xxx" \
	-H "X-Request-Id: xxx" \
    -d "{
          \"group_id\": \"xxx\",
          \"content\": \"[{\\\"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\"
        }"   
 更新时间:2026-03-26