Views: 1559
Last Modified: 23.03.2022

Sets "like"

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 Required Description Revision
MESSAGE_ID 1 Yes Message ID (any message sent in private conversations or group chats with chatbot available) 18
ACTION auto No Action, associated with the method: plus - set the "Like"; minus - removes the "Like"; auto - automatically calculates if the Like is to be set. When parameter is not specified, operates in auto mode 18

Called method and response

PHP

$result = restCommand('im.message.like', Array(

    'MESSAGE_ID' => 1,
    'ACTION' => 'auto',

), $_REQUEST["auth"]);

Example response

{
	"result": true
}
Result: true or error.


Example of response on error

{
    "error": "MESSAGE_ID_ERROR",
    "error_description": "Message ID not passed"
}

Key description:

  • error – error code
  • error_description – error brief description

Possible error codes

Code Description
MESSAGE_ID_ERROR Message ID not passed
WITHOUT_CHANGES "Like" status didn't change after the call



Courses developed by Bitrix24