Using Azure package for Teams server-side

Jeroen H 40 Reputation points
2024-03-11T10:39:05.3+00:00

I am using this Microsoft tutorial to receive incoming call events locally from inside a teams tab app, with success. These notifications aren't received when the user selects any other tab in Teams, however, so I would like to run the same code from a server. That way, the events can be sent to the user at any time.

My issue is that while copying the code for receiving events to a server environment, the line

const { CallClient } = require('@azure/communication-calling');

causes referenceError: window is not defined.
The package contains many references to the window object and its properties, which obviously are not available in a server environment. My code only creates a new CallClient and uses its method createTeamsCallAgent, I highly doubt the window object is needed for that.

Is there any way to get around this? I'm open to rewriting the code in a different language if that has a version of the package that doesn't need the browser environment. So far I've only seen a 'Windows' implementation, which also took the web page approach.

Thanks in advance and kind regards,

Jeroen

P.S. I was under the impression that these Teams libraries were specifically made for use by third-party applications, yet only web-page-based programs can use this it seems, isn't that strange?

Azure Communication Services
Azure Communication Services
An Azure communication platform for deploying applications across devices and platforms.
684 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
2,866 questions
{count} votes