page_type | description | products | languages | extensions | urlFragment | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sample |
Microsoft Teams tab sample app for demonstrating tab in stage view |
|
|
|
officedev-microsoft-teams-samples-tab-stage-view-nodejs |
This App talks about the Teams tab in stage view with Nodejs. For reference please check Tabs link unfurling and Stage View
- Bots
- Stage View (tabs)
Please find below demo manifest which is deployed on Microsoft Azure and you can try it yourself by uploading the app package (.zip file link below) to your teams and/or as a personal app. (Sideloading must be enabled for your tenant, see steps here).
Stage View: Manifest
-
Office 365 tenant. You can get a free tenant for development use by signing up for the Office 365 Developer Program.
-
To test locally, NodeJS must be installed on your development machine (version 16.14.2 or higher).
# determine node version node --version
-
To test locally, you'll need Ngrok installed on your development machine. Make sure you've downloaded and installed Ngrok on your local machine. ngrok will tunnel requests from the Internet to your local computer and terminate the SSL connection from Teams.
NOTE: The free ngrok plan will generate a new URL every time you run it, which requires you to update your Azure AD registration, the Teams app manifest, and the project configuration. A paid account with a permanent ngrok URL is recommended.
-
Setup for Bot
- Register Azure AD application
- Register a bot with Azure Bot Service, following the instructions here.
- While registering the bot, use
https://<your_ngrok_url>/api/messages
as the messaging endpoint.
NOTE: When you create your app registration in Azure portal, 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"
- Setup for code
-
Clone the repository
git clone https://github.com/OfficeDev/Microsoft-Teams-Samples.git
-
In a console, navigate to
samples/tab-stage-view/nodejs
folder -
Install modules
npm install
-
Update the
.env
configuration for the bot to use theMicrosoftAppId
(Microsoft App Id) andMicrosoftAppPassword
(App Password) from the Azure bot registration in Azure portal or Bot Framework registration. Also updateBaseUrl
according to your code runtime environment.
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.
-
Run your bot at the command line:
npm start
-
Install modules & Run the NodeJS Server
-
Server will run on PORT: 3978
-
Open a terminal and navigate to project root directory
npm run server
-
-
This command is equivalent to: npm install > npm start
-
Setup Manifest for Teams
-
This step is specific to Teams.
- Edit the
manifest.json
in theManifest
folder and replace the following details: <<MANIFEST-ID>>
with some unique GUID orMicrosoftAppId
<<BASE-URL>>
with your application's base url, e.g. https://1234.ngrok-free.app<<YOUR-MICROSOFT-APP-ID>>
with theMicrosoftAppId
received from AAD app registration in Azure portal.<<DOMAIN-NAME>>
with the ngrok URL or app hosted base url. Note: If you want to test your app across multi hub like: Outlook/Office.com, please update themanifest.json
in thetab-stage-view\nodejs\Manifest_Hub
folder with the required values.- Zip up the contents of the
Manifest
folder to create aManifest.zip
orManifest_Hub
folder to create aManifest_Hub.zip
- Upload the
manifest.zip
to Teams (in the Apps view click "Upload a custom app") - Go to Microsoft Teams. From the lower left corner, select Apps - From the lower left corner, choose Upload a custom App - Go to your project directory, the ./Manifest folder, select the zip folder, and choose Open. - Select Add in the pop-up dialog box. Your tab is uploaded to Teams.
- Edit the
Note: If you are facing any issue in your app, please uncomment this line and put your debugger for local debug..
- In the navigation bar located at the far left in Teams, select the ellipses ●●● and choose your app from the list.
Welcome message with feature explanation and Adaptive Card with actions:
Opening stage view from Adaptive Card Action:
Opening stage view from Adaptive card via deep link:
Tab with execute deep link action to open stage view:
-
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.
- Ensure that you've enabled the Teams Channel