Skip to content

Latest commit

 

History

History
74 lines (59 loc) · 4.22 KB

File metadata and controls

74 lines (59 loc) · 4.22 KB
page_type description products languages extensions contentType createdDate
sample
This sample illustrates how you can use Proactive installation of app for user and send proactive notification by calling Microsoft Graph APIs.
office-teams
office
office-365
csharp
samples
07-07-2021 13:38:26

Proactive Installation Sample App

This sample app illustartes the proactive installation of app using Graph API and sending proactive notification to users from GroupChat or Channel.

Language Used : C#

Prerequisites

Tools

  • Microsoft Teams is installed and you have an account
  • .NET Core SDK version 3.1
  • ngrok or equivalent tunnelling solution

To try this sample

  • 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/messages as the messaging endpoint.

    NOTE: When you create your bot you will create an App ID and App password - make sure you keep these for later.

  1. Clone the repository
     git clone https://github.com/OfficeDev/microsoft-teams-samples.git
  2. Run the bot from a terminal or from Visual Studio:
    • Launch Visual Studio
    • File -> Open -> Project/Solution
    • Navigate to samples/graph-proactive-installation/csharp folder
    • Select ProactiveAppInstallation.sln file
    • Press F5 to run the project
  3. Run ngrok to point to port 3978
    ngrok http -host-header=rewrite 3978
  4. Update the manifest.json file with Microsoft-App-ID value and to get TeamsAppCatalogId upload your Manifest for my Organization. image
  5. Go to appsettings.json and update MicrosoftAppId , MicrosoftAppPassword, TeamsappcatalogAppId information.
    • To get TeamsappcatalogAppId you first navigate to following link in your browser Get TeamsAppCatalogId from Microsoft Graph explorer. Then search with app name or based on Manifest App id in Graph Explorer response and copy the Id [i.e teamApp.Id]
  6. Required Microsoft graph Application level permissions to run this sample app
    • TeamsAppInstallation.ReadWriteForUser.All
  7. Get consent for the Application permissions by following steps mentioned here.
  8. Run your app, either from Visual Studio with F5 or using dotnet run in the appropriate folder.

Interacting with the Proactive installation App in Teams

  • Install the Proactive App Installation demo in a Team or GroupChat. image

  • 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. image

  • 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. image

Further Reading