Microsoft Teams Api

broken image


The benefits of using Microsoft Teams APIs are myriad. You can cut down on the need for human intervention for common tasks – for example, opening a new channel for communication when a customer places an order. It makes team and channel management easier, not to mention integrating with applications that run outside the Teams UX. Given the breadth of options and continuous support from the Microsoft community, Teams APIs are key to unlocking the app's full potential. Calling and online meeting APIs apply only to Microsoft Teams. See also the known issues for. The Microsoft Graph API for sending notifications in the Microsoft Teams Activity Feed is now generally available with enhanced features. Connect to the latest conferences, trainings, and blog posts for Microsoft 365, Office client, and SharePoint developers.

  1. Microsoft Teams Api Graph
  2. SPFx - Microsoft Graph With Teams API
  3. Microsoft Teams Platform Developer Documentation - Teams ..
-->

Redline rp discord link. Important

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.

Microsoft Teams is a chat-based workspace in Microsoft 365 that provides built-in access to team-specific calendars, files, OneNote notes, Planner plans, Shifts schedules, and more.

Key resources in Microsoft Teams

ResourceMethods
teamList your teams, list all teams, create, read, update, delete, clone, archive, unarchive
groupAdd member, remove member, add owner, remove owner, get files, get notebook, get plans, get calendar
channelList, create, read, update, delete
teamsTabList, create, read, update, delete
teamsAppList, publish, update, remove
teamsAppInstallationList, install, upgrade, remove
chatMessagelist in channel, list in chat, send, read in channel, read in chat
callAnswer, reject, redirect, mute, unmute, change screen sharing role, list participants, invite participants
scheduleCreate or replace, get, share
schedulingGroupCreate, List, Get, Replace, Delete
activityFeedNotificationSend notification to user in scope of a chat, Send notification to user in scope of a team, Send notification to user in personal scope
shiftCreate, List, Get, Replace, Delete
timeOffCreate, List, Get, Replace, Delete
timeOffReasonCreate, List, Get, Replace, Delete

Microsoft Teams limits

The tested performance and capacity limits of Microsoft Teams are documented inLimits and specifications for Microsoft Teams.These limits apply whether using Microsoft Teams directly or using Microsoft Graph APIs.Because every team has a corresponding group, and every group is a directory object,limits on the number of groupsand the number of directory objects ('resources')can also come into play.

Files inside channels are stored in SharePoint; SharePoint online limits apply.

See also throttling limits for Microsoft Teams services.

Teams and groups

In Microsoft Graph, Microsoft Teams is represented by a group resource. Both Microsoft Teams and Microsoft 365 groups address the various needs of group collaboration. Almost all the group-based features apply to Microsoft Teams and Microsoft 365 groups, such as group calendar, files, notes, photo, plans, and so on. The main difference between a team and a Microsoft 365 group is the mode of communication between members. Team members communicate by persistent chat in the context of a specific team. Microsoft 365 group members communicate by group conversations, which are email conversations that occur in the context of a group in Outlook.

Any group that has a team has a resourceProvisioningOptions property that contains 'Team'.

Note: The Group.resourceProvisioningOptions property can be changed.Do not add or remove 'Team' from that collection;otherwise, you'll get incorrect results when you list all teams.

The following are the differences at the API level between teams and groups:

  • Persistent chat is available only to Microsoft Teams. This feature is hierarchically represented by the channel and chatMessage resources.
  • Group conversations are available only to Microsoft 365 groups. This feature is hierarchically represented by the conversation, conversationThread, and post resources.
  • The List joined teams method applies only to Microsoft Teams.
  • Calling and online meeting APIs apply only to Microsoft Teams.
  • See also the known issues for these APIs.

Note: If you use the groups API in a Microsoft Teams app rather than in a standalone app - for example as part of a tab or bot running in Microsoft Teams - follow the guidance in the article Using Microsoft Graph in your Microsoft Teams pages.

Membership changes in Microsoft Teams

To add members and owners to a team, change the membership of the group with the same ID.

Use caseVerbURL
Add memberPOST/groups/{id}/members/$ref
Remove memberDELETE/groups/{id}/members/{userId}/$ref
Add ownerPOST/groups/{id}/owners/$ref
Remove ownerDELETE/groups/{id}/owners/{userId}/$ref
Update teamPATCH/teams/{id}

We recommend that when you add an owner, you also add that user as a member.If a team has an owner who is not also a member, ownership and membership changes might not show up immediately in Microsoft Teams.In addition, different apps and APIs will handle that differently.For example, Microsoft Teams will show teams that the user is either a member or an owner of, while the Microsoft Teams PowerShell cmdlets and the /me/joinedTeams API will only show teams the user is a member of.To avoid confusion, add all owners to the members list as well.

Known issue: when DELETE /groups/{id}/owners is called, the user is also removed from the /groups/{id}/members list. To work around this, we recommend that you remove the user from both owners and members, then wait 10 seconds, then add them back to members.

When adding and removing members and owners, don't put braces { } around the ID.

SpeedSyntax
Fasthttps://graph.microsoft.com/beta/groups/02bd9fd6-8f93-4758-87c3-1fb73740a315/members/48d31887-5fad-4d73-a9f5-3c356e68a038/$ref
Slowhttps://graph.microsoft.com/beta/groups/{02bd9fd6-8f93-4758-87c3-1fb73740a315}/members/{48d31887-5fad-4d73-a9f5-3c356e68a038}/$ref

Similarly, if the userId in the URL or payload is expressed as a UPN rather than as a GUID, the performance will be slower.

SpeedSyntax
Fast48d31887-5fad-4d73-a9f5-3c356e68a038
Slowjohn@example.com

When the slower path is taken, if a current team member or owner is signed in to the Microsoft Teams application/website, the change will be reflected within an hour.If none of those users are signed in to the Microsoft Teams application/website, the change will not be reflected until an hour after one of them signs in.

Note

Tenant guests are always processed via the slow path.

Polling requirements

If your app polls to see whether a resource has changed, you can only do that once per day.(teamsAsyncOperation is an exception in that it's intended to be polled frequently.)If you need to hear about changes more frequently than that, you should create a subscription to that resource and receive change notifications (webhooks).If you don't find support for the type of subscription you need, we encourage you to provide feedback via UserVoice.

When polling for new messages, you must specify a date range where supported. For details, see get channel messages delta.

Polling is doing a GET operation on a resource over and over again to see if that resource has changed.You're allowed to GET the same resource multiple times a day, as long as it's not polling.For example, it is okay to GET /me/joinedTeams every time the user visits/refreshes your web page,but it is not okay to GET /me/joinedTeams in a loop every 30 seconds to refresh that web page.

Apps that don't follow these polling requirements will be considered in violation of theMicrosoft APIs Terms of Use. This may result in additional throttlingor the suspension or termination of your use of the Microsoft APIs.

What's new

Find out about the latest new features and updates for this API set.

See also

  • Sample code: Contoso Airlines, C# mini-samples
-->

This tutorial teaches you to build a basic bot app. A bot acts as an intermediary between Teams users and your web app or service with a conversational interface. People can chat with a bot to quickly get information or initiate workflows and tasks performed by your service.

What you'll learn

  • Create an app project and bot using the Microsoft Teams Toolkit for Visual Studio Code.
  • Understand the Teams app configurations relevant to bots.
  • Host and run an app locally using a localhost tunneling solution.
  • Sideload and test a bot in Teams.

Prerequisites

Ensure that you understand how to set up and build a simple Teams app. For more information, see create your first Microsoft Teams 'Hello, World!' app.

1. Create your app project

The Microsoft Teams Toolkit helps you set up the following components for your app:

  • App configurations and scaffolding relevant to bots
  • Bot that's automatically registered with the Microsoft Azure Bot Service

To create your app project

  1. In Visual Studio Code, select Microsoft Teams on the left Activity Bar and choose Create a new Teams app.

  2. When prompted, sign in with your Microsoft 365 development account.

  3. On the Select project screen, select Conversation bots:

  4. On the Configure project screen, enter a name for your bot. This is the default name for your app and also the name of the app project directory on your local machine.

  5. Select Create a new Bot > Create Bot Registration as shown in the following image:

    If successful, your new bot will have a Registered status. Now your bot is automatically registered with the Microsoft Azure Bot Service.

  6. Select Finish at the bottom of the screen and save your project on your machine.

2. Understand your app project components

Much of the app configurations and scaffolding are set up automatically when you create your project with the Teams Toolkit. Let's look at the main components for building a bot:

Microsoft Teams Api Graph

If you created a tab in another tutorial, the app scaffolding for the bot is different. Unlike tabs, bot development doesn't require you to build any front-end web components or use the Teams JavaScript client SDK. Instead, the scaffolding uses the Microsoft Bot Framework, which is an open-source SDK for building intelligent, enterprise-grade bots that can work on the web, mobile, and of course Teams!

The botActivityHandler.js file, located in the root directory of your project, is the Teams-specific handler that handles bot activities, such as how the bot responds to specific messages. The app scaffolding provides a botActivityHandler.js file, located in the root directory of your project, is the Teams specific handler that handles bot activities such as how the bot responds to specific messages.

3. Securely expose your localhost to the internet

Teams

SPFx - Microsoft Graph With Teams API

Take a look at the index.js file, which creates an HTTP server and handles routing to listen for incoming requests to your bot. The /api/messages is your app's endpoint URL to respond to client requests:

To forward the requests to your bot's logic, you must set up a publicly accessible URL, such as https://example.com/api/messages, instead of https://localhost. Because your app is running from your localhost currently, you must tunnel the network.

Tunneling is a protocol that allows you to transport data across a network. And localhost tunneling gives you a connection between your local machine and a remote connection. To securely expose your localhost to the internet, we recommend you to use the 3rd party tool called, ngrok. This will give you a secure URL.

  1. Go to the ngrok.com site and follow the instruction to install and set up ngrok in your environment.

    Add the full path to the ngrok.exe file that you installed to the system PATH environment variable. The exact steps are specific to the shell that you are using.

  2. After you have finished setting it up, open a terminal and run ngrok http -host-header=rewrite 3978.

    Now ngrok provides you a public, secure URL that forwards to your localhost at port 3978, so copy the HTTPS URL, for example, https://287a4f4223bc.ngrok.io as shown in the screenshot below, since Teams requires HTTPS connections:

  3. Register the URL in your app manifest.

4. Register your bot endpoint

To use a bot in Teams, you must register it with the Azure Bot Service. This is done automatically when you set up your app using the Teams Toolkit.

You must still specify an endpoint address to receive and process user messages, or requests, sent to the bot. Typically, the URL looks like https://HOST_URL/api/messages. You can configure this quickly in the toolkit.

  1. In Visual Studio Code, open Microsoft Teams Toolkit.

  2. Select Bots > Existing bot registrations and select the bot you created during setup.

  3. In the Bot endpoint address field, enter the ngrok URL, for example, https://287a4f4223bc.ngrok.io, where you're hosting the bot and append /api/messages to it:

    Your bot will be able to respond to messages in Teams, after you set up the endpoint correctly.

5. Build and run your app

You've set up a URL to host your bot and configured it to handle messages. It's time to get your app up and running.

  1. Ios 14 iphone 6s. In a terminal, go to the root directory of your app project and run npm install.

  2. Run npm start.

    If successful, you see the following message indicating your bot is listening for activity at your localhost:

    Bot/ME service listening at http://localhost:3978

6. Sideload your bot in Teams

With your bot running, you can install it in Teams.

Tip

Microsoft Teams Platform Developer Documentation - Teams ..

If you haven't sideloaded a Teams app before and run into issues, follow these instructions.

  1. In Visual Studio Code, select the F5 key to launch a Teams web client.

  2. In the app install dialog, select Add for me.

    Note

    By default, the app is added to your 1:1 direct chat message, however you can choose to install it to a team or chat by clicking the little arrow beside Add for me. In this tutorial, let's just click Add.

7. Test your bot

Let's say 'Hello' to your bot.

  • In the compose box, send a Hello message.Your bot replies with something like the following message:

    You have now created a basic Teams bot that can communicate with users one-on-one or in group settings (channels and chats) 🎉

Troubleshoot your bot

The following information may help if you had issues completing this tutorial.

Bot isn't connected to Teams

If you installed your app but the bot isn't working, make sure the bot is connected to the Azure Bot Service's Teams channel.

Dead by daylight discord. Anythingingaming is about anything to do with Dead by Daylight and Phasmophobia. Great community, - Notifications for DbD codes, leaks, etc. Find others to play with, - Self-given roles,. This is the Official Dead by Daylight Mobile server. Join us for news, game discussion, and more. 39,904 members. The official Dead by Daylight Discord server. 222,796 members.

It's important to understand that this isn't the same as a channel in Teams. In this case, a channel is how the Azure Bot Service connects your bot to Teams or another supported Microsoft or third-party communications app.

See also

Next step





broken image