Views: 2482
Last Modified: 23.03.2022

Sends chatbot message updates

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 18
MESSAGE Message text No Message text. Passing empty value deletes the message 18
ATTACH No Attachment 18
URL_PREVIEW Y No Convert links to rich links 18
KEYBOARD No Keyboard 18
MENU No Context menu 18

Related links:

Using keboards
Using attachments
Formatting


Calling methods and response

PHP

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

    'MESSAGE_ID' => 1,
    'MESSAGE' => 'Message text',
    'ATTACH' => '',
    'URL_PREVIEW' => 'Y',
    'KEYBOARD' => '',
    'MENU' => '',

), $_REQUEST["auth"]);

Response example

{
	"result": true
}
Result выпонения: true or error.


Response example 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
CANT_EDIT_MESSAGE You don't have access to this message or time for its edit has expired (more than 3 days has passed since publication)
ATTACH_ERROR Complete passed attachment object not validated
ATTACH_OVERSIZE Maximum permissible attachment size exceeded (30 Kb)
KEYBOARD_ERROR Complete sent keyboard object was not validated
KEYBOARD_OVERSIZE Maximum permissible keyboard size exceeded (30 Kb)
MENU_ERROR Complete passed menu object not validated
MENU_OVERSIZE Maximum permissible menu size exceeded (30 Kb)



Courses developed by Bitrix24