跳到主要内容

消息中 contentType 及对应 content 说明

简要描述​

  • {API_ADDRESS}/msg/send_msg API 请求字段中 contentType 支持的消息类型说明以及消息 content 的具体字段说明。
注意

针对图片、语音、视频、文件等消息类型,需要先上传文件,获取下载地址后再发送消息。

contentType 汇总​

contentType 值类型说明
101文本消息
102图片消息
103音频消息
104视频消息
105文件消息
106@消息
109位置消息
110自定义消息

content 具体内容​

  • content 内部为 json 对象,不同的消息类型对应不同的 json 对象

contentType=101 文本消息 📜​

{
...,
"content": {
"content": "hello"
},
....
}
参数名必选类型说明
content是string文本消息的具体内容

名片消息 🏷️​

{
...,
"content": {
"userID":"",
"nickname":"",
"faceURL":"",
"ex":""
},
....
}
参数名必选类型说明
userID是string用户 ID
nickname是string用户名
faceURL是string用户头像
ex否string扩展字段

图片消息 📷​

{
...,
"content": {
"sourcePath":"",
"sourcePicture":{
"uuid":"",
"type":"",
"size":0,
"width":0,
"height":0,
"url":""
},
"bigPicture":{
"uuid":"",
"type":"",
"size":0,
"width":0,
"height":0,
"url":""
},
"snapshotPicture":{
"uuid":"",
"type":"",
"size":0,
"width":0,
"height":0,
"url":""
}
},
....
}
参数名必选类型说明
sourcePath否string图片文件本地路径
sourcePicture是object原图信息
bigPicture是object大图信息
snapshotPicture是object缩略图信息
uuid否string图片文件唯一 ID
type是string图片文件类型
size否int图片文件大小
width是int图片宽度
height是int图片高度
url是string图片下载地址,需要先上传文件

语音消息 🎤​

{
...,
"content": {
"uuid":"",
"soundPath":"",
"sourceUrl":"",
"dataSize":0,
"duration":0,
"soundType":""
},
....
}
参数名必选类型说明
uuid否string语音文件唯一 ID
soundPath否string语音文件的本地路径
sourceUrl是string语音文件下载地址,需要先上传文件
dataSize否int语音文件大小
duration是int语音时长
soundType否string语音文件类型

视频消息 📹​

{
...,
"content": {
"videoPath":"",
"videoUUID":"",
"videoUrl":"",
"videoType":"",
"videoSize":0,
"duration":0,
"snapshotPath":"",
"snapshotUUID":"",
"snapshotSize":0,
"snapshotUrl":"",
"snapshotWidth":0,
"snapshotHeight":0
},
....
}
参数名必选类型说明
videoPath否string视频文件本地路径
videoUUID否string视频文件唯一 ID
videoUrl是string视频文件下载地址,需要先上传文件
videoType是string视频文件类型
videoSize是int视频文件大小
duration是int视频时长
snapshotPath否string视频封面图文件本地路径
snapshotUUID否string视频封面图唯一 ID
snapshotSize否int视频封面图文件大小
snapshotUrl是string视频封面图文件下载地址,需要先上传文件
snapshotWidth是int视频封面图宽度
snapshotHeight是int视频封面图高度

文件消息 📁​

{
...,
"content": {
"filePath":"",
"uuid":"",
"sourceUrl":"",
"fileName":"",
"fileSize":0,
"fileType":""
},
....
}
参数名必选类型说明
filePath否string文件本地路径
uuid否string文件唯一 ID
sourceUrl是string文件下载地址,需要先上传文件
fileName是string文件名称
fileSize是int文件大小
fileType否string文件类型

表情消息 😄​

{
...,
"content":{
"index": 0,
"data": ""
},
...
}
参数名必选类型说明
index是int表情索引
data否string表情自定义 json 数据

位置消息 📍​

{
...,
"content":{
"description": "",
"longitude": 0,
"latitude": 0
},
...,
}
参数名必选类型说明
description否string位置描述
longitude是double定位经度
latitude是double定位纬度

@消息 📢​

{
...,
"content": {
"text": "",
"atUserList": ['12312'],
"isAtSelf": false,
},
....
}
参数名必选类型说明
text否string消息文本内容
atUserList是array@的用户列表
isAtSelf否boolean是否@自己

自定义消息 🖌️​

{
...,
"content": {
"data": "",
"description": "",
"extension": ""
},
....
}
参数名必选类型说明
data是string用户自定义的消息内容
description否string扩展的描述信息
extension否string扩展字段