Power Automate – Re-Tweet the Hashtag

To keep updated with all the latest news in the tech space, I also rely on Twitter. I follow some awesome community folks that posts messages/error before they blog. And that is a big help honestly.

Most of the time I would skip information until someone else retweeted or liked it or the tweet is new, and I seem to be online at the same time, which is a tough task. Being working, keeping updated with tweets was getting difficult for me. The need arises when I have to search for a hashtag, either to read the tweet and eventually like & retweet it if that is something I like & want to surface the information in my profile.

Power Automate came to the rescue and I am glad for the standard Twitter connector.

Pre-requisite – Sign in to Flow.microsoft.com

In this blog what we will do is if a hashtag is found retweet it. I have used an example of #ThatTechieGirl, thattechiegirl. Those are my official hashtags. Let’s get started & make sure to check out the interesting facts.

Create an automated flow and search for the Twitter connector. Select trigger as – When a new tweet is posted. Use can use multiple options as shown in the image below.

Note – for multiple values use comma (,) and text to be searched is case-sensitive so feel free to provide multiple options for it.

Now in action search for Twitter connection & add the retweet action. You will notice that the Tweet Id is a mandatory field in this case.

Now search for the dynamic content – “Tweet id” from the list & it should look like below –

Let us save & test it. It works.

The test seems to work in one go but below were below issues I initially got before the first success.

Issue 1 – Tweet id field was filled with ‘Tweet Text’.

While testing it, the flow failed. I got the below issue of – “The specified user does not exist”, it got me worried as my user exists. If you see the Tweet id field, it displays the test I did successfully.

The whole error in the message tag is –

“message” : The specified user does not exist. Make sure that the user name is typed correctly.\r\nclientRequestId: *** \r\nserviceRequestId: **** “

I checked output to see details & found my test tweet as well –

“body”:{“TweetText”:”#ThatTechieGirl is busy”,

“TweetedBy”:”ThatTechieGirl”,

The error is itself very confusing & I wasted quite a nice time figuring out why my user was not found if the Tweet was found.

Issue 2 – After successful runs, the monitor shows some failures, and the error details say – “You cannot post the same tweet twice”.   This error was for the “Post a tweet” action.

You can post when you are tweeting yourself in person, but the flow will restrict this & will not allow spamming your account with the same tweets.

Issue 3- With the “Retweet” action, the error details say – “You have already retweeted this Tweet”. This time flow stopped itself going into an infinite loop. In a real-world scenario also, you can only retweet the post once either with a quote or without a quote.

To avoid the infinite loop scenario, here what I thought would be the best fit. Add a condition where we will check who tweeted this, if a hashtag is found & it was tweeted by someone else then retweet else not. Why would I want to retweet my tweet, unless an exception?

Here is how it looked like in the flow designer window –

For testing purposes, I added an email notification to check if I receive an email. That way I can test my flow properly & make sure it’s full proof.

While testing I found an interesting fact –

For some random reasons, I added both tweeted by & original tweet tweeted by in email to check what values I get. I got value only in tweeted by & there was null/blank/ no value for original tweet tweeted by.

If the action is skipped it would provide you with the below details –

The final successful test looked like this with the condition to avoid error message of retweet was done.

The final version of my tweet flow looks like this –

Interesting Facts –

  • You can test only when your Flow is Turned on else the below notification will occur.
  • You can create a copy of the flow using Save As. The copy would be in disabled mode / Turned off mode always.
  • Under My flows, you cannot select multiple flows at one go. You need to select one flow at a time.
  • You need a premium account to share your flow. In other words, if you are using a free Power Automate account, you cannot share your flow.
  • Owners section will be enabled for premium users only. Free accounts will see the below message for the same.
  • A free account cannot edit connections once added.
  • You can turn off Repair tips any time.
  • Send a copy function is not allowed for free accounts.
  • The flow can be submitted as a template when it has successful runs from the time it was last modified.
  • A free account cannot export the flow into a .zip folder.
  • A free account will have analytics. This is available for up to 30 days.

I hope this would help you in updating your tweets & provided a better understanding of leveraging the free account of Power Automate. Happy Tweeting!

Keep reading, keep enjoying, keep exploring!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s