You need a Twitter account to create a Twitter bot. It is recommended that you create a separate Twitter account to test the bots.
Assuming that you already have created a Twitter account, go to apps.twitter.com and create a new Twitter app. One Twitter app can handle multiple Twitter bots but is recommended that you create a separate app for each bot.
On the Twitter apps page (apps.twitter.com), log in with your Twitter account and click the Create New App button (link).
You need to specify the Name, Description, Website (put any link) and agree to the developer agreement. The Callback URL field may be left blank. Click the “Create your Twitter application” to generate the consumer keys.
Go to the Permissions tab and choose “Read, Write and Access direct messages” for the Access type. We do this so that the Twitter bot can send both tweets and DMs. Click “Update Settings” to apply the changes.
Go the Keys and Access Tokens tab and click the “Create my access token” button under the Token Actions section. This will generate the consumer keys and the access tokens that the bot would require to connect to Twitter on your behalf. Never share these value with anyone.