Building Integration solution with Azure Logic Apps

ahmed khemiri
May 1 · 5 min read

Introduction

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.

Prerequisites

  • 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

  1. To create a new logic app, select create a resource > Integration > Logic app
  2. Under Create logic app, provide this information about your logic app as shown and described. When you’re done, choose Pin to dashboard > Create.
  3. 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

  1. 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.

  1. On the designer in the search box, enter “ Text Analytics” as cognitive service API and select Detect sentiment as an option.
  2. Now you’re asked about Connection Name,Cognitive services Account key and Site URL, you need to create a new Text Analytics API.
  3. To create a Text Analytics API, select create a resource > AI + Machine Learning > Text Analytics.
  4. Under create Text Analytics API, provide this information about your API as shown and described. When you’re done, choose Pin to dashboard > Create.
  5. After Azure deploys your API, sentiment quick start opens and shows an overview about your API.
  6. Copy Text Analytics API key and site URL into Text Analytics form located in the logic app designer and choose create.
  7. Select Add new Parameter and choose Text then add new dynamic content body.
  8. let’s move to the next step, on the designer in the search box, enter and select “ Condition”
  9. 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 :

  1. Add new Action.
  2. Choose your email provider.
  3. Select ‘Send Email’ and Specify Body, Subject and email receiver.

IF FALSE condition DO :

  1. Add new Action.
  2. Choose your email provider.
  3. 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

  1. Send yourself an email includes a sentiment expression , maybe happy or disappointed. Wait for the email to appear in your inbox.
  2. To manually start your logic app, on the designer toolbar bar, choose Run.
  3. If sentiment expression is happiness and satisfaction, you will get an automatic reply email “ Thank you for your cooperation”.
  4. If not, you will get a notification email “check out your mailbox, customer is angry”.

ahmed khemiri

Written by

Microsoft Student Partner & Research Master Student in data, knowledge and distributed systems. https://www.linkedin.com/in/ahmed-khemiri-b33400134/

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade