Views: 5499
Last Modified: 22.12.2023

This example includes SDK CRest and an event handler file. You have to upload the files extracted from the archive to your web server prior to installing the application on your Bitrix24. This application will create on your Bitrix24 a chatbot capable of responding to user requests.

Important! This example uses SDK CRest. You have to open the checkserver.php you have uploaded to the server in your browser to make sure your server configuration is correct. Learn more.

Download archive:

Bitrix24 chatbot is not a separate "type" of applications. Chatbots can be part of any server-side application that implements logic for one or more chatbots using the REST API. Employing REST to implement a chatbot can even make full OAuth 2.0 authorization required from Bitrix24 GUI-less applications unnecessary in some cases.

To install the local application, go to: Applications 1 - Developer resources 2 - Other 3 - Local application 4:

In the Add Application form, fill out the required fields and select the required permissions. You have to select the user management permission. Enter Your handler path - your application has to be available on the remote server via HTTPS before adding it to your Bitrix24.

Make sure you check the Script only option to inform the system that your application will not add any pages or dialog boxes to the Bitrix24 user interface. This option also hides input field(s) you normally use to enter the menu item name. GUI-less applications typically use a different URL to provide user interface, or don't provide it at all.

Note the field Initial installation path field. This URL will be called only once when saving the local application form. The system uses this URL to send the ONAPPINSTALL, event the script uses to add a chatbot to Bitrix24. If you ever want to reinstall the chatbot, open the Applications page and select the Reinstall option (or delete it and add it again).

If the application is reinstalled from the Applications page, the system initiates this event which calls a procedure in the install.php file to obtain the bot code.
When the application is deleted, all the bots created by the application are also deleted, which effectively means a new bot will be registered when the application is reinstalled.

After saving the form, the application will be available in the Local Applications list in your Bitrix24. You can use the Search function to find the bot by the name: Bot Example:

After you click Save, the application will be available in the Local Applications list in your Bitrix24:

To send a message to the chatbot, click the bot name in the public chat. Our example bot is rather plain, it responds with any text it receives:




Courses developed by Bitrix24