Moderation & Game Developing

Automate your WordPress Blog Post sharing on Social Media with Microsoft Flow!

If you are reading this, my automation system for sharing my blog posts to social media works! Thanks to Microsoft Flow!

If you are running your very own blog, you also want someone to read it. To actually get people to your web blog, you probably share your posts on social media like Twitter or Facebook. And if you are lazy or just hate routines like these, you keep an eye out for of things like Node-RED or Microsoft Flow. If you haven’t heard of these, you will know them after reading. And I tell you how to install this sharing process in Microsoft Flows.

Flow-Based Development

First of all, a small introduction of flow-based development. Don’t stop here, if you don’t know how to program, because flow-based development is just for you. Flow-based development is simply a graphical depiction of workflows / processes: You have triggers, actions and the connections between those. The actions are nodes and are the actual activites (such as “Take this text, and post it on Twitter”). The connection between those nodes is the message being transported. And to do communication between various existing systems, tools like Node-RED and Microsoft Flow already have connectors pre-installed. Connectors can be various: Twitter, Facebook, MailChimp, Azure and many more. You just have to fill input into these nodes.

In case of Microsoft Flow, things are easy: It runs from the cloud, it has an option to a free subscription (limiting the maximum runs per month and the frequency for each run and having selected connectors not available – but these are mostly used in a business context), the variation of nodes is great.
I tried Node-RED (it’s opensource): It runs on my Raspberry Pi – a cloud version is available on Sensetecnic, but the free cloud version allows only a small number of nodes. But I ran into another problem: The wordpress node I wanted to use in Node-RED, does not work properly. So, I started with Microsoft Flow.

Microsoft Flow for Automation

Registration just took a minute and you can start to develop your very own flow. A flow always starts with a trigger and provides a proper data set to start with. After the trigger, you can set actions to do with the dataset of the trigger or even enhance the data from there. There are options to do loops, add conditions, switch cases and more. In this example we simply need a trigger and actions.

Mind the Cloud-Service

You consider to use the WordPress trigger to get a new blog post. You can do so, if you are running your blog on WordPress.com. If you don’t, but run WordPress on a hosted domain, than you cannot use this element. So, what to do now? It sounds like a dead end as in Node-RED… Reading a HTTP get on the blog page and reading out the HTML? Possible, but it is as nasty as it sounds.

The better workaround – and that’s the one I used – is the RSS feed. WordPress does create an automatic RSS feed for the blog posts. And Microsoft Flows can read any RSS feed available. Perfect match!

After that, you just add the actions. In my case, each action is linked to a Social Media connector. There are Facebook, Twitter and LinkedIn. Microsoft Flow also serves connectors to Instagram and Pinterest. But these are not in my scope.
The next step is to give the actions login credentials to the accounts you are doing the postings with. In my case, I use my private ones. The login is done via the platforms themselves. You have to authorize Microsoft to use your account for the actions defined by your flow.

Adding the Content

Lastly, you add the content of your post into the connectors. That’s why the trigger is crucial here. The Trigger not only starts by releasing a new feed element in the RSS feed, but also serves the data of this new RSS element. You can choose between the link of the feed element, its summary, its ID and others. In my case, I need the link, as this is the link to the actual blog post.

In the end, there is one slight problem: If I post things on social media, I don’t want to use the blog post summary as the teaser. There must be something individual. I haven’t figured out a solution to this yet. But the idea I have, is to set the Feed Summary in RSS via a customized text in each post in WordPress.

UPDATE: This is actually possible. The excerpt field can be edited via “Screen Options” in a post. This allows you to have a dedicated text for Social Media. However, a channel based text is not possible by this workaround.

In addition to that, you also need to transform the values of the RSS elements (description and title) from HTML to text, as these are surrounded by HTML tags. If you share it this way, it will put the HTML tags into the message on social medias. A quick way to transform it, is the Content Converter connection. Add this as an action and add the RSS element to it. You have to do this per element you want to use.

The converted elements can than be used as the content of the social media share actions:

Another idea to solve the issue of channel based text for the post was to use the capabilities of Microsoft Flow: You can create your own user interface with it, to start a flow by button or text input. Unfortunately, Flows is not able to serve an easy solution to have a second trigger in the flow. In my case, the flow should start with a new RSS element and than needs a user text input to go further.


In the end, creating this flow was easy and just took a few minutes to setup. Nonetheless, testing and bugfixing takes the time here, as the flow needs to be triggered properly. This can take up to 15 minutes per test, as the free version has a 15 minutes frequency for triggering flows. In addition to this, you need to consider the use-case here was very simple. I don’t know, how more complex requierements will behave within Microsoft Flow.

I hope Microsoft adds such features in the future, as this would enable an easy solution to this. Nonetheless, that thing works. The flow checks the RSS feed every 15 minutes. And if you got here via my Twitter, Facebook or LinkedIn post, it works! I am curious to see, what other things I will automate via Microsoft Flow in the future!


Next Post

Previous Post

Leave a Reply

© 2019 Kai-Opitz.com