| page_type | sample | ||||
|---|---|---|---|---|---|
| description | Microsoft Teams sample app for demonstrating deeplink from Bot chat to Tab consuming Subentity ID | ||||
| products |
|
||||
| languages |
|
||||
| extensions |
|
||||
| urlFragment | officedev-microsoft-teams-samples-tab-deeplink-csharp |
This sample displays how to consume SubEntity Id to DeepLink from Bot to Tab and Tab to Tab.
- Interaction with bot
-
Microsoft Teams is installed and you have an account (not a guest account)
-
.NET Core SDK version 6.0
# determine dotnet version dotnet --version -
ngrok or equivalent tunneling solution
-
M365 developer account or access to a Teams account with the
Note these instructions are for running the sample on your local machine, the tunnelling solution is required because the Teams service needs to call into the bot.
-
Register a new application in the Azure Active Directory – App Registrations portal.
-
Setup for Bot
-
Register a AAD aap registration in Azure portal.
-
Also, 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/messagesas the messaging endpoint.NOTE: When you create your app registration, you will create an App ID and App password - make sure you keep these for later.
- Setup NGROK
-
Run ngrok - point to port 3978
# ngrok http -host-header=rewrite 3978
- Setup for code
-
Clone the repository
git clone https://github.com/OfficeDev/Microsoft-Teams-Samples.git
-
Update channelID placeholer
<AddYourTeamsChannelId>value in yourDeepLinkBot.csfile with your particular channel id from any Team in Teams. (You can get it manually by clicking on 3 dots in any team's channel and fetch it's link and extract the channel id ) likeGeneralchannel) Example:19:cbe3683f25094106b826c9cada3afbe0@thread.skype -
Update the
appsettings.jsonconfiguration for the bot to use the MicrosoftAppId, MicrosoftAppPassword, BaseURL , ChannelEntityId is a unique identifier ,TabEntityId as EntityId from Manifest file ,MannifestAppId as manifest ID from manifest file, generated in Step 1 (App Registration creation). (Note the App Password is referred to as the "client secret" in the azure portal and you can always create a new client secret anytime.) - Also, set MicrosoftAppType in theappsettings.json. (Allowed values are: MultiTenant(default), SingleTenant, UserAssignedMSI) -
If you are using Visual Studio
- Launch Visual Studio
- File -> Open -> Project/Solution
- Navigate to
samples/Tab-deeplink/csharpfolder - Select
DeeplinkBot.csprojorDeeplinkBot.slnfile - Run your bot, either from Visual Studio with
F5or usingdotnet runin the appropriate folder.
- This step is specific to Teams.
- Edit the
manifest.jsoncontained in theManifestfolder to replace your Microsoft App Id (that was created when you registered your bot earlier) everywhere you see the place holder string<<YOUR-MICROSOFT-APP-ID>>value(depending on the scenario the Microsoft App Id may occur multiple times in themanifest.jsonand{{domain-name}}with base Url domain. E.g. if you are using ngrok it would be1234.ngrok.io) - Edit the
manifest.jsonforvalidDomainswith base Url domain. E.g. if you are using ngrok it would behttps://1234.ngrok.iothen your domain-name will be1234.ngrok.io. Note: If you want to test your app across multi hub like: Outlook/Office.com, please update themanifest.jsonin thetab-deeplink\csharp\DeepLinkBot\Manifest_Hubfolder with the required values. - Zip up the contents of the
Manifestfolder to create aManifest.ziporManifest_Hubfolder into aManifest_Hub.zip. (Make sure that zip file does not contains any subfolder otherwise you will get error while uploading your .zip package) - Upload the
manifest.zipto Teams (In Teams Apps/Manage your apps click "Upload an app". Browse to and Open the .zip file. At the next dialog, click the Add button.) - Add the app to personal/team/groupChat scope (Supported scopes)
- Edit the
You can interact with this bot in Teams by sending it a message, or selecting a command from the command list. The bot will respond to the following strings.
- Show Welcome
-
Result: The bot will send the welcome card for you to interact with
-
Valid Scopes: personal, Team, chat, Meeting
-
Personal Scope Interactions:
Adding bot UI:
Added bot UI:
Show Welcome command interaction:
Show Deeplink Tab:
-
Teams Scope Interactions:
Adding bot UI:
Team Selection for app:
App Setup for the specific Team:
Show instraction for the team:
Show Deeplink Tab:
-
Chat Scope Interactions:
Adding bot UI:
Chat User Selection:
App setup for the specific chat user:
Show user instraction tab:
-
Meeting Scope Interactions:
Adding bot UI:
Meeting Selection:
App setup for the specific chat sser:
Show user instraction tab:
-
-
To view your app in Outlook on the web.
-
Go to Outlook on the weband sign in using your dev tenant account.
On the side bar, select More Apps. Your sideloaded app title appears among your installed apps
Select your app icon to launch and preview your app running in Outlook on the web
Note: Similarly, you can test your application in the Outlook desktop app as well.
-
To preview your app running in Office on the web.
-
Log into office.com with test tenant credentials
Select the Apps icon on the side bar. Your sideloaded app title appears among your installed apps
Select your app icon to launch your app in Office on the web
Note: Similarly, you can test your application in the Office 365 desktop app as well.
To learn more about deploying a bot to Azure, see Deploy your bot to Azure for a complete list of deployment instructions.





















