This blog is about SharePoint, Office365 and Office Development

Popular Posts

OfficeDev: Introducing Office365 Bot your office 365 assistant is here --Part 1


We all witness the awesomeness of the new bot framework at Build2016 ,in this post we will couple the capabilities of bot framework  with Office365 building blocks via Microsoft Graph APIs. We will create a bot that take a user input as a chat message and execute some Office365 commands The main component of this Office 365 assistant are:
  • Azure AD app
This is simply the access point to Office365, in this walk-through we are going to use app only permission type, not delegated permission, which will enable the bot to communicate with Office365 via Microsoft Graph built-in app without the need of user context. you can follow this guide to learn how to register your app via azure portal.
  • LUIS Model
This is the text processor that will translate the text messages into an intent and extract the needed entities. You can use a built in app like Cortana built-in model or build your own app in this walkthorugh we will build our own LUIS app.
  • Office365 Assitant Bot Built using Nodejs
This is the main component which connects all the  dots together. In order to start, we need to register our bot and get our bot ID and secret, we will use nodejs  to build our office365 assistant bot, simply navigate to https://dev.botframework.com/ and click on Register a bot.

In this Part 1 we will focus on creating the model in Luis.

Building your LUIS app

    1. Navigate to https://www.luis.ai and login using your Microsoft credentials, after login click on New Application
    2. Add Application name and description and choose the application language, then click add app button
    3. Luis will create the application and navigate to it , now let's start building our model
    4. By default we will have one intent (None) and no entities. so let's add an intent and name it bookmeeting , you will notice that the intent dialog will have an utterance example as mandatory which will help Luis to understand more about your intent in a context, let's start with a very simple utterance "book a meeting" and click save
    5. Under new utterance tab Luis will translate this as "bookmeeting" intent , you need to press submit to save this utterance in the app model
    6. Let's add some entities to our model , for instance we need to have an entity for the the name of the person I'm having the appointment with as well as the time of the appointment.
    7. Under entities click the add button and name the entity "name"
    8. Under pre-built entities let's add datetime 
    9. Now let's make our model more interesting , let' s type "book a meeting tomorrow at 9 pm" now the model understand the utterance intent as bookmeeting and it detects date and time "highlighted in grey color" as shown below:
    10. Let's make our model detect the other entity "name" so let's enter this new utterance "book a meeting with amr tomorrow at 9 pm" , the custom entity is not detected automatically , what we need is to highlight the name "amr" and choose it's entity "name" now we are teaching our app that this is the expected value for the name entity.
    11. Let's see if our model is extracting the name correctly by entering this utterance "book a meeting with nick today at 9 pm" we notice that the "nick" is not detected as name yet , so let's highlight nick and try another utterance we will add john and it won't be detected then in the fourth time sally will be successfully translated to the name entity
    12. Now let's publish this app , in the top left cornet there is a publish button will generate an endpoint our bot will use to communicate with the generated model.
Now our Luis model is been created and ready to be consumed by our bot, in the next post we will go through creating a nodejs bot that takes a user input through chat conversation then create an appointment in Office365 using Microsoft Graph APIs.