Improve your email sentiment using machine learning and an Outlook add-in

¬†As we nurture our culture in Microsoft, we are encouraged to embrace the growth mindset. We are better together, especially when fostering an inclusive and diverse environment. Constructive feedback is key to help you and your colleagues to grow. Today’s post is about adding another tool to your constructive feedback mission.

In this post, we will build an application level add-in, and deploy it to Outlook using Microsoft Visual Studio Tools for Office (VSTO). The add-in will use Microsoft Cognitive Services Text Analytics API to analyze the sentiment of your email contents, and give you feedback.

You can find the source code of our sample on GitHub: https://github.com/codedebate/Samples-ConstructiveFeedbackAddIn.

Step 1: Let’s agree on the scope of our sample

Honestly, it took me a while to agree on a direction. Should the add-in analyze automatically the sentiment of every email using machine learning? or should it be reactive, where users will have to consult it?

When its about user experience, automatically scanning every email the user sends makes a lot of sense, yet requires lots of maintenance e.g. anonymization list to remove all keywords that might indicate your identity like company names, products, and even people before consulting Microsoft Cognitive Services Text Analytics API. In addition, the need of the user consent, privacy, etc.

To ease the pace, we will host our logic inside an Office Ribbon button to be invoked re-actively upon the user’s wish.

Being hosted within the same process, application level add-ins should be thin aka most if not all the logic processing should happen externally. Therefore, we will create an ASP.NET Web API and deploy it to an Azure Web App. When invoked, the add-in will send a POST action to the API with the content of the email. Upon receiving the response, it will display a message with the detected sentiment.

The below screenshots describe the add-in in action. Notice that I used the sentiment visuals from Twemoji on Git Hub and WordPress Emoji Everywhere. Twitter open sourced and published them on Git Hub. Thank you Twitter ūüôā

998-vsto-03

Add-in in action with a negative sentiment feedback

998-vsto-04

Add-in with a positive sentiment feedback

Continue reading →

Live Dashboards with Power BI and Azure Stream Analytics

In this post, we will build a Live Dashboard using Power BI. You can find the client’s source code on GitHub: https://github.com/codedebate/Samples-FakeHeartMonitor.

Step 1: Let’s agree on the scope of our sample

Since our target is to build a Live Dashboard using Power BI, we will need a data source that keeps on generating our sample’s live¬†data aka an Event Publisher. Below is an animated GIF¬†screenshot of a Universal Windows Application that I built for this post.¬†¬†In a nutshell, it will¬†fake a heart monitor readings for three different patients.

999-01-clientinaction

Sample client to generate our data stream

The code is very simple, I just used a DispatcherTimer to generate new random readings every second between 80 and 95. Once those are generated, they will be relayed using Azure Service Bus Event Hub and Azure Stream Analytics to our Dashboard in Power BI.

999-01-overview

Fake Heart Beat Rate Monitor Solution

Continue reading →

Building a Skype Bot using Microsoft’s Bot Framework and Azure App Service

Conversations are becoming the new platform of habit. User interaction trends have, and will continue to evolve. If you recall the mid-80s trends, it was all about the Desktop. It then evolved into websites in the mid-90s, and to mobile apps in the mid-00s. Today, we see folks spending their time using messaging applications like Skype, WeChat, and WhatsApp to accomplish more.

Bots are interesting.¬†They rely on Natural Language Processing (NLP) to comprehend our users’ intentions and context. There’s no need to build a user interface every time we need an app,¬†instead we can take advantage of various standard channels through Microsoft’s¬†Bot Framework to connect, present, and visualize our services e.g. Skype, Facebook Messenger, Kik, Slack, SMS by Twilio, and even your own custom Channel.

In this post, we will build together a Skype Bot using Microsoft’s Bot Framework and deploy it to an Azure App Service. You can find the bot’s source code on GitHub: https://github.com/codedebate/Samples-Room-Finder-Bot.

Step 1: Let’s agree on the scope of our sample

Finding a meeting room can be a challenge when you are new to a campus, building, or a specific floor. Imagine picking up¬†your phone and asking a Skype bot for directions. How convenient would that be? ūüôā

A word of advice: as fancy bots may sound, they should always have a specific purpose and mission. Try to stay away from multi purpose bots.

When building a bot, at minimum you will need the following components:

  • Messages Repository: store¬†all bot messages presented to our user. If you decide to hard code them: you will have to re-deploy the bot every time you change a message.
  • Knowledge-base Repository: store the knowledge-base articles. In our case, directions to¬†a meeting room¬†are considered articles.
  • Web App: this is where you will deploy and host¬†the Bot app.

I will use Azure Table Storage for hosting these repositories. This way we do not have to waste time on building some back office website, but instead use the Storage Explorer to manage them. In real life though, you will have to build a back office website e.g. using ASP.NET MVC, where administrators can manage these messages and settings. Furthermore, the source of the Knowledge-base articles would be some line of business application like Dynamics CRM.

20161022-botarchitecturedesign

Room Finder Sample Bot

Continue reading →