跳到主要内容

消息详细类型描述文档

ContentType

简要描述

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

ContentType 消息类型说明

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

Content 具体内容

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

文本消息

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

名片消息

{
...,
"content": {
"userID":"",
"nickname":"",
"faceURL":"",
"ex":""
},
....
}
参数名必选类型说明
userIDstring用户 ID
nicknamestring用户名
faceURLint用户头像
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,
},
....
}
参数名必选类型说明
textjson string消息
atUserListjson string[]@的用户列表
isAtSelfjson string是否@自己

位置消息

Description string mapstructure:"description" Longitude float64 mapstructure:"longitude" validate:"required" Latitude float64 mapstructure:"latitude" validate:"required"

{
...,
"content": {
"description": "",
"longitude": 1.1,
"latitude": 1.1
},
....
}
参数名必选类型说明
descriptionjson string扩展的描述信息为 json 对象转换后的 string
longitudejson number经度
latitudejson number纬度

自定义消息

{
...,
"content": {
"data": "",
"description": "",
"extension": ""
},
....
}
参数名必选类型说明
datajson string用户自定义的消息为 json 对象转换后的 string
descriptionjson string扩展的描述信息为 json 对象转换后的 string,可以不使用
extensionjson string扩展字段,暂时不使用

系统通知消息

系统通知消息作为一种特别的自定义通知消息,客户端会产生一个独立的会话,固定的会话类型为 4,其中发送者 ID 必须为为后台 config 文件中配置的管理员 ID 中一个。

{
...,
"content": {
"notificationName": "公文管理",
"notificationFaceURL": "http://www.head1.com",
"notificationType": 1,
"text": "大家好,今天是...",
"externalUrl":"",
"mixType": 0,
"pictureElem": {
"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": ""
}
},
"soundElem": {
"uuid": "",
"soundPath": "",
"sourceUrl": "",
"dataSize": 0,
"duration": 0
},
"videoElem": {
"videoPath": "",
"videoUUID": "",
"videoUrl": "",
"videoType": "",
"videoSize": 0,
"duration": 0,
"snapshotPath": "",
"snapshotUUID": "",
"snapshotSize": 0,
"snapshotUrl": "",
"snapshotWidth": 0,
"snapshotHeight": 0
},
"fileElem": {
"filePath": "",
"uuid": "",
"sourceUrl": "",
"fileName": "",
"fileSize": 0
},
"ex": ""
},
....
}
参数名必选类型说明
notificationNamestring通知标题
notificationFaceURLstring通知头像
notificationTypeint通知类型,如:1 代表入职通知,2 代表离职通知...
textstring通知正文 e
externalUrlstring通知点击后需要跳转到的地址链接(不填则无需跳转)
mixTypeint通知混合类型
0:纯文字通知
1:文字+图片通知
2:文字+视频通知
3:文字+文件通知
4: 文字+语音通知
5: 文字+语音+图片通知
pictureElemobject图片元素对象
sourcePictureobject原图
bigPictureobject大图
snapshotPictureobject缩略图
soundElemobject声音元素
videoElemobject视频元素
fileElemobject文件元素
exstring扩展字段