Views: 2224
Last Modified: 22.09.2020

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

Revision: 21

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


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 recent read chat message 21

Method call and response


BX24.callMethod('', {
  'DIALOG_ID': chat29,
  'MESSAGE_ID': 12,
}, function(result){


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

Response example

  "result": true
        dialogId: "chat76", 
        chatId: 76, 
        counter: 1, 
        lastId: 6930
  • dialogId – read chat ID
  • chatId – chat ID
  • counter – number of unread messages after method execution
  • lastId – recent read message

When method is unable to set new read tag:

 "result": false

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 – brief error 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 Bitrix24