Views: 230 (Data available since 06.02.2017)

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

Revision: 21
Get information on the current API revision (platform version) – im.revision.get.

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 The ID for the last unread dialog 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

Attention! The method is specified with using of the restCommand function. This method is used to send data in Bitrix24 and is available in the EchoBot example as well as in this article. You can use your own function or BX24.callMethod, or bitrix24-php-sdk JavaScript methods.





Courses developed by «Bitrix», Inc.