How to Create Multiple Bots With a Single Twitter Developer Account

Jelilat Anofiu
Geek Culture
Published in
4 min readApr 23, 2021
Photo by Alex Knight on Unsplash

One of the issues I encountered while building my first Twitter bot was that the bot was tweeting from my personal account instead of my bot account. After doing some research, I realized that this is a common issue in the Developer Community.

But unfortunately, the Twitter Community answer I came across wasn’t really explanatory for beginners. A few weeks after managing to figure this out on my own, someone asked a similar question on Botmaker’s Slack Channel and that was my cue to write this article.

Screenshot by Jelilat Anofiu from Botmakers’ Slack channel

The proposed solution from this screenshot was to apply for a new developer account for the bot, but you will come to know that this isn’t practical in the long run.

And why is that? 👇

As a hobbyist who wants to build many Twitter bots for fun or as a professional who creates Twitter bots for various organizations, applying for a new developer account with each bot you build is highly impractical and can be time and effort draining.

As some people have pointed out in the comments, it is also against Twitter’s rules and regulations to have multiple developer accounts.

A single Twitter user can have a single developer account or can be a member of a team account.

To make things easier for developers who want to create multiple Twitter bots, I’ll be sharing a step-by-step guide on how to associate a single Twitter Developer account with multiple bots.

If you don’t already have a Twitter Developer account, I wrote a simple guide on how to create one in my previous article.

Terminologies

To better understand the rest of this article, there are some Twitter developer terminologies you need to familiarize yourself with.

  1. Projects: They can be used to organize your work based on how you intend to use the Twitter API, manage your access to the API, and also monitor usage. Each Project contains an App, with which you can generate authentication credentials.
  2. App: An App is any program, tool, or bot, that makes API calls. Twitter grants authentication credentials to apps, not accounts. Therefore, you need to create an app to be able to make API calls.
  3. Bearer Token: This method is specifically for developers who need read-only access to the Twitter App. It is specific to an App, and it is used to authenticate requests on behalf of your App.
  4. Oauth Key & Oauth Token Secret: Also called the Access Token and Access Secret respectively, they are user-specific credentials used to authenticate OAuth 1.0a API requests.
  5. Consumer Key & Consumer Secret: Also called the API Key and API Secret, it is similar to your Twitter account’s email and password. With these two tokens, you can perform any read and write permission on an individual’s account. This is what we need to create a program that tweets from a bot’s account.

You can generate your own consumer key and consumer secret if you would like your app to make requests on behalf of the same Twitter account associated with your developer account on the Twitter developer app’s details page.

However, if you’d like to make requests on behalf of another account, you’ll need to follow the steps below.

  • Visit the URL “https://twitter.com/oauth/request_token?oauth_consumer_key=<YOUR CONSUMER KEY>&oauth_callback=oob” on the account associated with your Twitter Developer App. That is, the account used to request Twitter Developer access.

Something like this should show up in your browser. It’s a temporary token and will expire after using it once. Copy the tokens and paste them somewhere.

  • Now, log in to your bot account, then paste this URL in the browser “https://twitter.com/oauth/authenticate?oauth_token=<NEWLY GENERATED TOKEN>”. Replace the oauth_token in the link with the newly generated one you copied earlier.

Now, click on Authorize app to grant access. After clicking on that, you should see an autogenerated 7 digit number. Copy that number somewhere.

Finally, visit the URL below on your browser, and you’ll get the OAuth tokens required to post via your bot account.

https://twitter.com/oauth/access_token?oauth_token=<NEWLY GENERATED OAUTH TOKEN>&oauth_verifier=<7 DIGIT PIN>

--

--