Yesterday on Reddit I was asked about how to collect and send community news articles from websites using Power Automate so that news letters can be sent out to colleagues.
Of course my initial response was to get some AI to do the trick. And Power Automate has that useful Run a prompt action for this.
The actual solution
Table of Contents
The actual solution was a bit more complicated than this.
When you ask the Run a Prompt action to do anything it quite quickly tell you to do it yourself.
Collecting interesting community news sites
In my example, I will get the Run a Prompt action to generate me a list of site URLs. If you have a set number of sites that you want to have a look at then you can of course always create the list of URLs yourself. But I’m going to get the AI tools in Power Automate to do the job for me.

As we run this flow we will straight away see the first bit of trouble.

The output that we get is user-friendly and not flow-friendly.
Here are three popular Power Automate blogs excluding Microsoft blogs, presented in the requested JSON format:
[
{ “site”: “SharePains”, “URL”: “https://sharepains.com/” },
{ “site”: “Flow Joe”, “URL”: “https://flowjoe.io” },
{ “site”: “April Dunnam”, “URL”: “https://www.sharepointsiren.com” }
]If you need more recommendations or specific topics covered in these blogs, please let me know.
With a bit of expression work we can sort out the out put quite quickly. But it would really be useful if prompts could just return the data in json without the fluff.
@{json(concat('[',split(
split(
outputs('Run_a_prompt_1')?['body/responsev2/predictionOutput/text']
, '['
)[1]
, ']'
)[0],']'))}
Now that we have the json output as shown below we can start collecting our posts from each blog.
[
{
"site": "SharePains",
"URL": "https://sharepains.com/"
},
{
"site": "Flow Joe",
"URL": "https://flowjoe.io"
},
{
"site": "April Dunnam",
"URL": "https://www.sharepointsiren.com"
}
]
Getting the post content
You might think that you can simply ask for the latest post content. But unfortunately that doesn’t work. Even guiding the Run a Prompt action to my RSS feed didn’t help.

Using the RSS feed
The List all RSS feed items action will be helpful here. Of course it does mean that the sites will need to have the RSS feed enabled.

To limit the posts returned for the last 7 days I’m using the following expression
addDays( UTCNow(), -7,'yyyy-MM-dd')
Processing the RSS feed
Now the obvious way forward would be to add an apply to each into the earlier apply to each. However that isn’t very helpful as you will end up with a flow that is difficult to debug. Hence it is better to implement the below section in a child flow.

Please not that the flow will summarize the content. Please do not take full content of posts as that could get you into trouble with copyrights! And bloggers like to get visitors to their blog as well.
So in addition to the above you could also include a link to the source posts. Simply add the link that you have looked at in the HTML to text action’s Content property.
Reorganising the flow
Nested flows are hardly ever a good idea. So I’m converting my main news flow to look like this.

The Compose at the end takes the output from our Run a Child flow action as we have seen so often in my previous posts.
And our Child flow will now do the processing of the posts.

And again we’re collecting an array of data from our actions inside the apply to each.
Now that our flows are ready, we should consider adding error handling into these flows. The RSS feed might not always be the most reliable service, hence you might want to handle any failures. A simple try catch in both flows can sort that out.
Sending the email
Now the final step is to send out the email to your audience.

We just take the output of the Compose action that collects the data from the child flows and the content of the newsletter is ready.
You can of course add some more formatting to the Body to dress up the email a bit.
Discover more from SharePains
Subscribe to get the latest posts sent to your email.