Contents

Build Intelligent Outlook using Azure

About this blog

I created this solution as part of Azure Developer stories, For more info about this competition please go to this website : https://devstories.konfhub.com/ and it was one among top 25 blogs 😍

This blog content was originally posted at my Dev.to site.

What problem are we trying to solve today?

Consider you are working for a company where they restricted access to outlook in your mobile or Consider you don’t want to sync professional mail in your mobile. In either cases there might be a possibility where you will miss to respond back to an escalation mail or feedback mails on time .

Proposed solution

  1. We don’t want to be disturbed for regular mails
  2. We should make our outlook intelligent enough to know that we are only interested in escalation or feedback mails. Right now outlook can’t categorize mails based on these sentiments of the contents.

So in this post, we will see how to make our Outlook intelligent enough to send out a message to our personal mobile number whenever there is an escalation / suggestion mails addressing to us.


Prerequisites

  • Azure Logic apps
  • Azure Functions
  • Azure Cognitive services
  • Twilio

Architecture

https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e166x84cuyitgpowntkv.jpg

Steps to implement workflow

Logic Apps workflow

  • Choose your subscription and create Logic apps https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fwo3zipnwxb5yd073esf.png https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yobbtkxs4d7k0rw9bxu9.png
  • Once logic app is created open the designer view

https://dev-to-uploads.s3.amazonaws.com/uploads/articles/abha6netaq5ai6otrox6.png

  • Select Blank Logic app

https://dev-to-uploads.s3.amazonaws.com/uploads/articles/692qjgzs4unuhsjkxrtf.png

  • Search for Outlook in connectors and triggers and select trigger “When a new email arrives (v2)”

https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zx9njleeq8uo3az9wrsh.png https://dev-to-uploads.s3.amazonaws.com/uploads/articles/535zdcp0ny7vl8jjbi3r.png

  • Mention your mail id in “To or CC” condition

https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qfbkj9c12il6ewfzgq8j.png

  • In the next step choose Text Analytics as an operation and choose Detect sentiment (v2) as action , so that we can detect sentiment of the content of the mail

https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o8dp4jl4zqpgxo1r045r.png

https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cwjfpg6ph3uu6y4djzm5.png

https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cg10dbbm4fn6ubnxwa7g.png

  • In the next step choose Azure function to categorize each sentiment score and in the request body point it to the documents of the sentiment analysis response

https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0iejshtmmok8xw9qn2n3.png https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gpdl6bzamry6z687lier.png

  • Now add condition based on the response of the azure function and if the response is ASAP or NEUTRAL , then send a text message to your registered number in Twilio account

https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ceh6de6zsbhv9otsbuop.png

https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ojwhz11rfjh9buy59o7b.png

Azure function workflow

Based on the sentiment score , we will use azure function to categorize the content of mail that we receive.

Preview of the mail that we sent in earlier step:

https://dev-to-uploads.s3.amazonaws.com/uploads/articles/12dqctj4itfr9jn94iw8.png

Request to sentiment analyzer

https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gtwy8hzvvflx9d7oeln7.png

Response from sentiment analyzer

https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ixqmbv6we6jx7q33m22q.png

And based on the below code snippet we will categorize the above mail as Negative and will tag it as ASAP message and send response back to logic app

https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6pciihpyd3xskgvfgzzh.png

Twilio workflow

  • Once we got response from Azure function it will be send to Twilio workflow based on two conditions , It will check if the response is either ASAP or NEUTRAL . In either of these case we will trigger a message to our configured number in the portal as below

https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vcfjarp993oky7q2sjce.jpg

Act on negative feedbacks ASAP

  • Finally, we made our outlook intelligent enough to send notifications on negative feedbacks from our client

Github Source code

https://github.com/Divakar-kumar/SentimentWebhooks.Outlook

Further steps

Please go ahead and fork the repository to make your outlook more intelligent, where you can implement custom logics based on the sentiment score.