设置群组信息之前的回调
功能说明
App 业务服务端可以通过该回调在设置群组信息之前进行干预。这使得业务服务端可以在实际修改群组信息前,对请求进行审核或修改。
注意事项
- 为启用回调,必须配置回调 URL,并开启本条回调协议对应的开关。配置方法详见 回调说明 文档。
- 回调的方向是 OpenIMServer 向 App 后台发起 HTTP/HTTPS POST 请求。
- APP 业务服务端需在超时时间内响应此请求。
可能触发该回调的场景
- App 用户通过客户端请求修改群组信息。
- App 管理员通过 REST API 修改群组信息。
回调发生时机
- OpenIMServer 收到设置群组信息的请求之后,处理该请求前。
接口说明
请求 URL 示例
以下示例中 App 配置的回调 URL 为 http://www.example.com/callbackCommand?contenttype=json
。
http://www.example.com/setGroupInfoBeforeCommand?contenttype=json
请求参数说明
参数 | 说明 |
---|---|
http | 请求协议为 HTTP,请求方式为 POST |
www.example.com | configy.yaml 中的 callback.url 字段,域名或主机名 |
CallbackCommand | 此处为:setGroupInfoBeforeCommand |
contenttype | 固定值为:JSON |
Header
header名 | 示例值 | 选填 | 类型 | 说明 |
---|---|---|---|---|
operationID | 1646445464564 | 必填 | string | operationID用于全局链路追踪 |
请求包示例
{
"callbackCommand": "setGroupInfoBeforeCommand",
"groupInfoForSet": {
"groupID": "G002",
"groupName": "NewGroupName",
"notification": "Updated group notification",
"introduction": "Updated group introduction",
"faceURL": "http://example.com/new/path/to/face/image.png",
"ex": {
"value": "Updated extra data"
},
"needVerification": {
"value": 0
},
"lookMemberInfo": {
"value": 1
},
"applyMemberFriend": {
"value": 0
}
}
}
请求包字段说明
字段 | 类型 | 描述 |
---|---|---|
callbackCommand | string | 回调命令,这里为设置群组信息之前的回调 |
groupInfoForSet | object | 包含要设置的群组信息的对象 |
groupID | string | 群组的唯一标识符 |
groupName | string | 群组的名称 |
notification | string | 群组的通知信息 |
introduction | string | 群组的简介 |
faceURL | string | 群组的图标的URL |
ex | StringValue | 额外的数据字段 |
needVerification | Int32Value | 是否需要验证加入群组 |
lookMemberInfo | Int32Value | 是否可以查看群成员信息 |
applyMemberFriend | Int32Value | 是否可以申请加群成员为好友 |
应答包示例
允许修改
允许修改群组信息。
{
"actionCode": 0,
"errCode": 0,
"errMsg": "Success",
"errDlt": "",
"nextCode": "nextCodeValue",
"groupInfoForSet": {
"groupID": "G002",
"groupName": "NewGroupName",
"notification": "Updated group notification",
"introduction": "Updated group introduction",
"faceURL": "http://example.com/new/path/to/face/image.png",
"ex": {
"value": "Updated extra data"
},
"needVerification": {
"value": 0
},
"lookMemberInfo": {
"value": 1
},
"applyMemberFriend": {
"value": 0
}
}
}
应答包字段说明
字段 | 类型 | 描述 |
---|---|---|
actionCode | 0 | 表示业务系统的回调是否正确执行。0 表示操作成功。 |
errCode | 5001 | 表示自定义错误码,范围在5000-9999之间。在 actionCode 不等于0时设置;在 nextCode 等于1时设置。 |
errMsg | "An error message" | 自定义错误码对应的简单错误信息。 |
errDlt | "Detailed error information" | 自定义错误码对应的详细错误信息。 |
nextCode | 1 | 下一步执行指令,1 表示拒绝继续执行,actionCode 等于0 时设置。 |
groupID | string | 群组的唯一标识符 |
groupName | string | 群组的名称 |
notification | string | 群组的通知信息 |
introduction | string | 群组的简介 |
faceURL | string | 群组的图标的URL |
ex | StringValue | 额外的数据字段 |
needVerification | Int32Value | 是否需要验证加入群组 |
lookMemberInfo | Int32Value | 是否可以查看群成员信息 |
applyMemberFriend | Int32Value | 是否可以申请加群成员为好友 |