Pages Menu
TwitterRssFacebook

Posted by on Jul 30, 2020 in Development, Microsoft Teams

It’s now much easier to send proactive bot messages to Microsoft Teams users, thanks to new permissions

It’s now much easier to send proactive bot messages to Microsoft Teams users, thanks to new permissions

Sending pro-active messages to users has also been a bit tricky in Microsoft Teams. Because bot messages are delivered via the Bot Framework, there wasn’t a good model for pro-active delivery where the user hadn’t already initiated a conversation with a bot.

There were a few workarounds, but it was always a bit messy because it required the user to install an app first. The whole point of proactive messaging is to reach users that aren’t interacting with your application, so they’re also unlikely to install your application.

Now, however, there are new Microsoft Graph permissions to help you out. A very specific permission can be granted to an application, which will let that application install itself for a user, or a team. This is different from a wide permission allow any application to be installed – instead this is scoped just to the application in question.

There are now two new permissions in Graph:

TeamsAppInstallation.ReadWriteSelfForUser.All – Allows a Teams app to read, install, upgrade, and uninstall itself for any user, without prior sign in or use.

TeamsAppInstallation.ReadWriteSelfForTeam.All – Allows a Teams app to read, install, upgrade, and uninstall itself in any team, without prior sign in or use.

Both of these permissions work in the same way.  You should first see whether the user/team you want to send to already has your app installed. You can do this with a GET request.

Then, assuming it isn’t, send a POST request to install your app. Note that you only need the scoped permission above now, not the full User.ReadWrite.All, Directory.ReadWrite.All previously required.

There’s more information on doing this, with some sample Graph calls, on the Microsoft Docs page: Enable proactive bot installation and proactive messaging in Teams with Microsoft Graph


As a Microsoft Teams developer, it’s really good to see Microsoft introducing more scoped permissions. It makes deploying applications easier and enables scenarios like proactive messaging.

Written by Tom Morgan

Tom is a Microsoft Teams Platform developer and Microsoft MVP who has been blogging for over a decade. Find out more.
Buy the book: Building and Developing Apps & Bots for Microsoft Teams. Now available to purchase online with free updates.

Post a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.