Building a bot app for Microsoft Teams

This article provides step-by-step instructions on how to build a Microsoft Teams App with bot functions. This App must next be connected to the main MI application to be able to access content in Metric Insights and process queries submitted by your Microsoft Teams users.

PREREQUISITES:

1. Create a new app in the Bot Framework

  1. Access Microsoft Teams Bot Framework via https://dev.botframework.com/bots/new
  2. Bot profile: provide Display Name, Bot handle, and optionally, a Long description for your Bot
  3. Message Endpoint should point to the server where the MI Chatbot is installed
  4. Create Microsoft App ID and Password
  5. Finish and go back to Bot Framework
  6. Paste App ID in the provided field
  7. Analytics: optionally, configure the Analytics section
  8. Set confirmation for User Agreement and click [Register]

2. Connect the Bot to the "Microsoft Teams" channel

  1. Ignore the Migration message (Migration for this type of bot is not required)
  2. Add a featured channel: connect the Bot App you have created in the Bot Framework to Microsoft Teams
  3. When Microsoft Teams and the Bot have been connected, this will be displayed under "Connect to channels"

3. Create a new app in App Studio

PREREQUISITES:

  1. Find the installed App Studio via User Search Field at the top of the chat
  2. App Studio > Manifest editor tab > Create a new app
  3. App Details > Complete all the required fields
    • App ID must be copied from Step 1 (Bot Framework configuration)

4. Configure Bot Capabilities

  1. Go to Capabilities > Bots
  2. Click [Set up] to proceed
  3. Switch to the Existing bot tab
  4. Specify the Bot's Name
  5. Bot ID: choose the option "select from existing bots"
  6. In the drop-down Suggest List, find your Bot
  7. Scopes determine which type of conversations the Bot will support
    • Add both Personal (to support conversations between a bot and a single user) and Team Scope (to allow channel conversations)
  8. Save your inputs

5. Add a Messaging Extension to your App

Search-based messaging extensions allow you to query your Bot App and post its responses in the form of a card, right into your message.

  1. Go to Capabilities > Bots
  2. Click [Set up] to proceed
  3. Switch to the Existing tab
  4. Specify the Bot's Name
  5. Bot ID: choose the option "select from existing bots"
  6. In the drop-down Suggest List find your Bot
  7. Save your inputs

6. Add Commands

Having added a Messaging Extension, you need to configure the Search command, so that your bot is able understand User search queries.

NOTE: Without the Messaging Extension command, you will not be able to install the bot.

To include a command for a Messaging Extension, click [Add] to open the configuration settings window.

On the "New command" pop-up, specify the following:

  1. Command Id: searchCmd 
  2. Title: Search
  3. Parameter Name: searchKeyword
  4. Tile: Keywords
  5. Save

7. Test and Distribute

  1. Go to Finish > Test and distribute
  2. Clicking [Install] opens the configuration pop-up
  3. Add for you: switch the toggle to "yes"
  4. Add to a team: switch the toggle to "yes"
  5. In the dropdown list, select the Team
  6. Click [Install] to initiate the installation process