服务端 API
创建群组前
在创建群组前校验或调整群资料和初始成员。
触发时机
| 项目 | 说明 |
|---|---|
| 类型 | 前置回调 |
| 配置项 | beforeCreateGroup |
| 回调命令 | callbackBeforeCreateGroupCommand |
HTTP 请求
POST {WEBHOOK_ADDRESS}/callbackBeforeCreateGroupCommand
Content-Type: application/json
operationID: {OPERATION_ID}{
"operationID": "operation_001",
"callbackCommand": "callbackBeforeCreateGroupCommand",
"groupID": "group_001",
"groupName": "group_001",
"notification": "",
"introduction": "",
"faceURL": "https://example.com/avatar.png",
"ownerUserID": "user_001",
"createTime": 1719800000000,
"memberCount": 1,
"ex": "",
"status": 1,
"creatorUserID": "user_001",
"groupType": 1,
"needVerification": 1,
"lookMemberInfo": 1,
"applyMemberFriend": 1,
"notificationUpdateTime": 1719800000000,
"notificationUserID": "user_001",
"displayIsRead": false,
"muteBypassUserIDs": ["user_001"],
"initMemberList": [
{
"userID": "user_001",
"roleLevel": 100
}
]
}请求体参数
| 参数名 | 是否必填 | 类型 | 说明 |
|---|---|---|---|
| operationID | 是 | string | OpenIM 操作的链路追踪 ID。 |
| callbackCommand | 是 | string | 回调命令,值与当前页面的回调命令一致。 |
| groupID | 是 | string | 群组 ID。 |
| groupName | 是 | string | 群组名称。 |
| notification | 是 | string | 群公告。 |
| introduction | 是 | string | 群简介。 |
| faceURL | 是 | string | 头像地址。 |
| ownerUserID | 是 | string | 会话或关系所属用户 ID。 |
| createTime | 是 | int | createTime 字段。 |
| memberCount | 是 | int | memberCount 字段。 |
| ex | 是 | string | 业务扩展字段。 |
| status | 是 | int | status 字段。 |
| creatorUserID | 是 | string | 群创建者用户 ID。 |
| groupType | 是 | int | 群组类型。 |
| needVerification | 是 | int | 入群验证方式。 |
| lookMemberInfo | 是 | int | 是否允许普通成员查看群成员资料。 |
| applyMemberFriend | 是 | int | 是否允许普通成员添加群成员为好友。 |
| notificationUpdateTime | 是 | int | 群公告更新时间。 |
| notificationUserID | 是 | string | 最后更新群公告的用户 ID。 |
| displayIsRead 商业版 | 是 | boolean | 是否展示群消息已读状态。 |
| muteBypassUserIDs 商业版 | 是 | string[] | 全群禁言时仍可发送消息的用户 ID 列表。 |
| initMemberList | 否 | object[] | 创建群组时提交的初始成员列表。 |
响应
业务服务端应返回 HTTP 成功状态和 JSON 响应体。
{
"actionCode": 0,
"errCode": 0,
"errMsg": "",
"errDlt": "",
"nextCode": 0,
"groupID": "group_001",
"groupName": "group_001",
"notification": "",
"introduction": "",
"faceURL": "https://example.com/avatar.png",
"ownerUserID": "user_001",
"ex": "",
"status": 1,
"creatorUserID": "user_001",
"groupType": 1,
"needVerification": 1,
"lookMemberInfo": 1,
"applyMemberFriend": 1
}响应参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| actionCode | int | 处理状态,参见Webhooks 概述的 CallbackAction。 |
| errCode | int | 业务错误码;拒绝前置操作时返回业务约定的非零错误码。 |
| errMsg | string | 错误简要信息。 |
| errDlt | string | 错误详细信息。 |
| nextCode | int | 处理下一步,参见Webhooks 概述的 CallbackNextCode。 |
| groupID | string | 群组 ID。 |
| groupName | string | 群组名称。 |
| notification | string | 群公告。 |
| introduction | string | 群简介。 |
| faceURL | string | 头像地址。 |
| ownerUserID | string | 会话或关系所属用户 ID。 |
| ex | string | 业务扩展字段。 |
| status | int | status 字段。 |
| creatorUserID | string | 群创建者用户 ID。 |
| groupType | int | 群组类型。 |
| needVerification | int | 入群验证方式。 |
| lookMemberInfo | int | 是否允许普通成员查看群成员资料。 |
| applyMemberFriend | int | 是否允许普通成员添加群成员为好友。 |
处理规则
- OpenIM 同步等待业务服务端响应。
- 返回
nextCode: 0时继续原流程;返回nextCode: 1时,OpenIM 使用响应中的错误信息终止本次操作。 - 请求失败或超时后的行为由该回调的
failedContinue配置决定。 - 响应中的业务字段仅在对应字段存在时覆盖 OpenIM 即将处理的数据。
相关页面
这个页面有帮助吗?