Hey everyone! Did you know that there's a way to read/write/send messages to other twitter accounts with your Twitter Developer Account? (All discussions below are in context of the Twitter API v1.1)
- API key and secret - belongs to your Twitter App(which you made inside your Twitter Developer Account)
- Access token and secret - belongs to the Twitter Account where you want to tweet/send messages etc..(The Access token & secret given in your Twitter App will let you tweet/send messages etc.. to the Twitter Account which you used to register for a Developer Account)
We can get API key & secret from your Twitter App. But how do we get the Access token & secret of your bot account where you want to tweet? Unfortunately, there is no GUI feature currently to support this. We have to make our own server to run the authorisation of the bot account and get access tokens.
- Go to your Twitter Developer Account.
- Create a standalone app - this will give you your API key and secret. You can Choose your App Permissions also here.(For example: Read, Write, and Direct Messages)
- Enable 3-legged OAuth.
- Enter the callback URLs and website URLs as:
- Create a new folder in your computer and create 2 new files - authorize.js and package.json
- Get the file contents here.
- In your terminal, run
npm installto install the Nodejs dependencies.
node authorize.jsto start the server.
- Double check that you are logged in to your Twitter bot account and visit http://localhost:3456.
- Click "authenticate"
- You will be redirected to a page where you can collect your Access token & secret.
- Yay! Now you can tweet in your bot account.🤖
- Still a bit worried whether your Twitter app has been connected to your Bot account? Still logged in to your bot account, go to https://twitter.com/settings/connected_apps to see if your Twitter App is connected.
Congrats! You can now control your bot account with a single Twitter Developer Account.