Browse Platform API
Platform API

Set conversations

Copy

Use Set conversations to apply the same conversation settings to multiple users, including receive options, pinned state, extensions, and message-destruction settings.

HTTP request

POST {API_ADDRESS}/conversation/set_conversations

Request example

curl --request POST "${API_ADDRESS}/conversation/set_conversations" \
  --header "Content-Type: application/json; charset=utf-8" \
  --header "operationID: ${OPERATION_ID}" \
  --header "token: ${ADMIN_TOKEN}" \
  --data-raw '{
  "userIDs": [
    "user_001",
    "user_003"
  ],
  "conversation": {
    "conversationID": "si_user_001_user_002",
    "conversationType": 1,
    "userID": "user_002",
    "groupID": "",
    "recvMsgOpt": 0,
    "isPinned": true,
    "attachedInfo": "",
    "isPrivateChat": false,
    "ex": "",
    "burnDuration": 0,
    "minSeq": 0,
    "maxSeq": 128,
    "groupAtType": 0,
    "msgDestructTime": 0,
    "isMsgDestruct": false
  }
}'
Keep administrator tokens on trusted backend services only. Client applications should use user tokens issued by your backend.

Request body

{
  "userIDs": [
    "user_001",
    "user_003"
  ],
  "conversation": {
    "conversationID": "si_user_001_user_002",
    "conversationType": 1,
    "userID": "user_002",
    "groupID": "",
    "recvMsgOpt": 0,
    "isPinned": true,
    "attachedInfo": "",
    "isPrivateChat": false,
    "ex": "",
    "burnDuration": 0,
    "minSeq": 0,
    "maxSeq": 128,
    "groupAtType": 0,
    "msgDestructTime": 0,
    "isMsgDestruct": false
  }
}
ParameterRequiredTypeDescription
userIDsYesarrayList of OpenIM user IDs.
conversationYesobjectConversation fields to apply. See ConversationInfo.
conversation.conversationIDYesstringOpenIM conversation ID.
conversation.conversationTypeYesintConversation type. See ConversationType.
conversation.userIDNostringPeer user ID; required for a single conversation.
conversation.groupIDNostringGroup ID; required for a group conversation.
conversation.recvMsgOptNointReceive option. See RecvMsgOpt.
conversation.isPinnedNobooleanWhether the conversation is pinned.
conversation.attachedInfoNostringConversation attachment data.
conversation.isPrivateChatNobooleanWhether private-chat behavior is enabled.
conversation.exNostringBusiness extension field.
conversation.burnDurationNointBurn-after-reading duration in seconds.
conversation.minSeqNointMinimum message sequence number.
conversation.maxSeqNointMaximum message sequence number.
conversation.groupAtTypeNointGroup mention state. See GroupAtType.
conversation.msgDestructTimeNointMessage destruction time setting.
conversation.isMsgDestructNobooleanWhether message destruction is enabled.
conversation.isMarked EnterpriseNobooleanWhether the user marks this conversation.
conversation.remark EnterpriseNostringUser-specific conversation remark.

Response

OpenIM usually returns 200 OK when the request reaches the service. Use errCode in the JSON response to determine business success; errCode === 0 means the operation succeeded.

{
  "errCode": 0,
  "errMsg": "",
  "errDlt": ""
}

Response fields

FieldTypeDescription
errCodeintBusiness error code. 0 means success.
errMsgstringShort error message.
errDltstringDetailed error information for troubleshooting.

Error response

When a request fails, OpenIM returns the same error envelope. See Error codes for the full handling model.

{
  "errCode": 1004,
  "errMsg": "RecordNotFoundError",
  "errDlt": ": [1004]RecordNotFoundError"
}
ScenarioPossible causeRecommended action
Authentication failedtoken is missing, expired, or not an administrator token.Issue a new administrator token and keep it on the backend.
Traceability is weakoperationID is missing or reused across many requests.Generate a unique operationID for every request and log it with the response.
Validation failedThe request body has an invalid type, missing field, or unsupported enum value.Compare the payload with the request table and retry after correcting the fields.

Permissions and limits

  • Supply conversation.userID for a single conversation and conversation.groupID for a group conversation.
  • A successful request means the settings were updated; conversation change notifications may then be delivered to affected clients.
  • isMarked and remark are available in OpenIM Enterprise.