A while ago I started using Huginn, as a replacement for IFTTT. That’s going quite well. Huginn offers more features, integrations, and especially your chains (scenarios) can be as complex as you wish. IFTTT is quite limited in this area.
I use the Twitter integration to find certain Tweets. Now this does not only find native Tweets, but also finds every Retweet made for a native Tweet. Obviously I am not interested in duplicate content.
Huginn offers a way to filter out Retweets.
My first attempt was to look at the
retweeted flag in the Event output from the search agent:
But this flag is always set to
false, I’ve never seen it set to
true. Not helpful.
Next I looked at the actual data emitted from the search agent. There is a difference between native Tweets and Retweets. The latter contains an additional hash:
retweeted_status only appears in Retweets, and is there in native Tweets. That’s useful, because a Huginn Trigger Agent can filter on that fact. Feed the output from the Twitter search into a new “Trigger Agent”, and define the rules as follow:
keep_event: can be
false, depending if you want to keep your events after they are processed. I keep them around for a couple days, that gives me a chance to debug things, or re-emit them into the chain.
expected_receive_period_in_days: that should be set to a value matching how often you expect Tweets coming into this chain, the default is
2but that might be too low. If there are no Tweets in two days, the Agent will set itself to non-operational.
message: can be anything, and is not really relevant in my case.
field!=valuechecks if a certain value is there.
rules/value: This is a bit of magic, because if the field is not present then the default will be used, which does not match, and therefore stops the filter at this point. The default value can be anything - as long as it will not appear in your Twitter event.
rules/path: The path the filter is looking for, in this case for
retweeted_status field is present, the Trigger Agent will proceed, emit the event into the next Agent (and add
message). If the field is not present, processing stops here.