page_type | description | products | languages | extensions | urlFragment | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sample |
Microsoft Teams sample which displays deeplinks for call, video, chat, navigate to app and navigate within tab pages which are supported for tab and bot |
|
|
|
officedev-microsoft-teams-samples-tab-deeplink-csharp |
This sample displays deeplinks for call, video, chat, navigate to app and navigate within tab pages which are supported for tab and bot.
- Tabs
- Bots
- Deep Links
-
Microsoft Teams is installed and you have an account (not a guest account)
-
.NET Core SDK version 6.0
# determine dotnet version dotnet --version
-
dev tunnel or ngrok latest version 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 Microsoft Entra ID – App Registrations portal.
-
Setup for Bot
-
Register a Microsoft Entra ID 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_tunnel_domain>/api/messages
as 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 3978 --host-header="localhost:3978"
Alternatively, you can also use the
dev tunnels
. Please follow Create and host a dev tunnel and host the tunnel with anonymous user access command as shown below:devtunnel host -p 3978 --allow-anonymous
- Setup for code
-
Clone the repository
git clone https://github.com/OfficeDev/Microsoft-Teams-Samples.git
-
Update channelID placeholer
<AddYourTeamsChannelId>
value in yourDeepLinkBot.cs
file 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 ) likeGeneral
channel) Example:19:[email protected]
-
Navigate to
wwwroot/js/env.js
file and update your AppId at placeholder<<App-ID>>
(You can get it manually frrm teams admin portal. - -
Update the
appsettings.json
configuration 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/csharp
folder - Select
DeeplinkBot.csproj
orDeeplinkBot.sln
file - Run your bot, either from Visual Studio with
F5
or usingdotnet run
in the appropriate folder.
- This step is specific to Teams.
- Edit the
manifest.json
contained in theAppManifest
folder 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.json
and{{domain-name}}
with base Url domain. E.g. if you are using ngrok it would be1234.ngrok-free.app
and if you are using dev tunnels then your domain will be12345.devtunnels.ms
. - Edit the
manifest.json
forvalidDomains
with base Url domain. E.g. if you are using ngrok it would behttps://1234.ngrok-free.app
then your domain-name will be1234.ngrok-free.app
and if you are using dev tunnels then your domain will be like:12345.devtunnels.ms
. Note: If you want to test your app across multi hub like: Outlook/Office.com, please update themanifest.json
in thetab-deeplink\csharp\DeepLinkBot\AppManifest_Hub
folder with the required values. - Zip up the contents of the
Manifest
folder to create aManifest.zip
orAppManifest_Hub
folder into aAppManifest_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.zip
to 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
Note: If you are facing any issue in your app, please uncomment this line and put your debugger for local debug.
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 tab UI:
Meeting Selection:
App setup for the specific chat user:
Show user instraction tab:
-
Deeplink to meeting side panel:
@mention
bot in meeting chat to get adaptive card.Click on
Side Panel Deeplink
which will redirect to meeting side panel. -
Tab Interactions:
Deeplink to Audio Call:
Deeplink to Video Call:
Deeplink to Meeting schedule:
Deeplink to Polly app install dialog:
Deeplink to start new chat:
Deeplink to channel conversation:
-
-
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.