Posted on 1 Comment

Setting Your Twitter Account To Auto Like Posts Of Interest

Auto Likes

Are a great way to interact with accounts who might be potential followers and is a great way for your to explore your potential audience. I will show you how to take the existing twitter microservice we have and extend it to stream a filter of tweets that track keywords, then like that tweet. If you have no idea what I am talking about then perhaps you should start here when we began this project.
 

Extending twitter.js

Open up the node script we created in the last tutorial, twitter.js and inside we are going to add the code needed to track tweets that meet a certain filter requirement. However it is important that we stream it so we get fresh content coming in.

var filter = T.stream('statuses/filter',{track: ['#30days30sites','#100DaysOfCode','#301DaysOfCode','#Webapp','#laravel','#vuejs']});
filter.on('tweet',function(tweet){
 T.post('favorites/create', { id: tweet.id_str },function(data){
 console.log(data);
 });
});

In the example above I am tracking all tweets in real-time that contain #30days30sites, #100DaysOfCode, #301DaysOfCode, #Webapp, #laravel and #vuejs. Then whenever the ‘tweet’ event fires I create a favorite (same thing as a like) and grabs the tweet id. Of course in your example you are going to want to change what you track. These 6 lines of code do wonders for me, there is something special about random people liking your tweets, also many people come and visit my profile after seeing I liked something on theirs. SInce launching this app I have definitely noticed an uptick in the amount of accounts that follow me.
In the future I plan on extending this to incorporate AI algorithms to parse what exactly was said and retweet or respond depending on the context or the tweet. Perhaps when I have the time I will do a livestream of the event. If there is anything you would like to see me do leave it in a comment below.

1 thought on “Setting Your Twitter Account To Auto Like Posts Of Interest

  1. […] If you want to extend the functionality read up on the Twitter stream documentation here. Otherwise add some auto like functionality to your bot. […]

Leave a Reply