In recent years, work communications have moved from mostly physical communications to chats and real-time virtual meetings. Platforms such as Microsoft Teams have been at the forefront of this change, and have played a massive role in enabling the shift to remote workplaces and bridging the communication gap across teams worldwide. 

Microsoft Teams offers a wide range of features, including text-based chat, video calling, audio conferencing, file sharing, screen sharing, online meetings, and integration with Office 365 tools. By default, these tools can be used within your organization, and Microsoft also offers the functionality to enable external access that allows you to contact specific users or businesses who aren’t part of your organization.

However, the needs of different teams may vary, and may extend beyond the basic features of the platform. Teams accommodates by providing a number of SDKs in multiple languages, allowing users to develop their own extensions and integrations. 

Use cases for this could include integrating a Teams channel with DevOps pipeline, generating automated follow-up emails from meetings, or triggering alerts from different web services owned by the team. This helps organizations to maintain seamless communications and meet business needs. 

To use the Teams API, you need to connect Microsoft Teams with your services. In some cases, this might mean a connection to your server, but in many cases, it means connecting with a serverless technology such as AWS Lambda

AWS Lambda is a serverless computing service provided by Amazon Web Services. As a serverless platform, AWS Lambda takes away the burden of running and managing your own web server and handles that for you, allowing you to focus on your business logic.

In this article, you’ll learn more about issues you could face when integrating Microsoft Teams with AWS Lambda. You’ll also see how you can simplify this process for some use cases by relying on a service that has already done the heavy lifting. 

Why Integrate Teams and APIs with AWS Lambda?

Microsoft Teams allows you to build on their platform, and create integrations with web services built on platforms like AWS Lambda. AWS Lambda helps you build out services without having to worry about setting up and managing your own server, and can automatically allocate and scale the needed compute resources for accomplishing tasks. This makes it a good choice for creating solutions where managing your own server doesn’t provide any meaningful benefits. 

The Microsoft Teams platform supports a number of application and integration types, including: 

Bots: Bots come in handy when building applications that run simple repetitive tasks, such as answering frequently asked questions or basic customer service applications.

Message Extensions: Message extensions can be used to allow users to interact with your web services through buttons and actions in Microsoft Teams. For example, you could create a bug in your tracking system based on a Teams message, or remotely trigger print commands, and manage mailboxes.

Connecting web services using webhooks and connectors: Microsoft Teams provides outgoing webhooks, incoming webhooks, and connectors to help connect your web services to your teams and channels in Microsoft Teams. Webhooks and connectors can be used when trying to send text messages from a channel to your web services or vice versa. For example, you could configure Teams to update one of your channels with the state of your DevOps pipeline, or receive notifications from one of your web services.

Challenges to Integrating Microsoft Teams APIs with AWS Lambda

While integrating Teams and Lambda can offer benefits, it also comes with its challenges and poses some difficulties.

CORS Issues

You may have seen this one coming. The cross-origin resource sharing (CORS) issue is one of the most common issues you might encounter while trying to integrate Microsoft Teams with your AWS Lambda-hosted web services. CORS issues hinge on the inability of an app or service to access a resource, and access to resources across different domains needs to be integrated with both your AWS API gateway and in your Lambda code. 

There are many reasons you might run into this issue, and while AWS has a help page on the subject, you’ll need to spend some time debugging in order to figure out where your specific problems are. However, a common solution to the CORS issue is to ensure your API is sending proper headers to allow access from your client. Domains allowed to access your API must be included in the `Access-Control-Allow-Origin` header value.

Needing a REST API Endpoint for Integrations

AWS Lambda functions can be integrated directly with Teams for some use cases, such as connecting your function with an incoming webhook. For integrations such as bots, though, you’ll need to set up a REST API that will receive post requests whenever a user interacts with the bot. To set up a REST API for your AWS Lambda function, you need to use the Amazon API gateway, which increases the complexity of the integration.

Complex Debugging Experience

Debugging any issues you run into while integrating AWS Lambda with Microsoft Teams is not easy, especially as there are not many resources to turn to. This makes it much harder to debug and resolve issues encountered. 

While testing your function locally can help find issues with your code, it’s not something that can help resolve production issues. This can mean that issues require lots of trial and error to resolve, or that monitoring and tracing systems need to be integrated into your function to help you debug any obstacles you run into.

Structure of Request-Response Object

When building a bot, an adapter from the Microsoft bot framework is responsible for processing the activities; this adapter requires a request-response object.

“`

// Listen for incoming requests.

server.post(‘/api/messages’, async (req, res) => {

  // Route received a request to adapter for processing

  await adapter.process(req, res, (context) => bot.run(context));

});

“`

Unfortunately, AWS Lambda doesn’t have this expected structure of the request and response object when invoked, so you have to mock these objects yourself. However, this shouldn’t be an issue if you use the Amazon API gateway to set up a REST API endpoint.

Integrating AWS Lambda with Microsoft Teams

The steps taken might vary slightly depending on the kind of integration you want, but in this section, you’ll look more closely at some of the common steps that you would take to create custom automation with Microsoft Teams API and AWS Lambda app.

Set Up Your AWS Lambda Function 

Your first step is to set up your AWS Lambda function. While you can implement your logic through the AWS console, it would be more convenient to write your code locally, then deploy the function. You can find a detailed step-by-step approach to creating an AWS Lambda function using the AWS SDK on the AWS docs.

Setting up the Lambda function

Set Up the Amazon API Gateway

Because Lambda functions are usually triggered when an event happens or is called through an endpoint, some integrations need you to create a REST API endpoint. For you to call your Lambda function through an endpoint, you will need to use the Amazon API gateway to create a REST API endpoint, which could then be used when building a bot or an outgoing webhook.

Setting up the Amazon API Gateway

Connecting to Microsoft Teams for Bots and Webhooks

For you to connect an app or service built on AWS Lambda with Microsoft Teams, you need to configure this app or service with Microsoft Teams. When building a chatbot, you need to register your app with the Microsoft Bot Framework, while for a webhook, you need to configure and authenticate the webhook in the Teams channel. 

Integrating Microsoft Teams with AWS Lambda is quite challenging, and the lack of resources makes the task more daunting. This is especially true if you’re looking to extract more value from your data, and are using AWS Lambda to do machine learning or artificial intelligence tasks related to conversational analysis. 

Easier Analysis with Symbl.ai

Microsoft Teams allows you to build a variety of different application types, including bots, connectors, message extensions, actionable messaging, calling, and online meetings, but getting actionable information from these applications isn’t always easy. However, combining the rich features offered by the Microsoft Teams API with Symbl.ai can open up a number of possibilities to enable you to meet your business needs.

Symbl.ai is a service that offers a way to get best-in-class conversational intelligence from video, audio, and text data. They offer straightforward APIs and SDKs that integrate with the tools you’re using, no complicated setup necessary, and allow you to access advanced AI functionalities—without requiring advanced coding skills to get it up and running. 

Microsoft Teams allows you to connect your Teams apps to third-party APIs, such as Symbl.ai’s conversational intelligence APIs. This integration can offer a wide range of features and insight, from speech-to-text to analyzing conversations or email exchanges for topics that were discussed or actions that were agreed upon. 

It can also provide sentiment analysis, offering insights into how the parties involved feel about the topics being discussed, and conversational analytics, indicating how engaged participants were. Symbl.ai’s conversational intelligence features can be used with the Microsoft teams API to help you gain insights from meetings by generating a list of questions asked and answered, topics discussed, and follow-up actions that members of the conversation need to take. 

Conclusion

In this article, you’ve seen the most common challenges when integrating AWS Lambda with Microsoft Teams, and gained insights on how to address these problems. You’ve also learned how Symbl.ai can be used in many common use cases, allowing you to generate insights to maximize business value without the need for complex integrations.

READ MORE: Your Most Common AWS Lambda Challenges: Integrating with Zoom APIs

Jerry Chibuokem
Jerry Chiboukem
Software Engineer

Jerry is a software engineer with 3+ years of experience building performant client-side applications using JavaScript, HTML/CSS, React, and several popular libraries in the React ecosystem (Redux, Redux-Saga, etc.).