BotBuilder's SDK extension for Microsoft Teams
The functionality of this SDK has been migrated into the core into the core Bot Framework SDK with the 4.6 release. Please see the new samples available here: https://github.com/microsoft/BotBuilder-Samples
This package therefore has been deprecated. It may continue to function, but will receive no further updates in functionality or security patches.
The Microsoft Bot Builder SDK 4 Teams Extensions allow you to build bots for Microsoft Teams quickly and easily. Review the documentation to get started!
Simply grab the Microsoft.Bot.Builder.Teams nuget.
Bot Builder SDK 4 - Microsoft Teams extensions for Node is available at https://github.com/OfficeDev/BotBuilder-MicrosoftTeams-node.
Microsoft.Bot.Builder.Teams
nuget package.Startup.cs
and add the following snippet of code: services.AddBot<EchoBot>(options =>
{
// ... other stuff snipped for brevity
// Add Teams Middleware.
options.Middleware.Add(
new TeamsMiddleware(
new ConfigurationCredentialProvider(this.Configuration)));
// ... other stuff snipped for brevity
});
OnTurnAsync
method of your bot, to do any Teams specific stuff, first grab the ITeamsContext as shown below: var teamsContext = turnContext.TurnState.Get<ITeamsContext>();
teamsContext
, you can use intellisense built into Visual Studio to discover all the operations you can do. For instance, here's how you can fetch the list of channels in the team and fetch information about the team:// Now fetch the Team ID, Channel ID, and Tenant ID off of the incoming activity
var incomingTeamId = teamsContext.Team.Id;
var incomingChannelid = teamsContext.Channel.Id;
var incomingTenantId = teamsContext.Tenant.Id;
// Make an operation call to fetch the list of channels in the team, and print count of channels.
var channels = await teamsContext.Operations.FetchChannelListAsync(incomingTeamId);
await turnContext.SendActivityAsync($"You have {channels.Conversations.Count} channels in this team");
// Make an operation call to fetch details of the team where the activity was posted, and print it.
var teamInfo = await teamsContext.Operations.FetchTeamDetailsAsync(incomingTeamId);
await turnContext.SendActivityAsync($"Name of this team is {teamInfo.Name} and group-id is {teamInfo.AadGroupId}");
Take a look here.
Stand-alone sample can be found here.
If you have updated the TeamsAPI.json. You will need to regenerate the client models
Please review the information here.
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.