Selecting a random article from RSS feed and posting to external system v2

I am attempting to use an RSS feed to post to social media. I have this posting an article but it will not randomize the article.

I read this article;

That accomplishes my mission.

Can someone post the JSON file for this to work, because I am stuck with following the logic.

It looks simple, but in the tools and array aggregator, I just need the specific syntax.

Please upload a JSON file.

Hi,
You could use an array aggregator after fetching items via the RSS connector…it would compile all the fetched items into a single array.
After aggregating, you could use a set variable action to generate a random number where the maximum value is the length of this array.
Then you could utilize the generated random number to select one specific item from your array for posting.
Cheers,
Harsh

1 Like

Thank you, I really appreciate it. I have attempted this, and I am failing somewhere.
If you have the ability to create that syntax, and upload a JSON file, I would really apprecate it.

This is what my array radomization looks like:

Can anyone tell my why it is not being randomized?

It is only posting the last item each time, it never randomizes the feed.

Hello @Ryan_Thompson1,

It looks like you’re shuffling a single value, which is why it’s always returning only that one value.

You could use map() on 59. Array to pull out content.value into their own array, then shuffle that.

Do you have an example of the JSON created by the RSS feed’s array aggregator? If so, we can use that to send you over some examples.

Hey thanks for that. I am a novice here, so Im not sure about the map() on 59 Array.
Perhaps this JSON for my blueprint will help?
blueprint social media distribution.json (72.0 KB)

Something like this would put all instances of “Value” in an array, then shuffle it.

The problem is, Value always seems to be blank

I don’t know how to explain that, if the value should have data. Because even on your end, the rest of the fields are populated.

Frusterating. But thanks for the guidance, I hope I can figure that RSS glitch out.

If you do this with another item like Properties.URL

You can see the URLs extracted into their own array.
Next, you see them shuffled up.
Next, you see “Random” URL which is them shuffled again and the first one selected.

1 Like

Donald, I am so close I can taste it, thank you very much.

I am getting this now though:

I have tried multiple fields, include just the URL field from the RSS feed. But I get the same error.

I know this is looking me dead in the face, but I can’t see it. Please any more help would be greatly appreciated.

You need to map only the array into the map() function. Right now you’re mapping just a single value and Make is complaining that you haven’t specified an array.

When I do just “array” it gives me the error “unclosed variable”

Hi @Ryan_Thompson1 You’re missing the closing bracket. Delete 59. Array[ and select the array again from the mapping data or copy paste this, for the random URL:

{{first(shuffle(59.array))}}

It works fine my end

I am sorry for being such a pain.

I am getting different output.

I did copy and paste this: {{first(shuffle(59.array))}}

But after pasting it, the syntax changes, and removes some of the brackets, no matter what I do. I suspect that is ok.

This is what it looks like on my end. Am I setting up the array correctly?

Make has random function. Forget shuffle, just use that. Assuming you have an array, multiply random by the length (that will get you the right range) round it (that will get you actual number) and add 1 (because random starts from 0 but arrays start from 1)
I added a screenshot and also gave you the json for the scenario.


random.json (4.1 KB)

thanks, still no luck

When you use the map() function, you must specify which key you want to extract from the complex array. You are specifying the array, but missing the key. Please check my example vs. yours.

In the map() function, after your specify the array, you need to follow with a semi-colon, followed by the key name, which is rssFields.media:content.props.url or rssFields.media:content.value

Strangely though, the output I get is:

“I’m sorry, but it seems you’ve mentioned a URL without providing the actual link or any details about its content. I can’t access external URLs for information due to my design limitations. If you can share some key points or summarize what the article is discussing, I’d be more than happy to craft a detailed Facebook post based on that!”