How to develop an application

Lesson 15 out of 29

To showcase your application on Bitrix24.Market, it is essential to have access to developer area. The first step necessitates the technical specifications of your solution, while the publishing stage requires marketing materials.

How to develop an application

5 min

To initiate the process, click on the "New Application" button and choose the principal region for the solution's future publication. You can publish your app in other regions later.

In the solution form, press the "Create" button to create the first version of your app.

Select the type of application:

This is typically a web service that operates via the Bitrix24 REST API, except for low-code solutions and static applications covered in other lessons.

Having determined the REST methods with which your application will interact, you can now specify the appropriate scopes, such as Tasks or CRM. The full scope list is available in the documentation.

Download the example attached to the lesson and upload it to your server as per the lessons on local integrations.

Accessibility from an external network

Ensure that the URL of the uploaded example is accessible from an external network and check its availability using third-party services. The web server settings must allow frames.

The "Application URL" field is mandatory, while "Application Installer URL" is usually optional, but we will use it here as well. Save and close the form.

ТIn the solution form, edit the name of the solution, such as Application Example, and save the changes. Now access the Test button. This opens a page that enables you to install the application on your Bitrix24 and test it before publishing it on Bitrix24.Market.

But before that, make changes to the example by copying and pasting the values from the client_id and client_secret fields into the corresponding constants in the settings.php file. Note that the incoming webhooks used for local integrations are inapplicable to Market solutions.

Go back to the developer area and specify the Bitrix24 address where you are an administrator, then click Install. This will redirect you to the portal and launch the application installation interface. Although the installation will look more appealing with descriptions and screenshots when published in the catalog, for now, ensure that the application is technically functional. Bitrix24 will automatically open the application after successful installation, as the application has a user interface.

Examine the install.php file. You will recall that we specified a link to this file in the "Application Installer URL" field. This page opens in a frame inside Bitrix24 during the installation process and is typically used to initialize data on the application side and save authorization tokens linked to a specific Bitrix24 portal.

The installApp method in the SDK is responsible for saving the authorization tokens and other data received from the portal in the POST request. By default, this data is saved in a text file, but it is better practice to use a database in mass-market applications, which we will discuss in future lessons.

instalFinish

For now, note that the application must inform Bitrix24 of successful installation via the installFinish js-method from a special js-library. After the application calls this function, Bitrix24 considers the installation successful and redirects the user to the main URL of the application, in this case, the index.php page.

On the index.php page, the application calls the profile method, which returns information about the current user. The SDK automatically obtains the necessary authorization tokens from the file created earlier in install.php for REST method calls to function.

The application's skeleton is now ready.

Add the necessary custom functionality to the application and test its functionality on the Bitrix24 portal where you installed it. Once everything is functional, we can publish the solution in Bitrix24.Market.

Resources

Lesson materials: