Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

page_type: sample description: Microsoft Teams app show end user region selection using Bot and Tab products:

  • office-teams
  • office
  • office-365 languages:
  • csharp extensions: contentType: samples createdDate: "19-03-2021 13:38:25"

Region Selection App

Bot Framework v4 Region Selection sample.

This bot has been created using Bot Framework, for the region selection for the app's data center using Bot and Tab.

Prerequisites

  • .NET Core SDK version 3.1

    # determine dotnet version
    dotnet --version

To try this sample

  • Register a bot with Azure Bot Service, following the instructions here.

  • Ensure that you've enabled the Teams Channel

  • While registering the bot, use https://<your_ngrok_url>/api/messages as the messaging endpoint.

    NOTE: When you create your bot you will create an App ID and App password - make sure you keep these for later.

  • Clone the repository

    git clone https://github.com/OfficeDev/Microsoft-Teams-Samples.git
  • Run the bot from a terminal or from Visual Studio:

    A) From a terminal, navigate to samples/app-region-selection/RegionSelectionApp

    # run the bot
    dotnet run

    B) Or from Visual Studio

    • Launch Visual Studio
    • File -> Open -> Project/Solution
    • Navigate to samples/app-region-selection/RegionSelectionApp folder
    • Select RegionSelectionApp.sln file
    • Press F5 to run the project

Testing the bot using Bot Framework Emulator

Bot Framework Emulator is a desktop application that allows bot developers to test and debug their bots on localhost or running remotely through a tunnel.

  • Install the latest Bot Framework Emulator from here
  • Put the Microsoft App Id and Microsoft-App-Password and message endpoint in Bot configuration
  • Connect your Bot with Emulator, Ping the Bot to start the conversation

This is specific to Microsoft Teams

  • Edit the manifest.json contained in the Manifest folder to replace your Microsoft App Id (that was created when you registered your bot earlier) everywhere you,see the placeholder string <<YOUR-MICROSOFT-APP-ID>> (depending on the scenario the Microsoft App Id may occur multiple times in the manifest.json)
    • Add the ngrok domain to the valid domains array in the manifest.
    • Zip up the contents of the teamsAppManifest folder to create a manifest.zip
    • Upload the manifest.zip to Teams (in the Apps view click "Upload a custom app")

Interacting with the bot

Install the Region Selection App manifest in Microsoft Teams. @mention the region selection bot to start the conversation.

  • Bot sends an Adaptive card in chat image
  • Select the region from the card image
  • Bot sets the selected region and notify user in chat image

Interacting with Region Selection Tab

  • Set up the region selection app as a Tab in channel image
  • Select the region from the configuration page and click on save image
  • Tab will display the selected region image

Further reading