cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Flash
Level: Powered On

Flow to exclude Twitter replies

Hello,

 

I am working with the "Post on Microsoft Teams when a new tweet matches the specified hashtag" template. One change I would like to implement to the template is to exclude reply tweets. I have attempted to include a condition that looks to the Original Tweet starting with string('@') to exclude the replies.  When running a test the flow error returns with "The template language function 'startsWith' expects its first parameter to be of type string. The provided value is of type 'Object'." 

 

I have seen others solutions to exclude reply tweets but they all are done in the retired advanced mode for the Condition card.

 

Any direction would be appreciated, thanks in advance!

 

 

2019-11-25 16_37_49-Edit your flow _ Power Automate and 4 more pages - Work - Microsoft Edge.png

1 ACCEPTED SOLUTION

Accepted Solutions
Flash
Level: Powered On

Re: Full Reply Exclusion / Inclusion Logic

Hi Eliot, thanks for your help.

 

I ended up using a condition with Tweet text starts with "@" which has satisfied my needs for now.

View solution in original post

9 REPLIES 9
Community Support Team
Community Support Team

Re: Flow to exclude Twitter replies

 

Hi @Flash ,

 

Please try this configuration:

13.PNG

Determine if Tweet text starts with RT. If not, it means that this is not a reply.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Flash
Level: Powered On

Re: Flow to exclude Twitter replies

Hello @v-bacao-msft ,

 

Unfortunately that does not meet my requirements. I want to filter out reply tweets which start with "@". When I attempt to use a condition like yours and enter in "@" the field fills with multiple "@" symbols which makes this not work. Any other suggestions to filter out reply tweets? Thanks! 

Flash
Level: Powered On

Re: Flow to exclude Twitter replies

@JSivonen and @Eliot 

 

Do either of you have a solution for this issue now that the advanced view in the condition card has been removed? Thanks!

Highlighted
Eliot
Level: Powered On

Re: Flow to exclude Twitter replies

Hi, @Flash, I've got a solution for you, just give me a hot second and I'll add it in.

 

In the meantime, I'll let you know that I use the replied-to function. You may even get there before me, it's just a logic switch.

 

OK, here's the basic version of it, just use this condition:

tweetfix.jpg

That's basically it.

 

You will run in to issue when the user replies to themselves, just add another level of conditioning to control that (I think including it with an AND / OR is messy, and too difficult for my tiny brain).

 

Just a quick question, did you find my name elsewhere on here? If so, very many thanks for thinking of me!

 

Best

Eliot - Project Five Ltd. (UK)

Flash
Level: Powered On

Re: Flow to exclude Twitter replies

Hi @Eliot 

 

Thank you for sharing your solution. I found another thread here where you had worked on a similar problem which is why mentioned you on the thread. 

 

Unfortunately I've not got your condition logic to work yet in my flow. I'm not quite sure what I am missing. I also realized that dynamic content is presenting differently than what you posted in your screenshot.

 

Notice my dynamic content for "in_reply_to_user_id" presents as "triggerOutputs()?['body/TweetInReplyToUserId']" when hovered over with the mouse, which is different than yours. As for the value in the condition, are you setting it to be the Twitter user's handle you want to capture? 

 

Thanks again for any assistance!

 
 

Annotation 2019-12-02 105234.png

 

Eliot
Level: Powered On

Re: Flow to exclude Twitter replies

Hi, @Flash , it's possible that you have an old version of the Twitter trigger in your flow.

 

Perhaps try a new flow (for testing this) and see what changes. If you get the desired results, then perhaps either try changing the trigger on your existing flow, or rebuild the whole thing in a new flow.

 

Here's a brand new flow that I've just created:

hmmm.jpg

 

Best

Eliot - Project Five Ltd (UK)

Eliot
Level: Powered On

Full Reply Exclusion / Inclusion Logic

OK, @Flash , if you stick something that is similar to the following somewhere near the beginning of your flow, you can go forward using the variables to drive your branching. If you work through this in your head, you'll probably start thinking about parent tweets, etc.

 

Here's the basic full logic in small, click to enlarge, obviously - the full logic will be at the end:

Cropped Basic Logic.jpgbasic logic

Here's that broken down:

  1. Firstly, set the trigger, to when a new tweet is posted, you decide what's in that box. Here you'll also initialise variable to later decide whether or not a Tweet;
    1. is a reply,
    2. and / or is a thread.

      1 - When A New Tweet Is Posted and Vars.jpg1 - When A New Tweet Is Posted and Variable settings

  2. After this you'll need a condition to see if this is a reply, if it isn't a reply go to #3, if it is #4.
    2 - Condition to see if it is a reply.jpg2 - Condition to see if it is a reply
  3. If it is NOT a reply, then it won't be a thread (yet), so you can set both variables to false.
    3 - If it isn't a reply then it isn't a thread set the variables accordingly.jpg3 - If it isn't a reply then it isn't a thread set the variables accordingly
  4. If it is a reply, then set the isReply variable to true.
    4 - If it is a reply set a variable to show it is a reply and test for thread.jpg4 - If it is a reply set a variable to show it is a reply and test for thread
  5. Now you need a condition to see if it is a thread;
    1. so if it the reply is to the user making said reply you can set the isThread variable to true,
    2. so if it the reply is to the user making said reply you can set the isThread variable to false.
      5 - Condition to set variables as to whether or not it is a thread.jpg5 - Condition to set variables as to whether or not it is a thread

 

 

 

 

... and finally, here's everything together:

Cropped Full Logic.jpgfull logic

Heh ... obviously I'm not going to build your flow for you ... or your logic  😉  ... but I hope that this sorts out your Tweet Reply issues. 🙂

 

Best

Eliot - projectfive Ltd. (UK)

Flash
Level: Powered On

Re: Full Reply Exclusion / Inclusion Logic

Hi Eliot, thanks for your help.

 

I ended up using a condition with Tweet text starts with "@" which has satisfied my needs for now.

View solution in original post

Eliot
Level: Powered On

Re: Full Reply Exclusion / Inclusion Logic

OK, glad that you got there, @Flash , genuinely. 🙂

 

What you've done there is actually where I started before ending up where I am now.

 

If you get the chance, please do go back and try to include the above, as (believe me) it'll really help. Especially if (like me) you're recording the tweets of a popular account (mine is the 🐦Microsoft Alerts account) and they reply WAY more than they tweet, because so many people are asking them "is [blank] down right now?" 😏

Helpful resources

Announcements
firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,058)