消息详细类型描述文档
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"
},
....
}
参数名 | 必选 | 类型 | 说明 |
---|---|---|---|
content | 是 | string | 文本消息的具体内容 |
名片消息
{
...,
"content": {
"userID":"",
"nickname":"",
"faceURL":"",
"ex":""
},
....
}
参数名 | 必选 | 类型 | 说明 | |
---|---|---|---|---|
userID | string | 是 | 用户 ID | |
nickname | string | 是 | 用户名 | |
faceURL | int | 是 | 用户头像 | |
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 | 否 | json string | 消息 |
atUserList | 是 | json string[] | @的用户列表 |
isAtSelf | 否 | json 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
},
....
}
参数名 | 必选 | 类型 | 说明 |
---|---|---|---|
description | 否 | json string | 扩展的描述信息为 json 对象转换后的 string |
longitude | 是 | json number | 经度 |
latitude | 是 | json number | 纬度 |
自定义消息
{
...,
"content": {
"data": "",
"description": "",
"extension": ""
},
....
}
参数名 | 必选 | 类型 | 说明 |
---|---|---|---|
data | 是 | json string | 用户自定义的消息为 json 对象转换后的 string |
description | 否 | json string | 扩展的描述信息为 json 对象转换后的 string,可以不使用 |
extension | 否 | json 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": ""
},
....
}
参数名 | 必选 | 类型 | 说明 |
---|---|---|---|
notificationName | string | 是 | 通知标题 |
notificationFaceURL | string | 否 | 通知头像 |
notificationType | int | 是 | 通知类型,如:1 代表入职通知,2 代表离职通知... |
text | string | 是 | 通知正文 e |
externalUrl | string | 否 | 通知点击后需要跳转到的地址链接(不填则无需跳转) |
mixType | int | 是 | 通知混合类型 0:纯文字通知 1:文字+图片通知 2:文字+视频通知 3:文字+文件通知 4: 文字+语音通知 5: 文字+语音+图片通知 |
pictureElem | object | 否 | 图片元素对象 |
sourcePicture | object | 否 | 原图 |
bigPicture | object | 否 | 大图 |
snapshotPicture | object | 否 | 缩略图 |
soundElem | object | 否 | 声音元素 |
videoElem | object | 否 | 视频元素 |
fileElem | object | 否 | 文件元素 |
ex | string | 否 | 扩展字段 |