How to get credentials for a new Twitter bot

I wanted to build a Twitter bot that would tweet Covid sewage graphs from this page every day.

To do that, I needed the following four credentials for a new @covidsewage Twitter account.

Applying for a Developer account

I created my new Twitter account, then applied to set that up as a Twitter Developer on https://developer.twitter.com/

When I filled in the form there I said I wanted to create a bot. I think this is one of the things that triggers a manual review flow.

I filled out the application form and submitted it.

I then got an email requesting further details - I replied to that email with pretty much a copy of the data I had entered in the application form early on.

A few days later my application was approved.

Configuring the app

Since the goal here is to get credentials that can be used to write to the account (in order to Tweet), the application needs to be configured to support that.

It turns out you need to turn on "OAuth 1.0a" in order to generate a read-write token for the account (thanks Igor Brigadir for the tip).

The following settings worked for me:

Screenshot showing settings - I set it to read-write permissions with OAuth 1.0 and filled out the website and callback URI fields

Since callback URI and website URI were required (even though I'm not going to be using them) I set them to the Twitter profile page, which seemed to work.

Generating the credentials

Having configured the app, the "Keys and tokens" page for that application gave me the option to generate an access token and secret for the account:

Screenshot indicating the revoke / regenerate token button

Building the bot

Having generated the four credentials I needed, I built the rest of the bot using GitHub Actions, see https://github.com/simonw/covidsewage-bot

Created 2022-04-17T16:03:22-07:00, updated 2022-04-17T16:22:35-07:00 · History · Edit