Automation insights and productivity tips from LEAPWORK.

All Posts

How to Classify Emails with AI and Automation

As more and more enterprises are realizing the benefits of using robots to automate mundane tasks, equally many are looking to scale their efforts with AI capabilities.

AI enabled automation allows businesses to not only transfer data faster but also to interpret that data, making the entire process smarter and more efficient.

One use case for this is automation of email classification. As companies have more and more pressure on efficiency and costs, replying to emails or messages in a timely fashion with limited resources at hand can be a challenge.

By using robots and cognitive services, however, classification of emails can be automated, allowing faster and better customer responses.

What you need to get started

To classify emails with AI automation, you need three things:

  • The LEAPWORK automation software – you can download a trial version here:
  • A LUIS cognitive service account – you can get a trial here:
  • An email account – you can use any of the web based email providers (we are going to use in this guide)

The outcome should be a robot that monitors your email, understands the context of the email body, and places the email into the appropriate email folder/inbox/team.

Watch the video to see how it works, or follow the step-by-step guide below to try it yourself.


Step 1: Configure email inbox

The first step is to create a folder and all the underlying subfolders corresponding to the various topics that you want to track

 Configure email inbox

Step 2: Create your smart classifier on

Next, open your Luis cognitive services account and create a new application.

Create your smart classifier 1Within your application, create your intents so that they correspond to the folders that you have defined in your email inbox.Create your smart classifier 2

Add utterances (examples) for each intent that you want tracked.Create your smart classifier 3

Click Train. This will trigger the training of the underlying algorithm using the data you have provides so far.Create your smart classifier 4

Click Publish. Now you will be able to expose the application as a web service to the outside, which will mean you can send the text to it via REST API calls.Create your smart classifier 5

Get the application details and save them. You will need them once you have built your automation flow.Create your smart classifier 6

Step 3: Create your automation workflow using LEAPWORK

First, set up a flow like the one below that automates the log in to your email account.Create your automation workflow using LEAPWORK 1

Once you have logged in, you can go through the list of emails that you have in your inbox.

For each email it will read the text in the body and send that to the LUIS service we created earlier (also called a REST API request).

The LUIS application gives you a good set of examples on how to create the requests. You can also see it in our flow.

The service will send us back a response. Once we check and approve that process, we can proceed.Create your automation workflow using LEAPWORK 2

The next step will be to extract the value of interest from the response file (JSON file). Here is an example of how it looks:

  "topScoringIntent": {

    "intent": "internet banking",

    "score": 0.400545418

What we do in the automation flow is to specify what to extract and from where. In our example, that would be “internet banking”. Once we have that, we can proceed to the next step.Create your automation workflow using LEAPWORK 3

The last step in our automation flow is to move the actual email into the underlying folder that corresponds to the identified value by our LUIS application. In our example, that is the “internet banking” folder.

Create your automation workflow using LEAPWORK 4And that’s it! Now we have an automated flow that reads our emails and classifies them accordingly in the corresponding folders.

A last piece of advice is that if you want to improve the accuracy of the LUIS application, more examples for each intent will help you achieve that.

Curious to learn more about no-code automation? Sign up for our next webinar.

New call-to-action

Maria Homann
Maria Homann
Content Marketing Manager

Related Posts

Best Practices for Building Maintainable and Scalable Test Automation

There’s a major difference between automating twenty test cases and automating 2000 test cases; while it’s completely possible to take an ad-hoc approach when there are only a few test cases, it becomes an entirely different story when test cases run into the thousands.

How to Build Stable Test Automation

Test automation brings many benefits with it, such as increased execution and reduced risk. But these benefits may be diminished if the tests aren’t performing as intended. There are several reasons why tests become unstable, most of which you can turn around by following these best practices and guidelines.

How to Effectively Analyze Test Automation Results

If you have introduced test automation as a means to achieve more efficient testing, you’re probably also interested in making the test result analysis process as efficient as possible. This requires the right approach and the right set of tools.