发送图片形式的频道消息
发送图片消息
一、上传图片
示例返回结果如下:
{
"status": "ok",
"msg": "",
"version": "1.0",
"result": {
"url": "https://chat.max-c.com/attachments/2024-09-03/1830944049440231424_bqHFSPHaIF.png"
}
}
二、发送参数解析
字段名 | 类型 | 描述 | 例子 |
---|---|---|---|
heychat_ack_id | string | 用于确认消息是在频道发送重复 | 建议维护一个全局的累加的值,60秒内不重复 |
msg | string | 消息内容,这个例子是带@某个人的markdown图片消息 | "@{id:8829926} ![]() |
msg_type | int | 消息类型 | 参考发送消息的参数解析中的消息类型 |
img | string | 图片上传CDN的地址 | "https://chat.max-c.com/pic/1793554163917103104.png" |
addition | string | 扩展信息是将KV结构dumps成string | "{"img_files_info":[{"url":"https://chat.max-c.com/pic/1793554163917103104.png","width":194,"height":228}]}" |
room_id | string | 房间 ID | “366331678831519300” |
channel_id | string | 频道 ID,不指定房间和频道ID 无法发送 | “3663316788315193000” |
{
"img_files_info": [{
"url": "https://chat.max-c.com/pic/1793554163917103104.png",
"width": 194,
"height": 228
}]
}
字段名 | 类型 | 描述 | 例子 |
---|---|---|---|
img_files_info | string | 这里是一个图片信息的数组 | |
url | string | 图片的CND地址 | |
width | int | 图片的宽 | 194 |
height | int | 图片的高 | 228 |
三、直接发送图片到频道
示例如下:
{
"heychat_ack_id": "0",
"msg_type": 3,
"img": "https://chat.max-c.com/pic/1793554163917103104.png",
"addition": "{\"img_files_info\":[{\"url\":\"https://chat.max-c.com/pic/1793554163917103104.png\",\"width\":194,\"height\":228}]}",
"channel_id": "3377790315288076288",
"room_id": "3365307913282265088",
}
四、将图片嵌入 markdown 文本
示例如下:
{
"msg": "@{id:8829926} ",
"msg_type": 10,
"heychat_ack_id": "1",
"room_id": "3650716263361773568",
"addition": "{\"img_files_info\":[{\"url\":\"https://chat.max-c.com/pic/1830942626358972416.png\",\"width\":54,\"height\":54}]}",
"at_user_id": "8829926",
"channel_id": "3653787044223606784",
}
修改于 2024-10-14 09:53:36