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"
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.
-
.NET Core SDK version 3.1
# determine dotnet version dotnet --version
-
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
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
andMicrosoft-App-Password
andmessage endpoint
in Bot configuration - Connect your Bot with Emulator, Ping the Bot to start the conversation
- Edit the
manifest.json
contained in theManifest
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 themanifest.json
)- Add the ngrok domain to the valid domains array in the manifest.
- Zip up the contents of the
teamsAppManifest
folder to create amanifest.zip
- Upload the
manifest.zip
to Teams (in the Apps view click "Upload a custom app")
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
- Select the region from the card
- Bot sets the selected region and notify user in chat