Views: 2883
Last Modified: 23.03.2022

Modifies the 'message read' status: all messages after the specified message (but including the message itself) are marked as unread

Revision Get current information about current API revision (platform version) – im.revision.get : 18

Attention: restCommand function is used here for illustration purposes only. It is taken from the EchoBot example. You can send a REST command with your own function, or use the BX24.callMethod or bitrix24-php-sdk methods.

Parameters

Parameter Example Req. Description Revision
DIALOG_ID chat29 Yes Dialog ID (chatXXX for chat and user ID for private dialog) 21
MESSAGE_ID 12 Yes Dialog ID. Format:
chatXXX – recipient chat in case of chat message
or XXX – recipient ID, in case of private conversation message
21

Method call

JavaScript

BX24.callMethod('im.dialog.unread', {
  'DIALOG_ID': chat29,
  'MESSAGE_ID': 12,
}, function(result){
  if(result.error())
  {
    console.error(result.error().ex);
  }
  else
  {
    console.log(result.data());
  }
});

PHP

$result = restCommand('im.dialog.unread', Array(
  'DIALOG_ID' => chat29,
  'MESSAGE_ID' => 12,  
), $_REQUEST["auth"]);

Response example

{
  "result": true
} 

Examples of response with error

{
    "error": "MESSAGE_ID_ERROR",
    "error_description": "Message ID can't be empty"
}

Description of keys:

  • error – error code
  • error_description – error brief description

Possible error codes

Code Description
MESSAGE_ID_ERROR Incorrect message ID
DIALOG_ID_EMPTY Incorrect dialog ID



Courses developed by Bitrix24