Set up a twitter account. You’ll need a phone number to do this, so if you have an existing Twitter account attached to your phone number, make sure you go into your existing account, delete the mobile number, and log out again. You can add it back again later once your new bot is working.
Set up a Twitter app. Go to apps.twitter.com, sign in as your new bot account, and set up a new app. You’ll need to take note of four numbers: the Consumer Key, Consumer Secret, Access Token and Access Secret (to get these last two, clink on “create my access token” at the bottom of the page).
From here, you have two choices, depending on your resources. If you have access to Google Docs, you can run a bot easily using method #1. If you prefer to run the bot from your own server, choose method 2.
If you have a Google Docs account, head on over to Zach Whalen’s site here for instructions. He has a nice little bot script set up via Google Sheets for you to customize and publish, without need for other server arrangements.
find the sheet here and click on “copy” to make a copy of it to your google docs account under “sheets.”
Whalen’s script has several “styles” to tweet in. For Intimate Fields, we chose to use the “Markov” flavor. Markov chain generators chop up existing text, look for repeated patterns, and then recombine text according to the patterns it finds. Because posies are generic (making use of repetitive tropes and combinations of words) they’re an excellent corpus for Markov remixing. Choose “Markov” on line 43.
go into the “Markov” portion of the spreadsheet and delete the Austen text there, replacing it with a posie corpus. We created one consisting of posies from Loves Garland and a couple of other full-text historical posie collections (along with a set of 90 phrases from Roland Barthes’ A Lovers Discourse and 10 phrases from Bruno Latour’s Aramis). As a sample, you can find ours under
corpus.txt in the Intimate Fields twitterbot repository.
If you want to roll your own, you’ll need to find some good Markov scripts and a Twitter script for posting. We’ve included files for running on Python in the repository. You’ll need two Python packages, Markovify and Tweepy. You can get them both from Github or (easier) via
From the Intimate Fields repository download
keys.py into the same directory.
corpus.py text with your own, if you want to add extra (or different) posies
keys.py and replace the blank text with your keys: Consumer Key, Consumer Secret, Access Token and Access Secret from step 2.
markov.py and replace the twitter account handle at the bottom of the script with your own.
Open up Terminal, navigate into the directory with your four files, and run the bot by typing
python markov.py. If all’s well, your bot will tweet a new posy.
Keeping your bot running continuously will depend on your setup. If you’ve got a dedicated Raspberry Pi set up, you can just set up a cron job telling it to run the script every 30 minutes. Or, if you have shell-access hosting somewhere, you can upload the files to your host and run the cron job there.
Note Every environment is different. For Dreamhost, here are a few useful links on your way to setting up the script and running it: