Applying automation and approvals to Twitter with Microsoft Flow
Recently Microsoft announced the release of their automation tool called Flow to assist with the constant of “Do More with Less”. For an introduction into Flow check this out. To get started with Flow check it out at: https://flow.microsoft.com/en-us/.
Automation is an area of interest for me so I decided to spend some time kicking the tires to see what Microsoft Flow can do. Overall, I’ve been impressed with what’s available at this point and I’ve found a couple of use-cases which I am getting benefit from Flow. There are a lot of pre-built Templates for Flow which you can just choose to use to get started (a few are shown below).
This blog post will show an example of one Flow that I use for Twitter which retweets based on a specific hashtag if it is approved. This doesn’t currently exist as a template so we’ll start with a walkthrough on how to create your own Template.
Creating your own Template in Microsoft Flow:
Start by creating an account in Microsoft Flow. Next go to My Flows, create new flow.
We choose where to start. In my case I am developing a Flow which will alert me when a new tweet appears which matches my criteria. So I add the twitter option shown below (Twitter – When a new tweet appears).
From there I can add the query text that I want. I started with a simple one which matched the hashtag of #MSOMS.
However this evolved over time to be a more complex query text which checked for either the #SCOM or #MSOMS hashtags which did NOT include the letters RT (indicating a retweet).
#SCOM OR #MSOMS – -RT
To develop more complex queries, use the search reference (https://twitter.com/search-home#). To see an example of what my query text results in, the URL is: https://twitter.com/search?f=tweets&vertical=default&q=%23SCOM%20OR%20%23MSOMS%20-%20-RT&src=typd
After we have identified a tweet which matches the condition we are looking for we configure what happens next. In this case I want to send an approval email for me to decide whether this should or should not be retweeted. The approval email also include my email address on the To field of course.
Next we add a condition based upon the approval email.
The condition has the object name (gathered from the approval email) and indicates what the positive condition is (Yes in this example).
If it is approved, retweet the original tweet using the option to Post a new tweet.
The finished (unexpanded) Flow is shown below:
We can then save this Flow off and test its results.
What does it look like when it’s working?
An email example from this Flow is shown below:
If approved it notifies you in a web browser with an indication of your response.
How can we check on our Flow’s?
Information on your flows is easy to access including what flows you have and what activities have occurred using the bar in the top left corner.
An example of My flows is shown below:
The circled “I” shown above links to show the run history for that particular flow.
If a Flow fails you can dig in and see the details as to why it failed such as in the example below where the failure was in the step to Post a new tweet.
Issues and next steps with this particular Flow:
I am not 100% happy with the results of this Flow as I am receiving occasional failures like the two shown below (Out of call volume quota, Unauthorized). But these are relatively infrequent.
Additionally, what would be optimal for this Flow would be a real “re-tweet” instead of posting a new tweet.
Summary: Are you looking for a simple to use graphic approach to creating automations? Spend some time checking out Microsoft Flow! In the next blog post I hope to show how to use a similar approach to this Flow to show methods to tweet information from RSS feeds.