top of page
  • Kyle Hill

Email Machine Learning

This post is going to look at leveraging some of the Microsoft Cognitive services to take the simple concept of email and turn it into a world class differentiator based on language and sentiment analysis, think of this as email machine learning!

Firstly, go and check out the Microsoft Cognitive Services as they provide a huge array of capability and most of them you can try for free! To get started we are going to log into our Dynamics 365 Customer Engagement instance and we should be presented with the following:

Luckily for us, Microsoft have an accelerator for us that will speed us on our way. To access and install this, make sure you navigate to Settings -> Dynamics Marketplace like this:

You should then be presented with the following:

Next, search for ‘email’ and you should see the following:

Click on the ‘Get it now’ option of the first tile that has the title of ‘Email Machine Learning’ and you should then see this:

Agree to the conditions:

You should then be able to click on the blue ‘Continue’ button and be presented with this:

If you are not an Office 365 Global admin, you will need to request the solution install like this:

Select the correct organisation and accept the terms and conditions like this:

You will then be able to click on the blue ‘Agree’ button to proceed where you will then see the solution installation progress like this:

Keep refreshing the page until the status changes to ‘Installed' like this:

Next, you will need to log into the Azure portal and from the landing page, and click on the ‘+ New’ option from the top left of the screen. You should then see this:

Type in ‘text translator’ and you should observe the following:

Select the ‘Translator Text API’ option and you should see this:

Click the blue ‘Create’ button at the bottom left of the page and fill out the details in the next form like this:

You should receive a notification that the deployment has succeeded like this:

Repeat the process of adding a service except this time, select ‘text analytics’. Once this is done, navigate to the Resource Group in Azure where you just created the two services and you should see something similar to the following:

Click on the ‘Text-Analytics-API’ item and you should then see the following:

Select the ‘Keys’ menu item from the navigation tree on the left. You should then see this:

Copy the ‘Key 1’ value into a notepad and repeat this process for the ‘Text-Translation-API’ service.

Once this is done, navigate back to your Dynamics 365 Customer Engagement instance and then select Settings -> Processes like this:

You should then see the following:

Navigate down to and open the item that says ‘MicrosoftLabs.EmailTextAnalytics.Workflow’. You should see a screen like this:

Click on the ‘Deactivate’ button from the ribbon to enable you to edit the workflow. You should be asked to confirm the deactivation like this:

Confirm this by clicking on the ‘Deactivate’ button and then you should see this:

Click on the ‘Set Properties’ button in the bottom right hand side of the screen and you should be presented with the following:

Fill in the fields with keys as follows:

  • TranslatorAccessKey: Key for the Text-Translation-API service

  • AzureAccessKey: Key for the Text-Translation-API

*Remember to replace all of the text with the keys you copied to your notepad

Next, click on the ‘Save and Close’ button from the ribbon and you should be returned to this screen:

Click on the ‘Activate’ button to publish the workflow. Finally, we need to add some fields to the Email entity main form. To do this, navigate to Settings -> Solutions. Here, select a previously created solution, like from here, and you should see something like this:

Navigate to the ‘Entities’ menu item from the left hand tree structure. You should then be presented with the following:

Click on the ‘Add Existing’ button from the menu and you should see this:

Scroll down until you find the Email entity. Select the Email entity and then click on the ‘OK’ button:

For this scenario we are going to add all of the assets by selecting 'Add All Assets' check box on the form that pops up like this:

Click on the ‘Finish’ button to complete the addition of the entity to the solution. You can now select the Email Main form for the Email entity by selecting it from the ‘Forms’ menu item of the Email entity like this:

You can then modify the filter of the Field Explorer of the form customisation page to ‘Custom Fields’ as follows:

Your field list will be updated to the following:

Drag the ‘language’ and ‘sentiment’ fields onto the form below the ‘Subject’ field like this:

You can also drag the ‘Translated Email Text’ field onto the form below the ‘Description’ field like this:

Finally, we will need to add a Web Resource to the form below the ‘sentiment’ field we added previously. To do this, select the ‘sentiment’ field and then click on the ‘INSERT’ tab from the top of the menu bar and you should see this:

From the updated menu items, select the ‘Web Resource’ item and you should be presented with the following:

Complete the form as follows:

Now click on the ‘OK’ button after which you will be presented with the following:

Select the ‘HOME’ tab from the top of the form and you should be returned here:

You can then go ahead and click on the ‘Save’ button. Once the save function has completed, you can click on the ‘Publish’ button. Once the publish has completed, you can click on the ‘Save and Close’ menu item to complete the customisation. You will be returned to a screen like this:

You can go ahead and close this screen by clicking on the ‘X’ in the top right hand corner of the screen. Following this, navigate to the Email entity view by clicking on the Sales -> Activities menu option like this:

You should then see something similar to the following:

From the ‘All Activities’ drop down, select Email -> All Emails like this:

You should then see a screen similar to this:

To test the new functionality, click on the ‘EMAIL’ button from the menu bar and then you should be presented with the following:

Go ahead and paste the following in the main body of the email:

Très bon service, très heureux après l'occassion.

This is a French piece of text and has a positive sentiment so you should see the following after saving the record and refreshing the page:

You can also update the text to this:

Dein Service ist schrecklich! Sehr schlecht.

This is a German piece of test with a negative sentiment:

Awesome work, now you have applied machine learning to the simple email entity! Look out for the next post where we will be enabling the Kylie Bot to log cases within Dynamics 365.

0 comments
bottom of page