Views: 1854
Last Modified: 23.05.2022

Update application data in chat

Attention: required fields are application ID field and one of the fields, needed for editing. If JS and IFRAME methods are called in one command, only JS method will be used.

REST-method: imbot.app.update

Method call:
$result = restCommand('imbot.app.update', Array(

   'APP_ID' => 13, // chat ID
   'FIELDS' => Array(
      'IFRAME' => 'https://marta.bitrix.info/iframe/echo.php',
       'IFRAME_WIDTH' => '350', // desired frame width. Minimum value - 250px  
       'IFRAME_HEIGHT' => '150', // desired frame height. Minimum value - 50px  
       'JS_METHOD' => 'SEND', 
       'JS_PARAM' => '/help', 
      'HASH' => 'register', // token for access to your frame, 32 symbols. 
       'ICON_FILE' => '/* base64 image */', // Your application icon - base64
       'CONTEXT' => 'BOT', // Application context
      'EXTRANET_SUPPORT' => 'N', // Extranet users command accessibility, by default ā€˜Nā€™      
       'LIVECHAT_SUPPORT' => 'N', // Online chat support
      'IFRAME_POPUP' => 'N', // iframe will open and will be able to move inside the messenger, transition between dialogues will not close such window
      'LANG' => Array( // translations array; it is preferably to indicate minimum for EN          Array('LANGUAGE_ID' => 'en', 'TITLE' => 'Chatbot IFRAME', 'DESCRIPTION' => 'Open Chatbot IFRAME app', 'COPYRIGHT' => 'Bitrix24'), 
      )
   )
), $_REQUEST["auth"]);
Return: true or an error.

Possible errors:

Error codeError description
CHAT_APP_ID_ERROR Application not found.
APP_ID_ERROR Application for chat is not part of this REST-application, you can work with application for chat, installed within current REST-application framework.
IFRAME_HTTPS Link to IFRAME must be specified to site with active HTTPS-certificate.
WRONG_REQUEST Something went wrong.



Courses developed by Bitrix24