Kloudless Blog

Kloudless Unified APIs enable you to code once and integrate many

This article is a part of our “Getting Started” series, with featured articles on getting started with API integrations to Dropbox, Google Calendar, Gmail, Salesforce, and Microsoft Exchange.


MS Teams is one of the most popular chat services available today and is widely used at many of the largest organizations for chat and coordination. Microsoft Teams is also one of our more popular connectors available in the Kloudless Unified Chat API, so we thought it would be helpful to provide a straightforward walkthrough of how to integrate your application with the powerful chat provider.

Getting started with the MS Teams API is relatively simple, and requires only a few steps before you can allow your users to freely access their Microsoft groups and teams.

Application Setup

Microsoft developer services are tied to the Azure Portal, so you should be able to login with either your work or personal email; otherwise, sign up here.

Navigate to Azure Active Directory, and under manage, select App registrations. Then click New registration:

Fill out the required information describing your application. We recommend choosing Accounts in any organizational directory for supported account types, but not personal Skype or Xbox accounts.

You will then retrieve an Application ID or Client ID after creating your application. You will then be able to generate a new client secret on the “Certificates and secrets” page in the Application Registration portal.

Don’t forget to set your Redirect URI to “Web” under the “Authentication” page if you haven’t when creating the application.

Finally, add the following Microsoft Graph “Delegated Permissions” on the “API permissions” page for specifying the specific access you would like users to grant with your application.

  • ReadWrite
  • ChannelMessage.Send
  • ChannelMessage.Delete
  • ChannelMessage.Edit
  • Team.Create
  • Team.ReadBasic.All
  • Channel.ReadBasic.All
  • User.Read
  • User.ReadBasic.All

That’s all there is to it. Now, you’re all set up to start making calls to the Microsoft Graph API to use Microsoft Teams API endpoints.

Making Your First MS Teams API Request

You can use the Microsoft Teams API in Microsoft Graph in multiple ways. In the following example, we’ll lay out the way we can go about creating a team.

All teams are backed by Microsoft 365 groups, so the quickest way to get your team up and running when you create new teams via Microsoft Graph is to set up a new Microsoft 365 group, all owners and members, and convert that into a team.

First, create an Microsoft 365 group using the create group operation. Here, you can specify owners and members. Make sure that you have the right owners for the newly created group, which we will go over in a moment.

The following property values are necessary to create a group:

  • groupTypes = {“Unified”}
  • mailEnabled = true
  • SecurityEnabled = false

As long as you’ve provided all of the required information, you will receive a 200 response from the server. 

Next, you want to ensure the group has two or more owners. You can do so via the add owner operation. These should be real user accounts and not service accounts. Having two owners helps handle cases where one owner leaves the company or is unavailable to perform team management operations. As always, it’s best to think ahead when it comes to creating groups that will be managed by your organization.

After owners have been added, you can add all members to the group using the add member operation. If you’re adding multiple members, add a 1 second delay after each add operation to ensure that the server will receive all of your requests.

After the group is successfully created, which can take up to 15 minutes after completing Step 1, create a Microsoft Teams team using the create team operation from group operation. If you run into an error, the group creation process might not be completed and you should try waiting a few more minutes.

The POST above will product the following response:

After this process finishes, all of the owners and members of your team that you have added will be able to see this newly created team in their Teams client!
For more information, refer to the official documentation.

Kloudless Is the Best Way to Integrate MS Teams

Integrating with MS Teams can take as much as 6 months of development time, and that’s not taking into account the ongoing maintenance and support to keep that connection sound in the future. 

The Kloudless Unified Chat API was built to connect your application with Slack, Microsoft Teams, and Facebook Workplace in minutes. With Kloudless, you can simplify your application’s chat integrations with Slack, Microsoft Teams, and Facebook Workplace. The Unified Chat API provides a single set of API endpoints and data models to send messages as a user and retrieve all chat history from any supported service. Kloudless also offers extensive activity monitoring and webhooks to all of our connectors, as well as support for all major event bus services.

Kloudless takes away the headache of maintenance and API updates, so your development team can focus on what’s important: Your app’s core functionality.

Using Kloudless with MS Teams

You can sign up today for a free developer account with Kloudless and get started with MS Teams integration or integrating with any of the other connectors provided in the Unified Chat API. 

Once signed in, you will find the Callback URL or redirect URI under THIRD-PARTY SERVICES => Configuration. Please click the SaaS product MS Teams and select “Use Your MS Teams Keys.”

After filling in the Client ID and Client Secret, you will also need to set a specific Callback URL or Redirect URI from MS Teams. Click Save and you’re all set.

To learn more about the Kloudless Unified Chat API, please visit our product page or direct any inquiries to hello@kloudless.com.

Categories:

Share this article:

Let’s get started. Start building for free today.