Parse Email into a Phone Call Using Microsoft Flow and Workflow Definition Language

Parse Email into a Phone Call Using Microsoft Flow and Workflow Definition Language

Making a phone call has become a critical requirement for alerts and notifications from monitoring systems and customer service applications. The challenge is these applications often can only send emails. In addition to that challenge, an email has a lot of stuff that is not necessary for a phone message. The solution for this challenge is to parse the content of the email into a succinct voice message that gets the important message across quickly and effectively.

Microsoft Flow and EmailToVoice.Net work well together. We have written about this integration in past articles in our Blog. In this post, we are going to delve deeper into the script used to parse the email content into a sensible phone message.

Workflow Definition Language

The Microsoft Workflow Definition language is at the center of extracting relevant information from an email and passing only what is applicable to a voice phone call. The Microsoft Workflow Definition Language is available in Microsoft Flow. You also find this powerful language in Azure Logic Apps. Actually it is better documented in Azure Logic Apps.

Sample Script for Parsing and Email

In our previous posts about using Microsoft Flow with EmailToVoice.Net, we have shown sample scenarios of forwarding a message that arrives in a customer service email inbox and then passes that message on to a phone. In this post, we are showing a simple example of parsing the content of an email into shortened text that would be more applicable for a voice phone call.

Sample Incoming Email

Let’s use a simple email for our example. From this email, all we want for the phone call is what has been ordered. In this case, it is ‘One Pizza’.

Initialize Variable with the Body of the Email

First we will initialize a new variable with the content of the Email. This grabs all of the text of the incoming email. If the email is HTML, then all the HTML formatting is also present in this new variable.

Discard beginning text of the email

Next we want to discard all text before the part of the email that we want to have as the content of the voice phone call. To do this we used the following expression:

last(split(variables(‘Email Text’),’This is the orderĀ </div><div><br></div><div>’))

It is important to note that when the email is HTML, then you need to look into the source to see exactly how the email content looks.

Discard bottom part of the text of the email

Now we want to discard everything after the part of the email that we want to keep as the voice phone message. in this simple case, the only part we want to keep is ‘One Pizza’. To do this we used the following expression:

first(split(variables(‘Email top part’),'</div>’))

Pass the remaining content to a Phone Call

As the final step, we use the variable that now has only the part of the email that we want to be converted to speech (TTS) for the phone call. This text will be passed to EmailToVoice.Net.

Microsoft Flow Power Automate


This is a great independent Youtube video to further explain this type of process using Workflow Definition Language.


Can We Help Further

If you have a business process that would be enhanced by using voice phone messages, contact us. We can help you integrate phone messages into any mission-critical business flow.

EmailToVoice.Net is rich in features while being simple and effective to use for business communications and alerts. We transform an email message into a phone call or an SMS message with no need to program APIs or install any hardware or software.

For making a voice phone call, you merely make the TO field in the Email you are sending to look something like (international calls require a +CountryCode in front of the local number). The recipient will receive a call on their phone. The text in the email is converted to a nice-sounding voice. If the recipient answers, they will hear the message right away. If they do not answer, the message will be left on their voice mail system. You can even leave a different message if the call goes to voice mail.

You can also send an SMS, FAX or prerecorded Voice Message from an email program interface, like from an application, Internet of Things device (IoT / M2M), or through your CRM and Dispatch System.