I am making a Spring Social Twitter application using Spring Boot. I have already configured a Twitter
object using the consumerId
, consumerKey
, accessToken
, and accessTokenSecret
.
My question is how can I use Spring Social Twitter to monitor the configured Twitter account and invoke a method whenever any user mentions my Twitter account. The method should be invoked with the Tweet
object or the tweet ID.
For example, let's indicate that my account is @MyAccount
. Now let's imagine that @SomeOtherAccount
tweets at (or mentions) @MyAccount
. Since another user tweeted at my account, a method should be invoked with the respective tweet data from @SomeOtherAccount
.
Spring Social Twitter's primary purpose is not what you are trying to achieve. Spring Social and its extensions were intended to provide Easy Authentication, Accessing Profile Data, Easy Posting of Status/Messages, Logout etc.
The best framework for the Use case you have is Spring XD. If you follow these Spring XD and pivotal tutorials which shows how to search for a Term (java in this case) on Twitter and save those tweets into a File.
You just need to modify the same to search for your
@MyAccount
and take actions for the Tweets with that name mentioned.You can read the following post written by me on how to analyse tweets with a custom processor