Run local - OfficeDev/microsoft-teams-apps-icebreaker GitHub Wiki
Bot Framework Teams Ice Breaker.
This bot has been created using Bot Framework.
- Microsoft Teams is installed and you have an account
- .NET Framework version 4.7
- ngrok or equivalent tunneling solution
- Azure Cosmos Emulator for local development with Cosmos DB
- Visual Studio (2017 or higher)
Note these instructions are for running the sample on your local machine, the tunneling solution is required because the Teams service needs to call into the bot.
-
Create Cosmos DB locally through the emulator
- Open Azure Cosmos DB emulator
- From the system tray icon
- This should open this URL in the browser (https://localhost:8081/_explorer/index.html)
- Write down URL, Primary Key values as we will paste them in source code configuration
- Click on Explorer left menu, wait until emulator initialize and activate the page
- Click on new database
- Fill in the database id field with "icebreaker-storage" name.
-
Clone the repository
git clone https://github.com/OfficeDev/microsoft-teams-icebreaker-app.git
-
If you are using Visual Studio
- Launch Visual Studio
- File -> Open -> Project/Solution
- Navigate to
Source
folder - Select
Icebreaker.sln
file
-
Run ngrok - point to port 3979
ngrok http -host-header=rewrite 3979
Write down the https URL to be used later.
-
Register Microsoft Azure AD application
Register one multi-tenant Azure AD application with one Secret.
-
Log in to the Azure Portal for your subscription and go to the “App registrations” blade at https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredAppsPreview.
-
Click on "New registration" and create an Azure AD application.
- Name: The name of your Teams app - if you are following the template for a default deployment, we recommend "Icebreaker".
- Supported account types: Select "Accounts in any organizational directory"
- Leave the "Redirect URI" field blank.
-
Click on the "Register" button.
-
When the app is registered, you will be taken to the app's "Overview" page. Copy the Application (client) ID; we will need it later. Verify that the "Supported account types" is set to Multiple organizations.
-
On the side rail in the Manage section, navigate to the "Certificates & secrets" section. In the Client secrets section, click on "+ New client secret". Add a description for the secret and select an expiry time. Click "Add".
-
Once the client secret is created, copy its Value; we will need it later.
At this point you have 2 unique values:
- One application (client) ID
- One client secret
-
-
Create Bot Framework registration resource in Azure
- Use the current
https
URL you were given by running ngrok. Append with the path/api/messages
used by this sample - Ensure that you've enabled the Teams Channel
- Use the current
-
Update the
web.config
configuration. Fill in the missing values:- MicrosoftAppId: The Application (client) ID from the Azure AD application created above.
- MicrosoftAppPassword: The client secret from the Azure AD application created above.
- CosmosDBEndpointUrl: The "URI" from Azure Cosmos DB Emulator page.
- CosmosDBKey: The "Primary Key" from the Azure Cosmos DB Emulator page.
- CosmosDBDatabaseName: Same name you used when creating Cosmos DB in the emulator page. (Default is "icebreaker-storage").
- APPINSIGHTS_INSTRUMENTATIONKEY: This one can be filled if you created an app insights resource on the Azure portal for troubleshooting purposes. Or can be ignored locally.
- AppBaseDomain: This should be the ngrok url domain we copied earlier. If URL is https://ab********.ngrok.io, then base domain will be ab********.ngrok.io only.
-
This step is specific to Teams.
-
Edit the
manifest.json
contained in theManifest
folder to replace your Microsoft App Id (that was created when you registered your bot earlier) with the place holder string<bot id>
- Replace
<app domain>
in manifest file with the same value used for AppBaseDomain in web.config above (ab********.ngrok.io) - Replace
<company name>
,<website url>
,<privacy url>
, and<terms of use url>
fields with values of your choice. -
Zip up the contents of the
Manifest
folder to create amanifest.zip
-
Upload the
manifest.zip
to Teams (in the Apps view click "Upload a custom app")
-
Edit the
-
Run your bot, from Visual Studio with
F5
.
Note: After installing the bot in a team. You can trigger the matching algorithm manually from PostMan or Curl.
Curl tool:
curl --header "X-Key: 19c6e180-0c37-4056-bbf7-11810f6f9305" http://localhost:3979/api/processnow/
Powershell:
curl -H @{"X-Key" = "19c6e180-0c37-4056-bbf7-11810f6f9305"} http://localhost:3979/api/processnow
Postman:
Once the match is done, the bot will send messages to matched pairs to plan their meeting.