Share via


Microsoft Flow: Automatic Intelligent Mail Responder Using Sentiment Detection Api

Introduction

In almost all businesses customer care is an indivisible part. One of the important tasks for customer care is to take notice of the emails directed towards them and reply to them on a prompt basis. e.g if the customer sends greetings and kind words to the customer care the team should reply back promptly thanking the user and inviting them back. On the other hand, if the customer complains about the service offered, then the customer care team should promptly reply back to the email promising to contact the customer to understand the issue. The reply pattern can be automated and this automation can help the customer care team to better manage their work and work on the more concerning issues of a customer. This automation can be done by using Microsoft Flow and the Text Analytics API offerings of Microsoft.

↑Back To Top


Basic Concepts

What is Microsoft Flow?

As per Microsoft,

"Microsoft Flow is an online workflow service that enables you to work smarter and more efficiently by automating workflows across the most common apps and services."

Flow and Logic Apps are both designer-first integration services that can create workflows. Both services integrate with various SaaS and enterprise applications. Flow is built on top of Logic Apps. They share the same workflow designer and the same Connectors. Flow empowers any office worker to perform simple integrations (for example, an approval process on a SharePoint Document Library) without going through developers or IT. On the other hand, Logic Apps can enable advanced integrations (for example, B2B processes) where enterprise-level DevOps and security practices are required. It's typical for a business workflow to grow in complexity over time. Accordingly, you can start with a flow at first, then convert it to a logic app as needed.

What are Microsoft Cognitive Services?

As per Microsoft ,

"Microsoft Cognitive Services( formerly Project Oxford) are a set of APIs, SDKs and services available to the developers to make their applications more intelligent, engaging and discoverable. Microsoft Cognitive Services expands on Microsoft's evolving portfolio of machine learning APIs and enables developers to easily add intelligent features such as emotion and video detection; facial, speech and vision recognition; and speech and language understanding - into their applications. Our vision is for more personal computing experiences and enhanced productivity aided by systems that increasingly can see hear, speak, understand and even begin to reason."

↑Back To Top


Scope

This article explains how to intelligently reply back to the customer feedback mails automatically using Microsoft Flow and Microsoft Cognitive Services.

↑Back To Top


Pre Implementation

Creating Text Analytics API Account

In order to use the Text Analytics API in the Sample Application, first, an API account for the Text Analytics API needs to be created. Once this is done, the API will be available to integrate the Text Analytics in the Sample Application. Following screenshot shows the process to do so.

Once the API account is created, select the account from the dashboard and following window is visible, the access keys and end point are required from this window which will be used to create a connection to the Text Analytics API.

  

   

↑Back To Top


Flow Design

The design for the flow is very easy and can be set up in very less time. Following is a step by step guide on how to create the flow to automate the task at hand.

  1. Log On to the Flow portal

  2. Under My flows, create an empty flow.

     

  3. From the list of available triggers, select the "When an Email is received" trigger for Gmail. Allow Flow to access a mailbox by signing in and giving flow the access when prompted. Refer sample screenshot below.

     

     

  4. From the actions select the "Text Analytics Detect Sentiment". Configure the action by creating a valid connection. Provide a unique connection name, keys and the url which can be obtained from the account created in the pre-implementation phase.

     

  5. Now pass the body of the email received to the Text Analytics API. This can be done by selecting the body from the previous action/trigger.

  6. Initialize a string variable to hold the reply that will be sent to the user.

  7. Insert a condition to evaluate the sentiment score returned by the Text Analytics API.  If the score is above 0.6 then another condition to evaluate a positive message( score above 0.9) and neutral message can be inserted. If the sentiment score is less than 0.6 then the other branch gets executed. In each of the cases, the variable created above will get set according to the message.

     

  8. Add the action to send the email from Gmail from the list of available actions. In order to make the Flow send out the reply to the same email, the MessageId should be selected from the trigger used to receive the email. The body is to be configured as HTML.

     

  9. Save the Flow with proper name.

↑Back To Top


Testing

Following are the emails sent and the responses sent out by the flow.

Positive FeedBack 

 

FeedBack:


Hi  Team,
 
I was thoroughly impressed by the services that you provided. Please continue the good work.
 
Cheers,
Mandar
 
Response From Team:


Dear Sender,
We are glad that you enjoyed your stay here. Please give us a chance to serve you again in the future.
 
Regards,
 
HeavenlyStay Customer Care

Negative FeedBack

FeedBack: 
 
Hi  Team,
 
I had one of the worst experiences of my life while staying at your hotel. I think you should improve your service..
 
Cheers,
Mandar
 
Response from Team:


Dear Sender,
 
We are glad that you enjoyed your stay here. Please give us a chance to serve you again in the future.
 
Regards,
 
HeavenlyStay Customer Care

↑Back To Top


Conclusion

As it can be observed from the article, it is very easy to set up a flow to reply back to the customer automatically, Hence anyone with a basic understanding of the processes can set up the flow without much effort. It indeed does support "Work Less, Do More".

↑Back To Top


Further Scope

This flow can be extended to create a grievance ticket on the customer care support system so that the support executives can work on it. This piece of logic can be placed in the branch which deals with the negative feedback.

↑Back To Top


See Also

Following links can be visited to learn about some of the applications of logic apps and the readers can try to implement them in Flow.

↑Back To Top


References

Information from following websites was referred while writing this article.

↑Back To Top