Skip to content
BotBuilder v4 SDK extension for Microsoft Teams
Branch: master
Clone or download
Latest commit 922d14e May 31, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode All CAP features (#8) Apr 1, 2019
botbuilder-teams-js update package-lock May 30, 2019
samples Add to samples (#9) Apr 1, 2019
.gitignore first commit Feb 8, 2019
LICENSE Initial commit Feb 7, 2019 Update Mar 5, 2019
appveyor.yml don't touch project folder Mar 1, 2019

Bot Builder SDK4 - Microsoft Teams Extensions

Build status

The Microsoft Bot Builder SDK Teams Extensions allow bots built using Bot Builder SDK to consume Teams functionality easily. Review the documentation to get started!


Get started quickly with our samples:

This SDK allows you to easily...

  • Fetch a list of channels in a team
  • Fetch profile info about all members of a team
  • Fetch tenant-id from an incoming message to bot
  • Create 1:1 chat with a specific user
  • Mention a specific user
  • Consume various events like channel-created, team-renamed, etc.
  • Accept messages only from specific tenants
  • Write Compose Extensions
  • and more!

Getting started

npm install botbuilder-teams@4.0.0-beta1
  • To extend your bot to support Microsoft Teams, add middleware to adapter:
// use Teams middleware
adapter.use(new teams.TeamsMiddleware());  
  • Now in the onTurn method of your bot, to do any Teams specific stuff, first grab the TeamsContext as shown below:
import { TeamsContext } from 'botbuilder-teams';

export class Bot {
  async onTurn(turnContext: TurnContext) {
    const teamsCtx: TeamsContext = TeamsContext.from(ctx);
  • And once you have teamsContext, you may utilize code autocomplete provided by Visual Studio Code 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
const incomingTeamId =;
const incomingChannelid =;
const incomingTenantId =;

// Make an operation call to fetch the list of channels in the team, and print count of channels.
var channels = await teamsCtx.teamsConnectorClient.teams.fetchChannelList(incomingTeamId);
await turnContext.sendActivity(`You have ${channels.conversations.length} 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 teamsCtx.teamsConnectorClient.teams.fetchTeamDetails(incomingTeamId);
await turnContext.sendActivity(`Name of this team is ${} and group-id is ${teamInfo.aadGroupId}`);

Questions, bugs, feature requests, and contributions

Please review the information here.


This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact with any additional questions or comments.

You can’t perform that action at this time.