Microsoft Teams Bot

This Integration allows full access to the Microsoft Bot Framework SDK for cloud-hosted instances from your application. Fusebit's multi-tenant approach makes it easy for you to manage multiple Microsoft Teams connections on behalf of your app's users. Our Node.js-based programming model and lightweight deployment story make it easy to customize the Integration with any necessary business logic.

Getting Started

  1. Use the Fusebit Management Portal to create an account and log in.
  2. Create a new Integration using one of our Microsoft Teams Bot templates
  1. You will then be able to run the Integration, download it's code, modify it, and deploy your changes. Detailed instructions on how to get started with an Integration are available here.


Most of our integrations leverage our own demonstration application out of the box, this is done to make it easier to get started while you set up your own app.

However, for Microsoft Teams, it is required that you configure your own bot first before the Integration will work.

Read below to get started.

Creating your own Microsoft Teams Bot

To set up your own Microsoft Teams Bot and make it available to your tenants in Production, there are 4 main steps you need to go through:

  1. Create a new Bot in Microsoft Azure
  2. Configure your Bot with Fusebit
  3. Deploy your Bot to Teams (Dev Testing)
  4. Deploy your Bot to Teams Marketplace (Production Launch)

If you don't have one yet already, you will need to set up a Microsoft Developer Account and also sign up for an Azure Subscription as well.

Create a new Bot in Microsoft Azure

  1. In the Microsoft Bot Framework Portal, click on My Bots and click on Create. Alternatively, you can get started with this link.

Make sure to select 'Multi-Tenant' as the type of app so you can create a Microsoft App ID for use below.

Once you have created the bot and it is successfully deployed, you can go to the Resource Group to get started with the configuration process.

Configure your Bot with Fusebit

For this section, you will need to do three things:

  • In Fusebit, set the Client ID --> Microsoft App ID from Azure
  • In Fusebit, set the Client Secret --> Client Secret from Azure
  • In Azure, set the Messaging Endpoint --> Webhook URL from Fusebit
  1. In the Azure Portal, from the Resource group, find the Bot you just created and click on it. In the Bot screen, from the left hand menu, click on Configure and copy the Microsoft App ID.

    In the Fusebit Management Portal, find the Integration you would like to connect to the new Bot you just created and select the Connector tied to that integration.

    Once there, Select Enable Production Credentials in the Connector Configuration and paste the Microsoft App ID under Client ID. Then, from the same screen, copy the Webhook URL and paste it back under Messaging Endpoint in the Azure Portal for your bot. Make sure to click 'Enable Streaming Endpoint'

  1. In the Azure Portal, where it says Microsoft Application ID - click on Manage. You will need to create a new client secret and give it a name. Once created, copy the Value and paste it back in the Fusebit Portal under Client Secret.


For Microsoft Teams Bots, you can only have one Integration linked to the Connector. You may have noticed a field called 'Default Event Handler' in the Connector configuration screen, this is where we specify the integration that will contain the logic used to handle incoming messages from your bot.

It is auto-populated with the Integration you created but you may override it to point to a different Integration if you want.

Deploy your Bot to Teams (Dev Testing)

Here you will deploy the Bot to your Developer Teams account for testing. At this point the bot has been configured with Fusebit, and you are able to edit the response handling logic within the Fusebit integration file.

  1. In the Azure Portal, in the Bot screen - from the left hand menu, click on Channels and enable Microsoft Teams. Hit save.
  1. For this newly created Channel, under the Actions column - click on Open in Teams. You will be prompted to launch Microsoft Teams and the bot will be added to your direct messages.

    Send any message to this Bot to get the flow started.



Good Job!

You have now installed your Microsoft Bot and configured it to Fusebit, you can now leverage our Webhooks SDK to receive events from the Bot and handle them accordingly!

See the code sample below to understand where to customize your Integration to your needs.

// This is the logic responsible for handling the incoming messages from a Microsoft Teams user.
integration.event.on('/:componentName/webhook/message', async (ctx) => {
  const botFrameworkAdapter = await integration.service.getSdk(ctx, ctx.params.componentName);

  await botFrameworkAdapter.processActivity(ctx.req, ctx.res, async (context) => {
    const conversationReference = TurnContext.getConversationReference(context.activity);
    const tenantId = 'user-1';
    await, `/${tenantId}/teams-conversation-reference`, {
      data: conversationReference,

    const reply = MessageFactory.text(
      "Hi, friend. I'm saving a conversation reference so I can send you a proactive message later."
    await context.sendActivity(reply);

Deploy your Bot to Teams Marketplace

To make this Bot available to users, you will need to deploy this app to the Marketplace. There are a number of ways you can do this based on your specific context.

Read through these guides to learn more:

Note: You will likely also need to configure your an OAuth flow for your users to connect your app to the bot. Read more about this here. Please feel free to reach out to us if you need help!

Invoking the Bot Framework API

The Integration template comes pre-configured with some example calls that handling Incoming Bot message and also Invoke the Microsoft Bot Framework, for example:

// This is the logic that proactively sends a message to the user that previously initiated a conversation.'/api/tenant/:tenantId/test', integration.middleware.authorizeUser('install:get'), async (ctx) => {
  const botConnector = 'microsoftBotFrameworkConnector';
  const botFrameworkAdapter = await integration.service.getSdk(ctx, botConnector);

  const { tenantId } = ctx.params;
  const { data: conversationReference } = await

  if (!conversationReference) {
    ctx.throw(`Unable to send a proactive message. Has ${tenantId} sent this bot a message yet?`);

  await botFrameworkAdapter.continueConversation(conversationReference, async (context) => {
    await context.sendActivity("Hi again, friend. This is a proactive message I'm sending you.");

  ctx.body = { message: `Successfully sent a proactive message to the Microsoft Teams user!` };

The microsoftBotFrameworkConnector object provided by Fusebit is an instance of the Microsoft Bot Framework SDK.

We ensure the above SDK object is already bootstrapped with the Microsoft Bot credentials of the user invoking the integration and respond appropriately. You do not need to worry about obtaining an access token or refresh token -- Fusebit does that for you automatically.

Helpful References

Want to learn more about how to set up a Developer Account and work with Microsoft Bots? Here's some helpful references:

Did this page help you?