Twitter Bot for Hashtag Search

A friend of mine asked for a way to find the first occurrence of a certain hashtag on twitter, within the search criteria limited by twitter of course (a  search can’t yield more than 1500 tweets, only 3000 tweets are maintained per user), so I built a mini app using twitter4j API to search for these tweets and acquires the oldest, not that different from searching on twitter and flipping through the pages till you find the oldest tweet, but much more convenient as you run the command feeding it the hashtag and you get the result, so now i had the application however had no way for my friend to use it.

at that point I started downloading netbeans with J2EE support, this would allow me to turn this application to a servlet, or a JSP of some sort, however as i was downloading it occurred to me that i can use twitter its self for communication.

The current use case is:

  1. Friend wants the oldest available occurrence of hashtag #bateekha.
  2. Friend mentions my twitter bot account, and uses a keyword followed by #bateekha.
  3. twitter bot checks mentions with that keyword every 1 minute.
  4. once keyword is found, #bateekha is parsed out, searched for and original tweet retweeted.
  5. Friend finds out that original tweet.

Later on i’m going to extend this project by increasing the number of keyword, maintaining a database and compiling an authorised users list.


Done, a service is up and running, the account is La2eely.

to have it find you results for you just type in @la2eely 2a2dam #bateekha


2 thoughts on “Twitter Bot for Hashtag Search

Leave a Reply

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

You are commenting using your 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