Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
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
office-teams
office
office-365
csharp
contentType createdDate
samples
07/07/2021 01:38:27 PM
officedev-microsoft-teams-samples-tab-deeplink-csharp

DeepLink

This sample displays deeplinks for call, video, chat, navigate to app and navigate within tab pages which are supported for tab and bot.

Included Features

  • Tabs
  • Bots
  • Deep Links

Interaction with bot

Welcome Card Flow

bot-conversations

Deeplink Tab Flow

bot-conversations

Prerequisites

  • 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

Setup

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.

  1. Register a new application in the Microsoft Entra ID – App Registrations portal.

  2. 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.

  1. 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
  1. Setup for code
  • Clone the repository

    git clone https://github.com/OfficeDev/Microsoft-Teams-Samples.git
  • Update channelID placeholer <AddYourTeamsChannelId> value in your DeepLinkBot.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 ) like General channel) Example: 19:cbe3683f25094106b826c9cada3afbe0@thread.skype

  • Navigate to wwwroot/js/env.js file and update your AppId at placeholder <<App-ID>> (You can get it manually frrm teams admin portal. - personal-AddedBot

  • 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 the appsettings.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 or DeeplinkBot.slnfile
    • Run your bot, either from Visual Studio with F5 or using dotnet run in the appropriate folder.
  1. This step is specific to Teams.
    • Edit the manifest.json contained in the AppManifest 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 the manifest.json and {{domain-name}} with base Url domain. E.g. if you are using ngrok it would be 1234.ngrok-free.app and if you are using dev tunnels then your domain will be 12345.devtunnels.ms.
    • Edit the manifest.json for validDomains with base Url domain. E.g. if you are using ngrok it would be https://1234.ngrok-free.app then your domain-name will be 1234.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 the manifest.json in the tab-deeplink\csharp\DeepLinkBot\AppManifest_Hub folder with the required values.
    • Zip up the contents of the Manifest folder to create a Manifest.zip or AppManifest_Hub folder into a AppManifest_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)

Note: If you are facing any issue in your app, please uncomment this line and put your debugger for local debug.

Running the sample

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.

  1. 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:

      personal-AddBot

      Added bot UI:

      personal-AddedBot

      Show Welcome command interaction:

      personal-WelcomeCard-Interaction

      Show Deeplink Tab:

      personal-WelcomeCard-Interaction

    • Teams Scope Interactions:

      Adding bot UI:

      Team-AddBot

      Team Selection for app:

      Team-AddedBot

      App Setup for the specific Team:

      Team-AddedBot

      Show instraction for the team:

      Team-WelcomeCard-Interaction

      Show Deeplink Tab:

      Team-WelcomeCard-Interaction

    • Chat Scope Interactions:

      Adding bot UI:

      Chat-AddBot

      Chat User Selection:

      Chat-AddedBot

      App setup for the specific chat user:

      Chat-AddedBot

      Show user instraction tab:

      Chat-WelcomeCard-Interaction

    • Meeting Scope Interactions:

      Adding tab UI:

      Meeting-AddBot

      Meeting Selection:

      Meeting-AddedBot

      App setup for the specific chat user:

      Meeting-AddedBot

      Show user instraction tab:

      Meeting-WelcomeCard-Interaction

    • Deeplink to meeting side panel:

      @mention bot in meeting chat to get adaptive card.

      Bot-Adaptive-Card

      Click on Side Panel Deeplink which will redirect to meeting side panel.

      Meeting-Sidepanel

    • Tab Interactions:

      Deeplink to Audio Call:

      Audio-Deeplink

      Deeplink to Video Call:

      Video-Deeplink

      Deeplink to Meeting schedule:

      Meeting-Schedule

      Deeplink to Polly app install dialog:

      App-Install-Dialog

      Deeplink to start new chat:

      Start-New-Chat

      New-Chat

      Deeplink to channel conversation:

      Show-Channel-Conversation

      channel-Conversation

Outlook on the web

  • 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

InstallOutlook

Select your app icon to launch and preview your app running in Outlook on the web

AppOutlook

Note: Similarly, you can test your application in the Outlook desktop app as well.

Office on the web

  • 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

InstallOffice

Select your app icon to launch your app in Office on the web

AppOffice

Note: Similarly, you can test your application in the Office 365 desktop app as well.

Deploy the bot to Azure

To learn more about deploying a bot to Azure, see Deploy your bot to Azure for a complete list of deployment instructions.

Further reading