通过群组开放能力,第三方系统可以在后台做以下事情:
同时,配合移动端轻应用和扫码能力,可实现在H5页面中打开群聊界面,也可实现扫描二维码查看消息历史聊天记录。
云之家群组开放接口都需要通过云之家OAuth2.0授权协议进行授权,授权级别为resGroupSecret级,授权方式为在接口请求URL后面添加accessToken参数,例如https://www.yunzhijia.com/gateway/xtinterface/group/createGroup?accessToken=xxxxxx
HTTPS
https://www.yunzhijia.com/gateway/
POST
Content-Type: application/json
URL: /xtinterface/group/createGroup?accessToken=xxx
输入参数:
{
"groupName": "讨论组",
"currentUid":"5b503ee9e4b02abb5318b23e",
"userIds":[
"5b6cea82e4b05df05b3efc2b",
"5bee6706e4b073e587c144ae",
"5b50428ce4b091389c3b3777"
]
}
参数说明:
| 字段 | 类型 | 必须 | 说明 |
|---|---|---|---|
| currentUid | String | 是 | 创建者的用户id |
| groupName | String | 否 | 组名称 如果不指定会以参与人作为组名 |
| userIds | Array | 是 | 除了创建者的其它组员id |
成功返回:
{
"data": {
"groupId": "5bee7172e4b0f6bbaa32b4bf",
"groupName": "讨论组",
"groupType": 2,
"status": 1059
},
"error": null,
"errorCode": 0,
"success": true
}
URL: /xtinterface/group/addGroupUser?accessToken=xxx
输入参数:
{
"currentUid": "5b503ee9e4b02abb5318b23e",
"groupId": "5bee7172e4b0f6bbaa32b4bf",
"userIds": [
"5b90c663e4b0216ee04a768c"
]
}
参数说明:
| 字段 | 类型 | 必须 | 说明 |
|---|---|---|---|
| currentUid | String | 是 | 当前操作者的用户id |
| groupId | String | 是 | 群组id |
| userIds | Array | 是 | 需要添加的组员id |
成功返回:
{
"data": {
"groupId": "5bee7172e4b0f6bbaa32b4bf",
"groupName": "讨论组",
"groupType": 2,
"status": 1059
},
"error": null,
"errorCode": 0,
"success": true
}
URL: /xtinterface/notice/create?accessToken=xxx
输入参数:
{
"currentUid": "5b503ee9e4b02abb5318b23e",
"groupId": "5bee7172e4b0f6bbaa32b4bf",
"title": "群公告标题",
"content": "群公告内容"
}
参数说明:
| 字段 | 类型 | 必须 | 说明 |
|---|---|---|---|
| currentUid | String | 是 | 当前操作者的用户id |
| groupId | String | 是 | 群组id |
| title | String | 是 | 群公告标题(字数为1-40个字符) |
| content | String | 是 | 群公告内容(字数为1-2000个字符) |
成功返回:
{
"success": true,
"error": null,
"data": {
"noticeId": "5bee684de4b090102edd7509", //公告ID
"creator": "张三",
"title": "群公告标题",
"content": "群公告内容",
"createTime": 1542350925132
},
"errorCode": 0
}
URL: /xtinterface/banner/create?accessToken=xxx
输入参数:
{
"currentUid":"5b46b09be4b08bc0c5646ff7",
"groupId": "5bece07d84ae7a938d0dba5f",
"params":{
"content":"string",
"title":"string",
"lightAppId":"string",
"thumbUrl":"string",
"webpageUrl":"string",
"primaryContent":"string",
"contentUrl":"string"
}
}
参数说明:
| 字段 | 类型 | 必须 | 说明 |
|---|---|---|---|
| lightAppId | String | 否 | 轻应用id |
| thumbUrl | String | 否 | 缩略图url |
| webpageUrl | String | 否 | 点击打开的url,支持所有通用Schema |
| primaryContent | String | 否 | 主要内容 |
| contentUrl | String | 否 | 内容图表url,有此值时优先显示图表 |
成功返回:
{
"success": true,
"error": null,
"data":{
"bannerId": "5befb02060b2c390d28d6cdb"
},
"errorCode": 0
}
URL: /xtinterface/message/merge/createForCloudflow?accessToken=xxx
输入参数:
{
"groupId":"5be930f284ae59e625a7034e",
"currentUid":"5b46b09be4b08bc0c5646ff7"
}
参数说明:
| 字段 | 类型 | 必须 | 说明 |
|---|---|---|---|
| currentUid | String | 是 | 当前操作者的用户id |
| groupId | String | 是 | 群组id |
成功返回:
{
"error": "no error",
"data": "5bed0bc884aeb31c68b7c97f", //合并消息历史记录的mergeId
"errorCode": 200,
"success": true
}
URL: https://www.yunzhijia.com/gateway/xtinterface/group/groupUsers?accessToken=xxx
请求参数:
{
"currentUid":"5b6bf2a7e4b0fbba1110125c",
"groupId": "5c11fb86e4b03461235eef6f"
}
成功返回:
{
"data": {
"managerIds": [
"5b6bf2a7e4b0fbba1110125c"
],
"participantIds": [
"5b6bf2a7e4b0fbba1110125c",
"5b90bd35e4b0aaccb6c1ce2d",
"5b8ce9bae4b0aaccb6c0e55e"
]
},
"success": true,
"errorCode": 0
}
返回值参数说明:
| 字段 | 说明 |
|---|---|
| managerIds | 群组管理员的用户id |
| participantIds | 群组所有成员用户id |
如需在云之家移动端打开后台创建的该群组的群聊界面,可使用JS-API的【chat】方法,文档见JS-API说明。
地址为:https://www.yunzhijia.com/imbu/chat/history.html?mid=xxx&eid=xxx,使用此地址生成二维码图片,然后用云之家移动端扫一扫功能扫描该二维码,即可查看消息历史记录。其中,参数说明如下: