Businesses are moving toward digitization, logic apps help you connect legacy, modern, and cutting-edge systems more easily and quickly by providing prebuilt APIs as Microsoft-managed connectors. That way, you can focus on your apps business logic and functionality. You don’t have to worry about building, hosting, scaling, managing, maintaining, and monitoring your apps.
In this article, we’ll see how you can build a logic app that handles incoming business emails. This logic app analyzes the email content, evaluate sentiment in order to get a sense of how customer feel about the product and sends a notification email to view the content or an automatic reply email “Thank you for your cooperation’’ depends in customer sentiment.
- An email account from an email provider supported by Logic Apps, such as Office 365 Outlook, Outlook.com, or Gmail. For other providers, review the connectors list here.
- This logic app uses an Office 365 Outlook account. If you use a different email account, the general steps stay the same, but your UI might appear slightly different.
Sign in into the Azure Portal
Sign in to the Azure portal with your Azure account credentials.
If you are currently a student, you can activate your benefit with Azure for Students and start building the future with Azure. https://azure.microsoft.com/fr-fr/free/students/
Create your logic app
- To create a new logic app, select create a resource > Integration > Logic app
- Under Create logic app, provide this information about your logic app as shown and described. When you’re done, choose Pin to dashboard > Create.
- After Azure deploys your app, the Logic Apps Designer opens and shows a page with an introduction video and templates for common logic app patterns. Under Templates, choose Blank Logic App.
Next, add a trigger that listens for incoming emails.
Every logic app must start with a trigger, which fires when a specific event happens or when new data meets a specific condition.
Monitor incoming emails
- On the designer in the search box, enter “when new email arrives” as your filter. Select this trigger for your email provider: When a new email arrives — <your-email-provider>
- For Azure work or school accounts, select Office 365 Outlook.
- For personal Microsoft accounts, select Outlook.com.
2. If you’re asked for credentials, sign in to your email account so Logic Apps can connect to your email account.
3. Now provide the criteria the trigger uses to filter new email.
4.Specify the folder, interval, and frequency for checking emails.
5.Save your logic app. On the designer toolbar, choose Save.
Your logic app is now live, but doesn’t do anything other check your emails. Next, add the action html to text to convert HTML document to plain text, then select body.
Analyze email content and evaluate customer sentiment
In this part, we’ll see how to use Text Analytics API in order to analyze email content and get a sense of how customer feel about product, it provides advanced natural language processing over raw text and include sentiment analysis.
- On the designer in the search box, enter “ Text Analytics” as cognitive service API and select Detect sentiment as an option.
- Now you’re asked about Connection Name,Cognitive services Account key and Site URL, you need to create a new Text Analytics API.
- To create a Text Analytics API, select create a resource > AI + Machine Learning > Text Analytics.
- Under create Text Analytics API, provide this information about your API as shown and described. When you’re done, choose Pin to dashboard > Create.
- After Azure deploys your API, sentiment quick start opens and shows an overview about your API.
- Copy Text Analytics API key and site URL into Text Analytics form located in the logic app designer and choose create.
- Select Add new Parameter and choose Text then add new dynamic content body.
- let’s move to the next step, on the designer in the search box, enter and select “ Condition”
- Now you need to add your condition.
Score : A decimal number between 0 and 1 denoting the sentiment of the document. A score above 0.7 usually refers to a positive document while a score below 0.3 normally has a negative connotation. Mid values refer to neutral text.
10. On the designer toolbar, choose Save.
Send a notification or an automatic reply email
In this part, we’ll see how you can send a notification or an automatic reply email depends in customer sentiment, which means if a customer is happy about the product he will get an automatic reply email “ Thank your for your cooperation” but when a customer is dissapointed about a product, you will get a notification email told you that you have an angry customer.
IF TRUE condition DO :
- Add new Action.
- Choose your email provider.
- Select ‘Send Email’ and Specify Body, Subject and email receiver.
IF FALSE condition DO :
- Add new Action.
- Choose your email provider.
- Select ‘Reply to email’ and Specify Message ID, email comment and turn Reply All option to YES.
On the designer toolbar, choose Save.
Run your logic app
- Send yourself an email includes a sentiment expression , maybe happy or disappointed. Wait for the email to appear in your inbox.
- To manually start your logic app, on the designer toolbar bar, choose Run.
- If sentiment expression is happiness and satisfaction, you will get an automatic reply email “ Thank you for your cooperation”.
- If not, you will get a notification email “check out your mailbox, customer is angry”.