To create a Twitter bot, you'll first need to apply for access to the Twitter APIs for direct messaging. The application process is short and you will need to explain the purpose for you bot and the functionality you will provide.
Note that you can apply at any level, a Sandbox account is sufficient if you only plan on having your bot work with a single account.
Once you have received approval for you developer account, Twitter will send you an email welcoming you. You can now create your app and connect it.
Your first step is to create your app. You will be asked for the name of the app, description and URL. Fill these out according to the functionality of the bot you are building.
After creating your application, click on the Permissions tab and select "Edit", changing your access permissions to "Read, write, and direct messages".
Next you will need to create an environment for your application to run in. You will want to create an environment for the "Account Activity API / Sandbox". You can name it as you like, we would recommend "production", make sure to select the app you created in step 1.
You now need to create the keys and tokens for you application, which you will need when creating your channel. Go back to your application, then select the Keys and Tokens tab. Click Regenerate for both the Consumer API Keys and Access token & access token secret sections.
You should wait a few minutes at this point, as it sometimes take a bit for Twitter to save all these settings. Grab a cup of coffee before moving forward.
Coffee drunk? Great, you can now connect your channel. Go to your account page, then select "Add Channel" from the drop down menu. At to bottom of the page, select Twitter.
Make sure your account is enabled to receive direct messages from anyone. You can do so from your Twitter Security Settings.
Fill out your applications consumer API keys and access tokens, then click Submit. Your channel is now connected, you can test sending and receiving direct messages.
Note that Twitter currently limits accounts to 1,000 direct messages sent per day. If you expect to exceed this number, you'll need to contact Twitter directly to request that they lift that restriction for your account.
One last thing! Don't forget to remove your old Twitter channel if you are migrating from the old APIs. Just click on the channel, then select "Remove" from the drop down menu.