User Applications

  1. Firstly, you need to make sure you have the correct permissions to install apps on Microsoft Teams, which is ‘User.ReadWrite.All’ or ‘Directory.ReadWrite.All’ to install the Teams app, and you will also need ‘Chat.Read.All’. Both permissions require admin level consent.
  2. The app might already be installed, and you should check before you reinstall and waste time.

Put the following code in Microsoft Graph.

GET /users/{user-id}/teamwork/installedApps?$expand=teamsAppDefinition&$filter=teamsAppDefinition/teamsAppId eq '{teamsAppid}'

The ‘teamsAppid’ is where you need to put the name of the app you are looking to install. The code will return an empty array if it is not there.

If the app is not installed, you can do so with the following code.

POST /users/{user-id}/teamwork/installedApps
{
"teamsApp@odata.bind" : "https://graph.microsoft.com/beta/appCatalogs/teamsApps/{teamsAppid}"
}

You might need to restart the application in order to view the installation in-case you were running Microsoft Teams in the background.

Next page: Chat thread

3. Now that the bot has all the information it needs and you should be able to send a proactive message.