I'm using Twitter4J to send tweets automatically. Basically what I want to do is:
If a user tweets my account, I'll reply with "Hello hello!" for example. I know how to tweet using the Twitter4J but just don't know how to reply to users that tweet me.
This is the way I'd just do a normal tweet:
// The factory instance is re-useable and thread safe.
Twitter twitter1 = TwitterFactory.getSingleton();
Status status = twitter1.updateStatus("Hello Hello");
System.out.println("Successfully updated the status to [" + status.getText() + "].");
I think I need to do: 1. Request last tweet 2. If newTweet.id != oldTweet.id then it means you have a new message else jump to step 4 3. Reply 4. Loop 1
Don't use rest api here. Use streaming api (Follow stream). Follow your own handle.