浏览 平台 API
服务端 API商业版

创建群聊会话前

复制

在首次创建群聊会话前调整会话默认属性。 此回调仅在 OpenIM 商业版中提供。

触发时机

项目说明
类型前置回调
配置项beforeCreateGroupChatConversations
回调命令callbackBeforeCreateGroupChatConversationsCommand

HTTP 请求

POST {WEBHOOK_ADDRESS}/callbackBeforeCreateGroupChatConversationsCommand
Content-Type: application/json
operationID: {OPERATION_ID}
{
  "callbackCommand": "callbackBeforeCreateGroupChatConversationsCommand",
  "owner_user_id": "user_001",
  "conversation_id": "si_user_001_user_002",
  "conversation_type": 1,
  "group_id": "group_001",
  "recv_msg_opt": 1,
  "is_pinned": false,
  "is_marked": false,
  "is_private_chat": false,
  "burn_duration": 1,
  "group_at_type": 1,
  "attached_info": "",
  "ex": ""
}

请求体参数

参数名是否必填类型说明
callbackCommandstring回调命令,值与当前页面的回调命令一致。
owner_user_idstring会话所属用户 ID。
conversation_idstring会话 ID。
conversation_typeint会话类型。
group_idstring群组 ID。
recv_msg_optint会话消息接收选项。
is_pinnedboolean是否置顶会话。
is_markedboolean是否标记会话。
is_private_chatboolean是否为阅后即焚会话。
burn_durationint阅后即焚时长。
group_at_typeint群会话 @ 提醒类型。
attached_infostring会话附加信息。
exstring业务扩展字段。

响应

业务服务端应返回 HTTP 成功状态和 JSON 响应体。

{
  "actionCode": 0,
  "errCode": 0,
  "errMsg": "",
  "errDlt": "",
  "nextCode": 0,
  "recv_msg_opt": 1,
  "is_pinned": false,
  "is_marked": false,
  "is_private_chat": false,
  "burn_duration": 1,
  "group_at_type": 1,
  "attached_info": "",
  "ex": ""
}

响应参数

参数名类型说明
actionCodeint处理状态,参见Webhooks 概述的 CallbackAction
errCodeint业务错误码;拒绝前置操作时返回业务约定的非零错误码。
errMsgstring错误简要信息。
errDltstring错误详细信息。
nextCodeint处理下一步,参见Webhooks 概述的 CallbackNextCode
recv_msg_optint会话消息接收选项。
is_pinnedboolean是否置顶会话。
is_markedboolean是否标记会话。
is_private_chatboolean是否为阅后即焚会话。
burn_durationint阅后即焚时长。
group_at_typeint群会话 @ 提醒类型。
attached_infostring会话附加信息。
exstring业务扩展字段。

处理规则

  • OpenIM 同步等待业务服务端响应。
  • 返回 nextCode: 0 时继续原流程;返回 nextCode: 1 时,OpenIM 使用响应中的错误信息终止本次操作。
  • 请求失败或超时后的行为由该回调的 failedContinue 配置决定。
  • 响应中的业务字段仅在对应字段存在时覆盖 OpenIM 即将处理的数据。

相关页面