Views: 2508
Last Modified: 09.10.2024
Updates data in command
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.
Note: Command processing requires for application to process a command-adding event
ONIMCOMMANDADD.
Method call
$result = restCommand('imbot.command.update', Array(
'COMMAND_ID' => 13, // Chat ID
'FIELDS' => Array(
'EVENT_COMMAND_ADD' => 'http://www.hazz/chatApi/bot.php', // Link to command handler
'HIDDEN' => 'N', // Command is hidden or not
'EXTRANET_SUPPORT' => 'N', // Extranet users command access
'CLIENT_ID' => '', // Chatbot string ID, used only in Webhooks mode
'LANG' => Array( // New translation phrases, all previous will be deleted
Array('LANGUAGE_ID' => 'en', 'TITLE' => 'Get echo message', 'PARAMS' => 'some text'),
),
)
), $_REQUEST["auth"]);
Required fields: command ID and one of required fields for editing.
Return:
true
or error.
Possible error codes
Code |
Description |
COMMAND_ID_ERROR |
Command not found. |
APP_ID_ERROR |
Chatbot is not a part of this application: you can only work with chatbots, installed within application framework. |
EVENT_COMMAND_ADD |
Link to event handler invalid or not specified. |
WRONG_REQUEST |
Something went wrong. |
|