From the Archives - Re-posting Old Blog Posts

Tuesday, Nov 23, 2021| Tags: Power Automate, flow, content

Photo by Lara Jameson from Pexels

Once you’ve built up some content, one of the ways to keep your social media presence more active is to re-share your older blog posts. For long time followers, it can remind them of previous content. And it can help bring in new followers who didn’t see that content previously. If you’ve got a blog with an RSS feed that includes all of your content, then picking one at random to re-share is easy to accomplish with Power Automate.

Creating Our Trigger

We’ll start by creating a scheduled flow. Depending on how much content you have and are producing currently you may not want to have it run daily. In our case, we’re going to have the flow run once every 3 days. Just to keep things a little active, but not overwhelm people with an endless stream of repeats. The next thing we’ll add is a string variable to use to build our blog post tags into hashtags for social media.

Custom connector menu item

Grabbing Our List of Posts and Picking One At Random

Once we’ve got our setup in place, the next thing to do is grab our list of blog posts from our RSS feed. You’ll need to make sure that your RSS feed is actually outputting all of your blog posts and nothing else that you don’t want included. This will give you your list of posts to select from.

We’ll use the RSS feed action “List all RSS feed items”. This will retrieve all of our blog posts from our blog. Once we retrieve the list, we’ll use a Compose action to extract the list of items from the RSS feed into an array and select one of the items from the array at random. We can do this all in a single expression in our Compose action.

outputs('List_all_RSS_feed_items')?['body'][rand(0,length(outputs('List_all_RSS_feed_items')?['body']))]

The outputs()[body] gives us our array of items from the RSS feed. And the rand() function picks one element at random. The output gives us a single blog post’s details as a JSON object. From that we can parse the JSON output from the Compose action to get the data elements that we need. We’ll add a Parse JSON action, taking the output from the Compose action and then adding the schema to tell it what we need. If you don’t want to write out the schema by hand, the easiest way to get a sample schema to use for the Parse action is to run your flow up through the Compose action, then use the output from that, snipping out an example item output.

Custom connector menu item

Next, we’ll cycle through our tags/categories and build our hashtags list. For that you’ll use an Apply to each action to loop through the categories array from your parsed JSON. For each one, you’ll use a pair of Compose actions in the loop to add a hashtag to the category, then merge it to the other hashtags in the string variable for storing it.

Custom connector menu item

Build Our Social Media Output

Once you have your selected post and built your hashtags, we’ll build our social media posts and send them out. This is the same as I’ve done in other posts. We’ll just use the title, link and hashtags for Twitter. And for LinkedIn, we’ll include the summary text as well.

Custom connector menu item

And that’s it! We’ve now implemented a simple automated method for increasing our engagement a bit by reminding people of our older blog posts.

You can download the full flow here to use in your own environments.

INTERESTED ?

I am available for part time consulting work. If you are looking for someone to help with Power Automate, SQL Server, Azure or .NET work, feel free to contact me.

Contact me