Views: 2629
Last Modified: 12.09.2024

Sends "Chatbot is typing a message..."

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: These methods of message processing are usually employed when the user is typing something, that is why the ONIMBOTMESSAGEADD event must be processed.

Method call

$result = restCommand('imbot.chat.sendTyping', Array(

    'BOT_ID' => 39, // ID of chatbot that sends request. Is optional, there is only one chatbot
    'DIALOG_ID' => 1, // Dialogue ID, it is either USER_ID, or chatXX – where XX is chat ID, transmitted in events ONIMBOTMESSAGEADD and ONIMJOINCHAT

), $_REQUEST["auth"]);

Return:

true or error.

Related links:

Possible error codes

Code Description
BOT_ID_ERROR Chatbot not found.
DIALOG_ID_EMPTY Dialogue ID not transmitted.




Courses developed by Bitrix24