An Automaton for Automating Twitter Outside the API

The first thing I read this morning, besides my webcomics, was that WordPress’s Jetpack extension is dropping automated Twitter posting because of the price. Fair, because yeah, the price makes no sense and Elon Musk is an idiot. This was best summed up by John Gruber when he wrote:

I get the feeling that there are a lot of “enterprise” Twitter API users whom Elon Musk believed would definitely pay these prices, who instead are saying “We are definitely not paying these prices.” Musk thinks Twitter is indispensable. Doesn’t seem like almost anyone else does.

But the thing about Twitter, ya see, is that it works in a browser. Now, quick side tangent:

A circular wall of shelves in a library. Books sit on shelves made of dark wood.

A few years back, a library I was working for got rid of overdue fines. They also wanted to waive all existing overdue fines on patron accounts. Now, the folks at Innovative Interfaces, the company that owns Polaris ILS, were willing to do this for us… for a fee. At the time it was considered custom work because libraries hadn’t yet gotten into the trend of getting rid of overdue fines. Nowadays, this is just a service you can purchase and I believe it’s much cheaper than the price we were quoted.

But, the library didn’t want to pay the fee because it was already a pain to get the required political approvals to get rid of overdue fines in the first place. Telling the politicians that we’d need to pay for that? Yeah, that was dicey.

Thankfully, Polaris Leap exists. It’s the browser based staff client for the ILS. And that gave me an idea — because if you can do something in a browser, you can likely automate it.

I fired up a code editor and got to work in a language that has saved me so much work over the years:


And I designed a bot, an automaton for automation in AutoHotkey. All it did was read patron barcodes from a CSV and then drop those into the Leap barcode box. Leap would look up the patron account and the bot would simply automate all the keyboard actions and mouse-clicks needed to waive the fines. It wasn’t fast, but you could replicate and duplicate. Which meant I had nine of these bots working on nine different CSVs of patron barcodes. Took a few days, but who cares? At the end, me and my bot army waived somewhere around US$1.2 million in overdue fines.

The code for this bot is still online. It’s a mess, the entire process was a kludge, but dammit, it worked.

Which brings me back to Twitter.

A dark cyberpunk style of android with large eyes and a cybernetic face.

Twitter works in a browser. And given that the idiot running the service (into the ground) wants to charge $50,000 a month for API access, that should give anyone a few minutes of pause. Then they should take a look at the workflow required to post tweets through the Twitter website. And then they should fire up a code editor and try writing some AutoHotkey scripts.

Because I see no reason why the entire process of posting something to Twitter can’t be automated, on the browser side, and the user never needs to touch the API.

I could see a workflow where an AutoHotkey script checks a CSV every minute. Within the CSV are things like a timecode, the body of a tweet, and maybe even the path to an image or something. Then, depending on what it finds and when, the script kicks over to the browser, dumps the body text into a waiting Twitter post box, maybe adds the image file, and a simulated mouse click or keyboard shortcut posts the tweet.

Everything about this process makes it 100% a Twitter bot. And Musk banned bots, right? Sure he did. He’s also working on increasing the value of the company by charging extortionist amounts of money for services that were once free. Let us not talk falsely, the hour’s getting late.

The thing about this bot is that, from Twitter’s point of view, from the backend to the front-side to the apps and the timeline, this bot would be totally indistinguishable from a human posting things on Twitter. Because everything going through the bot could be done by a real person. All the bot does is mimic the mouse-clicks and keyboard presses.

And really, unless they cut off browser access to Twitter; which they might, I put nothing past that man when it comes to making shite decisions; there’s no way around such a bot.

I almost want to sign back up to Twitter to test this, to just write the code. But dammit, I want nothing more to ever do with that service. That network is as dead to me as Colonel Sanders and Battle of the Network Stars.

So hi, I want to give an enterprising, possibly bored, coder/developer an idea.

Have fun. And if you’re feeling it, let me know what y’all come up with.