Last Modified: 13.05.2022
Publishes response to command
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
Command processing requires for application to process a command-adding event ONIMCOMMANDADD
$result = restCommand('imbot.command.answer', Array(
'COMMAND_ID' => 13, // ID for command that prepared the report, (required to be specified or COMMAND)
'COMMAND' => 'echo', // Name of command that prepared the answer (required to be specified or COMMAND_ID)
'MESSAGE_ID' => 1122, // ID for message that requires an answer
'MESSAGE' => 'answer text' // Answer text
'ATTACH' => '' // Attachment, optional field
'KEYBOARD' => '' // Keyboard, optional field
'MENU' => '' // Context menu, optional field
'SYSTEM' => 'N' // Display messages as system message, optional field, 'N' by default
'URL_PREVIEW' => 'Y' // Convert links to rich-links, optional field, 'Y' by default
'CLIENT_ID' => '', // Chatbot string ID, used only in Webhooks mode
MESSAGE_ID or error.
Possible error codes
||Command not found.
||Chatbot is not part of this application: you can only work with chatbots, installed within application frameworkприложения.
||Message text is not transmitted.
||Complete transmitted attachment object was not validated.
||Maximum permissible attachment size was exceeded (30 Kb).
||Complete transmitted keyboard object was not validated.
||Maximum permissible keyboard size was exceeded (30 Kb).
||Complete transmitted object menu was not validated.
||Maximum permissible menu size was exceeded (30 Kb).
||Something went wrong.