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!
Solved! Go to Solution.
Hi @Flash ,
Please try this configuration:
Determine if Tweet text starts with RT. If not, it means that this is not a reply.
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!
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:
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!
Eliot - Project Five Ltd. (UK)
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!
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:
Eliot - Project Five Ltd (UK)
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:
Here's that broken down:
... and finally, here's everything together:
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. 🙂
Eliot - projectfive Ltd. (UK)
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?" 😏
Join us for the first ever Power Platform Online Conference!
Look out for new contribution recognition badges coming SOON!
We've updated and improved the layout and uploading format of the Power Automate Cookbook!
Fill out a quick form to claim your user group badge now!
Find out where you can attend!
Watch & learn from the Power Automate Community Video Gallery!