Integration events Bitrix24 calendar with MS Teams for alternative video conferences

29 July 2024

next article
Oleksiy Vashchuk

Backend Developer

Oleksiy Vashchuk
Integration events Bitrix24 calendar with MS Teams for alternative video conferences

About the author: Oleksiy, a full-stack developer with many years of experience, who is well acquainted with Bitrix24 and has created a lot of customizations for this product. Today, our colleague will tell and even show how to replace video conference with MS Teams, so that everything works correctly, as with the regular functionality.

Bitrix24 has a large set of ready-made solutions for teamwork and business: this is good, because it eliminates dependence on third-party software and allows you to use the product as efficiently as possible. In addition, these tools are tightly integrated with other components, for example CRM or Tasks, which makes the workflow easier and more perfect. However, there are cases when the standard functionality is not quite suitable for the client and clients turn to our company with a request to replace it with something they need.

This is exactly what happened this time with the development of the cash integration of Bitrix 24 and MS Teams for video conferencing. My colleague wrote in more detail about the possibilities of standard conferences in a previous blog article Avivi : "HowthatkeepintouchwithcolleaguesandclientsthroughBitrix 24 videoconferences ?". However, the popular service from Microsoft allows the client to have greater functionality for communications and the ability to adapt to the needs of other users.

Integration with MS Teams

The case is implemented with an authorization protocol OAuth 2.0, which guarantees security and data privacy protection:


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
private function getMSAccessToken() {
        $resource = "https://graph.microsoft.com/";
        $token_url = "https://login.microsoftonline.com/".static::MT_API_TENANT_ID."/oauth2/token";

        $data = [
            'grant_type' => 'client_credentials',
            'client_id' => static::MT_API_APPLICATION_ID,
            'client_secret' => static::MT_API_SECRET_ID,
            'resource' => $resource,
        ];

        $options = [
            'http' => [
                'header' => "Content-type: application/x-www-form-urlencoded\r\n",
                'method' => 'POST',
                'content' => http_build_query($data),
            ],
        ];

        $context = stream_context_create($options);
        $responseMS = file_get_contents($token_url, false, $context);
        $token_data = json_decode($responseMS, true);

        if (!empty($token_data['error'])) {
            return array('error' => "Microsoft Teams get token error: \n" . $token_data['error']['message']);
        } else {
            return $token_data['access_token'];
        }
    }

Let's take a detailed look at the logic of work, which ensures the correct functioning of the integration:

  • The creation of an event causes a check of the possibility of creating an MS Meet via API Microsoft Graph. This happens with the help of the user's email: accordingly, Azure must have such a user with such an email to continue. It is also necessary for the user to have an active license — this is a clear and mandatory condition;

ms teams 1.png

  • In case when​ audit passed successfully , the option will become available to the user creation events​ Otherwise , unfortunately, it will be impossible;

ms teams 2.png

  • Even after saving a new event, the system requires several more user checks. Do not worry if they fail and an error message appears: in most cases, this is related to the account of the interlocutor and can be fixed by him.



ms teams 3.png

  • If all checks are confirmed, an event will be created in the calendar. Other users can join the conference using the link, but the host must manually confirm the participant and start the meeting. Then everything is standard: participants will receive invitations from Bitrix24 and MS Teams — because it's in the game. The participant can use any invitation.


ms teams 4.png
ms teams 5.png

ms teams 6.png

Additional benefits

Since we are now using MS Teams, it also automatically creates an event that you can track and update. That is, all the changes that will happen before the end of the conference will be duplicated here as well.

For convenience, I created a synchronization settings page in the dashboard, where you can update the token (secret) or connect another token for the relationship.

ms teams 7.png

As you have already understood, they are similar decision also you can use for integrations with Zoom and Google Meet ;) and Avivi developers will kindly help you to integrate with these platforms if necessary. But I want to note that for the implementation of such a case, the client has to provide all accesses administrator to each of services, otherwise developers will be powerless to help.

Get more with Avivi!


Similar articles
Apply for a consultation

We will reach out to within 10 minutes