Giuliano De Luca | Blog | delucagiuliano.com Imagine having a personal Office 365 assistant in your daily job routine, which can help you provide all information that you need, like for example who is your manager, scheduling a meeting, displaying and updating your profile picture or list the Microsoft Teams where you are involved and so on.

These are only a few samples of business use cases but just think of the use of Microsoft Graph API that we have really great capabilities to leverage and interesting scenarios that come out.

Giuliano De Luca | Blog | delucagiuliano.com Giuliano De Luca | Blog | delucagiuliano.com

Starting from this assumption, I decided to develop a proof of concept of Bot that we can also consider as a get started, the most important thing of this concept is that the Bot should be able to recognize the user it is communicating with. The first thing to do will be, authenticate the user across oauth2 in the Azure Active Directory grabbing an access token and using it in order to consume the Microsoft Graph API, for the purpose of doing so, in my PoC I used the javascript library ADAL JS. Let’s summarize every step in order to build this scenario:

  1. Create a Bot on Azure (Node.js)
  2. Register the Bot created in the Azure Active Directory of your Office 365 tenant
  3. Test it locally with Bot framework emulator or directly on Teams

This is the final result:

Giuliano De Luca | Blog | delucagiuliano.com

You can find my solution on github: https://github.com/giuleon/O365-Bot-Oauth2