System Architecture

Azure

Azure Bot Service provides an integrated environment that is purpose-built for bot development, enabling you to build, connect, test, deploy, and manage intelligent bots, all from one place.

Blob Storage

The users’ information, such as their name and progress are stored in a storage. The bot can utilize the information to help the users. For instance, if a user hasn't done watching a tutorial, when he comes back to on-board the bot will remind him about the last tutorial and suggest if he wants to continue watching the video.

Microsoft Graph API

We used Microsoft Graph to access users' data after they authenticated. We send GET or POST HTTP request to the API that allow us for instance get the user's name, ID or set an event in his diary.

LUIS Cognitive Service

Language Understanding [3] (LUIS) is a cloud-based API service that applies custom machine-learning intelligence to a user's conversational, natural language text to predict overall meaning, and pull out relevant, detailed information. We used LUIS to provide our bot more natural conversation feel and smooth the interaction between the bot and the user.

QnA Maker Service

QnA Maker [4] is a cloud-based API service that creates a conversational, question and answer layer over your data. We used the QnA Maker to allow the users to request a tool or tutorial he wants to learn about directly by typing for instance 'I want to learn about OneDrive'.

Channel

The channel refers to the platform that the bot would be running on, such as Teams or Skype.

Design Pattern

Template Method

A Template Method defines the skeleton of an algorithm in an operation and defers some steps to client subclasses [1]. It allows subclasses to redefine steps of the algorithm without changing the algorithm structure.

Our bot uses Waterfalldialog, this lets us encapsulates different subclass dialogues to guide the user through a series of tasks. At each step, the bot prompts the user for input, waits for a response, and then passes the result to the next step, guiding the user step by step while allowing for easier development.

State Design Pattern

The State pattern is a solution to the problem of how to make behavior depend on state .

To make our bot smart, it is important for it to know the progress or state of the user. Therefore, the bot displays dialogues differently according the user’s progress with the bot. The tutorials the user have seen will be marked with a tick the next time he comes across the option, allowing the user to know what he has seen. Furthermore, if the user closed to bot before finishing the video, the bot will be aware of this state and asks if the user wishes to continue the video the next time he uses the bot.

Singleton pattern

The singleton pattern restricts the instantiation of a class to one "single" instance. It is useful when exactly one object is needed to coordinate actions across the system[5].

The LUIS (Language Understanding)[1] service our bot uses is kept in botservice.cs as a singleton, the external service is configured. This is done as the ownership of the single instance cannot be provided, it allows for lazy initialization and the LUIS service's global access is otherwise not provided for.

Prototype Design Pattern

Prototype Design Pattern declares an abstrast base class with "cloneable" methods.

Our bot's logging class provides many unimplemented methods which are easily implemented into the bot for logging to the telemetry, allowing for easy testing. For example, we used the logging both for creating data to test data visualisation in a different version of the bot which did not require user's microsft account.

References

[1] diberry. 2019. What is Language Understanding (LUIS) - Azure Cognitive Services | Microsoft Docs. [ONLINE] Available at: https://docs.microsoft.com/en-us/azure/cognitive-services/luis/what-is-luis.

[2] tulasim88. 2019. What is QnA Maker? - Azure Cognitive Services | Microsoft Docs. [ONLINE] Available at: https://docs.microsoft.com/en-us/azure/cognitive-services/qnamaker/overview/overview.

[3] Source Making (2017) Template Method Design Pattern. Available at: https://sourcemaking.com/design_patterns/template_method

[4] Source Making (2017) State Design Pattern. Available at: https://sourcemaking.com/design_patterns/state

[5] Source Making (2017) Singleton Design Pattern. Available at: https://sourcemaking.com/design_patterns/singleton

Implementation of Finished Functionalities

Main Implementation

To implement the conversation of our bot, we used Dialogs [1], which are a central concept in the SDK, and provide a useful and easier way to manage conversations with the user. They are structures that act like functions in the bot's program. Each dialog can be designed to perform a specific task, in a specific order. There exists several types of dialogs, one of them is the Waterfall Dialog, which is the one we used.



The Waterfall dialog is mainly used to collect information and guide the user through a series of tasks. In each step the user is prompted with a message and options to choose from, this is done to facilitate the use of our bot and to guide the user through the conversation. The main conversation flow is implemented in the MainDialog.cs file:

Implementation of Key functionalities


Sending resources to the users as required

After choosing the tool and the tutorial, the tutorial video is sent using this method.





Having Authentication

As soon as the user sends a message the bot send an AuthPrompt to let the user authenticate.





Saving User Progress

For each tool, we save the number of the tutorial watched in a list which is located in the UserState.cs file









Understanding and responding to simple sentences

Using Language Understanding, called LUIS, our bot is able to understand simple sentences such as 'cancel' and 'help'. After creating our LUIS app by adding intents, utterances and entities, we connected our bot to the app with the following code which can be found in BotServices.cs.







Setting up a Session in User's Calendar

Using Microsoft Graph, this method send a POST HTTP Request with the session start and end time and returns the session ID





Finding Free Time in User's Calendar

To find free time for the user to on-board according to his diary, we use Microsoft Graph. We send a POST HTTP Request with a freeTimeRequest that includes the start and end dates of our search. This method returns timeslots suggests where the user is free during this week.

References

  • [1] johnataylor. 2019. Dialogs within the Bot Framework SDK - Bot Service | Microsoft Docs. [ONLINE] Available at:https://docs.microsoft.com/en-us/azure/bot-service/bot-builderconcept-dialog?view=azure-bot-service-4.0&viewFallbackFrom=azurebot-service-4.0. [Accessed 20 April 2019].