This sample app illustartes the proactive installation of app using Graph API and sending proactive notification to users from GroupChat or Channel.
Language Used : Nodejs
-
Node.js version 10.14 or higher
# determine node version node --version
- Clone the repository
git clone https://github.com/OfficeDev/microsoft-teams-samples.git
- In a terminal, navigate to
samples/javascript_nodejs/graph-proactive-installation
cd samples/graph-proactive-installation/nodejs
- Install modules
npm install
- Start the bot
npm start
-
Run the bot from Visual Studio Code:
- Launch Visual Studio Code
- Folder -> Open -> Project/Solution
- Navigate to
samples/graph-proactive-installation/nodejs
folder - Select
nodejs
Folder - To run the application required node modules. Please use this command to install modules
npm install
-
Run ngrok - point to port 3978
ngrok http -host-header=rewrite 3978
-
Update the manifest.json file with
Microsoft-App-ID
value and to get TeamsAppCatalogId upload your Manifest for my Organization. -
Go to .env file and add
MicrosoftAppId
,MicrosoftAppPassword
andAppCatalogTeamAppId
information.- To get
AppCatalogTeamAppId
navigate to following link in your browser Get TeamsAppCatalogId from Microsoft Graph explorer. And then search with app name or based on Manifest App id in Graph Explorer response and copy theId
[i.e teamApp.Id]
- To get
-
Required Microsoft graph Application level permissions to run this sample app
- TeamsAppInstallation.ReadWriteForUser.All
-
Get consent for the Application permissions by following steps mentioned here.
-
Run your app, either from Visual Studio code with
npm start
or usingRun
in the Terminal.
-
Install the Proactive App Installation demo in a Team or GroupChat.
-
Team Scope: Run Check and install to pro-actively installs the App for all the users in team. After installation send 'Send message' command to send proactive message.
-
Group Chat: Run Check and install to pro-actively installs the App for all the users in team. After installation send 'Send message' command to send proactive message.