Twitter API using Twitter4j



Hi, I am new to this, I want to develop an application using java (twitter4j) which will stream direct messages (DM) posted to my twitter account and will post direct message to my followers.
Everyone says to create an app in twitter first to get the consumer key and secret. But app asks for website and callback URL. I don’t have one.

Please suggest how do I connect to my twitter account to read and post messages programatically.



It’s fine to use a placeholder callback url (eg: if you don’t have one & don’t intend on using one.

Once you create your app, and your Access Token & Secret you’ll be able to run these examples: to run the stream and listen to new DMs & to do other stuff.


Thank you…
I have one further query, which account (twitter handle) does it use?


Depends on the Access Token: If you use the Consumer Key & Secret and the Access Token & Secret under “Keys & access tokens” in it’ll be the “Owner” (same account as the one that created the application) but you can always authorize a different account eg: (same Consumer Keys, but different Access tokens) and use that instead.