跳到主要内容

消息中 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"
},
....
}
参数名必选类型说明
contentstring文本消息的具体内容

名片消息 🏷️

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

图片消息 📷

{
...,
"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":""
}
},
....
}
参数名必选类型说明
sourcePathstring图片文件本地路径
sourcePictureobject原图信息
bigPictureobject大图信息
snapshotPictureobject缩略图信息
uuidstring图片文件唯一 ID
typestring图片文件类型
sizeint图片文件大小
widthint图片宽度
heightint图片高度
urlstring图片下载地址,需要先上传文件

语音消息 🎤

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

视频消息 📹

{
...,
"content": {
"videoPath":"",
"videoUUID":"",
"videoUrl":"",
"videoType":"",
"videoSize":0,
"duration":0,
"snapshotPath":"",
"snapshotUUID":"",
"snapshotSize":0,
"snapshotUrl":"",
"snapshotWidth":0,
"snapshotHeight":0
},
....
}
参数名必选类型说明
videoPathstring视频文件本地路径
videoUUIDstring视频文件唯一 ID
videoUrlstring视频文件下载地址,需要先上传文件
videoTypestring视频文件类型
videoSizeint视频文件大小
durationint视频时长
snapshotPathstring视频封面图文件本地路径
snapshotUUIDstring视频封面图唯一 ID
snapshotSizeint视频封面图文件大小
snapshotUrlstring视频封面图文件下载地址,需要先上传文件
snapshotWidthint视频封面图宽度
snapshotHeightint视频封面图高度

文件消息 📁

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

表情消息 😄

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

位置消息 📍

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

@消息 📢

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

自定义消息 🖌️

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