Skip to main content

How to Create a Twitter Bots Application

You need a Twitter account to create a Twitter bot and all bot actions would happen under this account. It is highly recommended that you create a new Twitter account to test your automation bot and then use it for production.

Create a Twitter Project

Assuming that you already have created a Twitter account, go to apps.twitter.com and create a new Twitter Project to use the API v2 endpoints.

Twitter Project

Describe the Twitter Project

Give your Twitter project a short but descriptive name. Under the Which best describes you section, specify how you intend to use the Twitter developer platform. Choose Making a bot option here.

Next, provide a brief description of your Twitter project that is for internal use only.

The Twitter bot will help us reach to our customers and patrons via automated rules.

Describe Twitter Application

Create Twitter App

Under your Twitter project, click on Create App button to create a new Twitter app. Apps are where you get your access keys & tokens, plus set permissions. You can find them within your Twitter Projects.

Give your Twitter App a name - this name is pubic and it will show on all tweets that your bot will send. The name should be less than 32 characers and has to be unique across all Twitter apps.

Twitter Bot Name

Generate Consumer API Keys

On the Keys and Tokens page, you'll find your Consumer API key and Consumer API secret. You'll need these to authenticate your Twitter bot. Please make a note of these values since Twitter will not show them again.

Also, the Bearer token is not required for the Twitter Bots application.

Twitter API Keys

Generate Access Token & Secret

Reload the page and, under the Keys and Tokens section, click the Generate button to generate the Access Token and Access Token Secret. You'll need these to authenticate your Twitter bot.

Please make a note of these values since Twitter will not show them again.

Access Tokens

Allow App to Send Tweets and Direct Messages

Under the Settings section, choose Setup under User authentication settings to generate the Access Token & Secret. You'll need these to authenticate your Twitter bot.

Twitter Setup

We'll need to allow our Twitter bot to send tweets and direct messages. Under the App Permissions section, select the Read, Write and direct messages option. If you want to send tweets only through the bot, then select the Read and Write option.

Choose Web App, Automated App or Bot under the Type of App section. Automated Apps and Bots are built to perform tasks automatically. Bots on Twitter often post information or perform actions on Twitter automatically based on data inputs or triggers.

Twitter User Authentication Settings

Put your own website's URL, or https://www.google.com, in the Callback / Redirect URI field and the Website field. Click the Save button to save the changes.

Twitter will show your OAuth 2.0 Client ID and Client Secret on the next page. You can disregard these values since we are using OAuth 1.0a authentication method that uses broad authorization with coarse scopes (also known as permissions).

API Key Mapping

Here's how the keys and tokens map to the Twitter Bots application:

Twitter API keys