Advanced | Flow of the Week: What interests my boss, fascinates me!

Recently I spent some time at one of Microsoft Canada's field offices and was talking with Mark Speaker, an Industry Solutions Executive in Calgary about Microsoft Flow use cases. Mark has many progressive ideas about how Flow can be used within the asset intensive industries (Oil & Gas, Mining, Utilities) that he focuses on but he also had some ideas about how he can leverage Flow for personal productivity. Being an Industry Solutions Executive requires Mark to be on top of many trends that impact his customers and the Canadian Microsoft subsidiary.

When I was chatting with Mark, he brought up Microsoft’s abilities in cognitive computing and felt there must be a way “to leverage this technology in order help him and customers scale.” One use case he identified was managing communication that he receives from his leader, Sarah Kennedy. There is an old saying, “What interests my boss fascinates me” and that is the inspiration for this blog post.

Naturally, Mark pays close attention to his leader’s email, but between customer meetings and traveling across the Canadian subsidiary, Mark wants to ensure he can stay on-top of the email that he receives. In the event, there are emails that require further research, Mark wants quick access to information without suffering from search engine fatigue. 

Wouldn’t it be great if there was a way for a cognitive engine to process your emails, pull out key phrases and then execute a search engine query and return the top 3 results? Well there is, and these steps can be orchestrated using Microsoft Flow. With this as our requirements, I set out to build such a flow.

There are a lot of steps in building this flow. In this blog post, I will focus on the high-level concepts, but you can download an exported version of this flow here.

Building the flow

  • We want to run this flow every day, so we will use the Recurrence trigger that will ensure to instantiate it each day.

  • The next step that we want to run is the Office 365 Outlook – Get emails action. This action will allow us to retrieve the last 10 emails. We can also provide a Search Query, much like we can in the Outlook client. This is where you can provide a from: parameter indicating the person whose emails you want to target.

  • To simplify our processing, we will create 3 variables that we can use to store information like the News articles returned by Bing, our Key Phrases returned from Cognitive Services and a variable that will allow us to count our Key Phrases result.

  • Next, we will loop through each of the emails that we have received.

  • Since most of the emails received these days tend to be in HTML format, we can use the Html to text action to perform a conversion as we don’t want to pass HTML markup to the Key Phrases Cognitive API.

  • We are now ready to send our cleansed email body to the Key Phrases API. Optionally, we can also provide a targeted Language.

Note: you can obtain a free trial API key for the Text Analytics API (which includes Key Phrases) here. Alternatively, you can also obtain an API key from the Azure Portal if you have an Azure Subscription.

  • As you can imagine, large emails may contain many key phrases and passing in a large number of phrases may result in an inaccurate search result. To mitigate this, we will cap our key phrases at 10 to have a more relevant result set. But, until our keyPhraseCount reaches 10, we will append these key phrases together which will make up our query for Bing.

  • There is an out of box Bing API connector, but for this scenario I have opted to use the HTTP action so I can control additional parameters including the cc query parameter which will localize the results. For example, if Mark is interested in more information about a carbon tax, it is important to return results in his locale as opposed to another jurisdiction which won’t have the same level of impact. We are also going to include a count parameter and assign a value of 3 to limit the result set to 3.

Note: The Bing Search API also requires an API Key. You can sign up for a free trial here.

  • Since we are not using the out of box Bing connector, we need to use the Parse JSON Response to have a typed message that we can use in downstream connectors. We also want to put a defensive check to see if there is a response. If there are no results from our web search, we want to prevent a failure from occurring. So when there are no results we will construct a “No-Results-Found” message and add it to our news array so that Mark knows there was no result for a specific email. If results are returned, we will iterate through them and append them to our news array.

  • We don’t want to include all of the data (attributes) from our Bing search results so we will use the Select Columns action to include only Subject, Name and URL.

  • Next, we want to use the Create HTML table action that will convert our array into an HTML table.

  • Lastly, we will use the Send an email action to send our digest our to our interested user. We can also include formatting by embedding CSS selectors.

Testing

To test this flow, I did what any flow user would do…automate it using Microsoft Flow! By clicking a button, I can send 10 different emails that represent the types of emails that a person expects to receive.

  • As an example, there is activity in the Western Canada recently about Shale Gas projects that would be of interest to both Sarah and Mark as they support this customer segment. Therefore, I have included an example of such a scenario. For American Football fans – I have you covered too!

  • To run our test harness, we simply click on the …More dropdown and then select Run now. Alternatively, we can also pull out our mobile device and open the Microsoft Flow mobile app and click our virtual button.

  • Within a few seconds, we will see our 10 emails show up in our inbox.

  • With our emails staged, we are now ready to launch our actual “What interests my boss fascinates me” flow. We can either wait for our schedule to be reached or can manually kick it off as well.

If we explore the run details of the flow we will discover a few interesting items:

  • For our quantum computing email, the Text Analytics API was able to detect the following as Key Phrases:

  • When we call Bing, we assemble a query string that resembles a useful query string.

  • Bing, in turn, will provide valid results.

  • The complete output by Microsoft Flow looks like the following:

Other Opportunities

I hope this blog post gave you some ideas about how you can leverage Microsoft Flow and Azure Cognitive Services to scale yourself, and your team. Here are some additional ideas that we came up with that may also be of interest:

1. “Keep me updated on my Interests” (without me explicitly telling you my Interests) 

2. Of all of the news being released today, what would most interest my specific customer?

3. What LinkedIn article should I post that would attract the most interest?

4. Show me something interesting I likely have never seen before.

5. Of all the people who have asked me for something, who should I get back to first? Send me a note when I’m really late.

6. When a customer posts something on LinkedIn, update their list of key interests in CRM for me.

7. Tell me if someone has sent me an email or text and they are angry.

8. Match the top trends to the interests of my customers based on their LinkedIn posts and profiles. Send me updates when trends that impact these customers have something interesting.

9. Who in my organization, of thousands of people, would be best matched to speak to certain people at my customers? Send me those names on demand and their relevant topics.

10. Find the internal PowerPoint presentations that match the interests of my customers by topic and industry. Send me links to the presentations on demand and when I request for certain customers. As new presentations are created on the topics I need to know that.

11. What are some current competitive threats for my customers?

  1. Who are my customers currently interacting with on social media?

Conclusion

I find that "Digital Transformation" is such a loaded term these days with many organizations abusing the term. For me I look at Digital Transformation as a way to change the way people work. One of these ways is through the democratization of technology that allows employees to scale through access to tools. This is a great example of both democratized access to technology and improving the way people work through the automation of tasks. Only 2 years ago, this scenario was infeasible as it would require a developer to write a lot of code. Using Microsoft Flow, we can take advantage of other Microsoft investments, such as Azure Cognitive Services and Bing in order to build cutting-edge applications on a coffee-cup budget.

I want to thank Mark for bringing this scenario forward and identifying some very cool use cases for Microsoft Flow. I also want to thank his leader, Sarah for being a good sport about including her in this blog post as part of our scenario. I look forward to continuing to work with Mark in order to unlock more really innovative ideas using Microsoft Flow.

P.S. To never miss another blog post from the Flow blog – Use This Flow