#NetNarr: Making a PeaceLove& Twitter Bot

PeaceLoveBot

Yesterday, I wrote about diving into the world of Twitter Bots for Networked Narratives, and my interest in creating my own Twitter Bot, if only to understand the process of how it is done.

Well, I did it. Check out the PeaceLove&Bot bot. Every six hours, the PeaceLove bot will send out a new tweet that begins with the lines made famous in the Elvis Costello song (but written by Nick Lowe) with random word replacing “Understanding” in the lyrics. I’ve included the #NetNarr hashtag in the code, too, so that the tweets get sent into the NetNarr twitter stream.

Phew. It was both easier and more difficult than I thought, and it took a long time on Saturday to get all of the programming pieces together. I used a free program called Tracery and hosting site called Cheap Bots by the very generous @GalaxyKate and George Buckinham.

The easy piece was that Kate and George really make the programming possibilities fairly simple to use. The difficult part was the ins and outs of making sure I was writing my code correctly, for any little thing made the bot go boink (hard to resist that alliteration and Scooby Doo onomatopoeia).

First, I had to create an entire new Twitter account. Which I did. But then when I connected the Cheap Bots to the account, Twitter got mad and shut down my account, asking me for a phone number to reinstate the account. I did that, and then realized that now my main Twitter account could not use the same mobile phone number as my bot account … ack … I confirmed that Cheap Bots could use my new Twitter bot account, and then reversed the use of the phone number (which I use as a validation tool for my Twitter account).

Peace Love Bot Code

Second, I had to figure out the coding of Tracery. I looked at Kate’s example, and how it worked, and followed a link to her tutorial (which was more complicated to me, a non-coder, than I wanted it to be). I tried to tinker with the program and kept failing. Hmmm. I Google searched Tracery and found an interactive site called Bother that allowed me to replace its code with my own, and generate a code that Tracery would use. Phew. I still spent a lot of time tinkering but it worked. You can look at and remix my code, too, if it helps.

Third, I was stuck with the question. I am making a Twitter Bot, but what should it say to the world? I had Elvis Costello in my head, singing along with What’s So Funny (about Peace, Love and Understanding) and wondered if that might be a way to keep true to staying positive in this negative time of Trump, while also keeping the underlying mechanics of the Bot simple. It would use a common phrase but replace a word each time with a random word from a database.

Fourth, what database? I realized that while ideally I would have my bot draw from some outside database, I could not take on the technical aspects of that. Tracery allows you to make your own database right in the code, so I did that, mulling over phrases and words that would remain positive and still fit in the song title. At one point (and I might return to this), I had this idea of using the invented, made-up words from my students’ Crazy Collaborative Dictionary (which I wrote about the other day) as the database for the bot. But when I experimented, the bot didn’t seem to want to recognize the invented words. It may have been something that I did wrong with the code. Not sure. So I went back to my original database.

And now? The PeaceLove&Bot is loose upon the world. Every six hours, a new tweet is sent out. I may yet add more words to the database, and heck … I invite you: What words or phrases should end the What’s So Funny about Peace Love and ?????? Leave a comment here at the blog. I’ll add your word in.

Peace (not so funny in these tumultuous days),
Kevin

4 Comments
  1. That was YOU! Hah, I thought it was someone else.

    In another comment I suggested Zach Whalen’s Google Spreadsheet method

    http://zachwhalen.net/posts/how-to-make-a-twitter-bot-with-google-spreadsheets-version-04/

    and forgot this way to create a “reaction” bit with iffft and buffer
    http://www.janaremy.com/pilgrimsteps/2016/08/11/creating-activist-twitter-bot/

    Here is a bonus trick for dealing with Twitter’s need for a phone number to access the dev tools… I have like 14 accounts, and never remember which one I have linked to a phone number.

    Send ‘stop’ text message to 40404 — it will disconnect the phone from whatever account is using that number. If you do want it to a specific one, you can add it back in via the twitter profile

    Peace out, hippie!

  2. Love, love, love this!!! Huge fan (and a follower)! Way over my current capabilities and/or patience at this juncture….However, I am curious: what does the back end of a bot look like. Can you interfere with the mechanics once it’s in play…I don’t mean by changing the e-functions, but by interjecting and responding ala human-esque to a “follower”….and what happens when someone writes @ “you?” I think I’m having some personal anxiety with my bot interactions….feeling “judged” or something…LOL. I feel like there are a bunch of bot easter eggs out there waiting to be discovered like when you ask Siri certain questions or google XYZ….etc. Sorry for all the asks….no rush for reply. 🙂

    • Hi Laura
      Great questions — I can go in as the “bot” and be the human behind the screen (it’s just a regular twitter account after all) and actually, that would be funny to suddenly humanize what seems to be an automated bot. Ha. When someone writes to the bot, it responds, but only with a regular tweet (as if it were being forced into automation). Interestingly, that’s not how I coded it but something happened (and I don’t know what) and now it does what it does. Maybe the bot is really in control after all.
      And I get that anxiety of interaction with bots — it is strange.
      Kevin

Leave a Reply to dogtrax Cancel reply

Your email address will not be published. Required fields are marked *