Art and Technology

Summarized using AI

What I Learned From Building a Twitter Art Bot

Nynne Just Christoffersen • May 25, 2018 • Sofia, Bulgaria

In her talk at the Balkan Ruby 2018 conference, Nynne Just Christoffersen shares her experiences and learnings from building a Twitter art bot named Egg Spot. This bot utilizes the Rijksmuseum's API to allow users to tweet a word and receive an image from the museum's collection in response.

Key points discussed include:

  • Project Overview: Nynne introduces Egg Spot, emphasizing its connection with the Rijksmuseum, and invites the audience to interact with the bot during her presentation.
  • Inspiration: She highlights the importance of open data in cultural institutions, referencing movements like OpenGLAM, which advocate for publicly funded cultural institutions to share their collections freely.
  • Technical Aspects: She outlines how to create a Twitter bot using Ruby, detailing the setup needed to work with both the Rijksmuseum API and the Twitter API.
  • Development Process: Nynne documents her development journey using tweets to convey the project’s progress, showcasing initial testing phases and challenges faced along the way.
  • Challenges and Learnings: Nynne discusses significant mistakes, including exposing sensitive keys on GitHub and creating an infinite tweeting loop that led to her account being temporarily blocked by Twitter. Each challenge served as a valuable learning opportunity, enhancing her understanding of bot creation and API usage.
  • Conclusion: Ultimately, Nynne emphasizes the enriching experience of merging her passion for art with her technical skills, encouraging developers to explore similar projects. The bot serves as a testament to the creative potential of technology in the cultural sector.

What I Learned From Building a Twitter Art Bot
Nynne Just Christoffersen • May 25, 2018 • Sofia, Bulgaria

Nynne Just Christoffersen is a Copenhagen-based developer with a background in Art and Design History. In her spare time she enjoys her unhealthy obsession with meetup.com. She's the organiser of Rails Girls Copenhagen and the Copenhagen tech book and film club, among many other things.

Balkan Ruby 2018

00:00:06.919 Thank you so much for having me. I really enjoyed my first time in Sofia, and I have really enjoyed this conference so far.
00:00:17.880 Today, I'm going to talk about what I learned from building a Twitter art bot. This is what I built: it's called an Egg Spot. It's a bot that works together with the database of a museum in Amsterdam called the Rijksmuseum.
00:00:30.480 Usually, people have a demo time a little bit later in the talk, but I'm going to welcome you right now to try it out! What you do is tweet one word, and you can also try more words, but maybe start with one.
00:00:41.460 The bot uses that word as a search term in the Rijksmuseum collection and responds with an image. All the images I used for this presentation are from the Rijksmuseum.
00:00:56.250 I had a lot of fun looking for illustrations to represent certain things, and I was trying to think of a good way to use these beautiful old images to illustrate bots. This is one of the best images I came up with—it depicts humans imitating each other in various ways.
00:01:14.040 I was actually surprised when I looked for a definition of bots, as there aren't really any good ones out there. Here's one: a computer program that works automatically, especially one that searches for and finds information on the Internet. I also really liked this association from the dictionary that referred to it as a 'killer app.'
00:01:36.990 I started working on this project a little while ago, and there was a bit more of a sense of innocence around Twitter back then. It was sort of a fun and playful platform. However, it has since gone south, and Twitter bots have been in the news cycle for all the wrong reasons. This is a headline from just a few days ago, stating that bots, especially Twitter bots, have been involved in swaying elections and causing trouble.
00:02:04.430 We've all been annoyed by them on Twitter. One well-known example is a project that involved building an AI-based Twitter bot that would absorb human language and mimic the behavior of people who tweeted at it. While it started as an experiment to understand human interaction, it was hijacked by an army of trolls and quickly began spewing out racist and sexist comments.
00:02:43.660 This is one of the nicer tweets I could find from that project, which serves as a good example of how a Twitter bot can go awry. Like many AI systems, it ended up reproducing human behavior, which can be dangerous.
00:03:00.030 However, I was inspired by something else when I started building my bot. I have a background in art history and worked in museums for many years before becoming a developer. One thing that inspires me is the idea of sharing data freely within cultural institutions. For instance, the head of the digital collection at SF MoMA stated that by making data public and usable, the museum's API becomes a platform for open exploration.
00:03:30.570 This concept is part of a movement called OpenGLAM, which stands for Open Galleries, Libraries, Archives, and Museums. The idea is that since we've already partially funded these cultural institutions through our taxes, we should also be able to access and enjoy the incredible content they house.
00:03:53.560 Inspired by this, I wanted to create a project that dealt with some of this data. I knew early on that I wanted to work with the Rijksmuseum API. I explored a few museum APIs, but I chose this one because it was really well-documented.
00:04:05.250 So how did I build it? If anyone wants to create a Twitter bot, I encourage you to go ahead; it’s pretty easy, especially with Ruby. You just have to create a client to communicate with the API, and there is a fantastic Twitter gem built by former Mint or Mine member, Eric. Then, you need to set up keys in your client to interact with the APIs.
00:04:25.830 In my case, I’m working with both the Rijksmuseum API and the Twitter API. After setting up the keys, I implemented very basic methods—one called 'get image' and another called 'reply with image.' To prevent the bot from endlessly replying to itself, I made sure to limit its responses.
00:04:47.100 I really appreciate this project because developers often document their trials and errors through platforms like GitHub. In this case, the Twitter account itself has a nice log of its development process. The first tweet simply said 'hello,' and subsequent tweets demonstrated the progress, including some rough interactions with the API.
00:05:06.990 I left all these tweets on the timeline because I think they’re part of the story of creating the bot. I probably should have started with test-driven development, but instead, I dove in and started implementing features. My testing involved tweeting things like, 'Does it work now?' over and over as I iterated.
00:05:37.390 After initial success, I faced a significant issue. I had set a default value for instances when the bot couldn't find an image for the word used, which caused it to respond with tulips repeatedly. While this was amusing, it also highlighted a problem: the bot could only function with search terms provided by museum employees, so its flexibility was limited.
00:06:05.460 Recognizing this limitation, I wanted to enrich the bot's responses. Therefore, I created another method called 'random image' to ensure that when it couldn’t find the specific term, it would at least provide something interesting to keep users engaged.
00:06:26.520 I really wanted to talk about the challenges I faced during this project. This was a side project I did for fun, and I learned so much. Working on larger projects with established teams usually streamlines the setup, but here, numerous things went wrong, and those errors turned out to be the most valuable learning experiences.
00:06:51.600 One major misstep was accidentally exposing all my secret keys on GitHub, which was an eye-opening experience. It was a mistake I certainly won't repeat. I learned how to rectify it and discovered that GitHub has a way to remove sensitive information from a project's history. It's a complex process, but I eventually found a tool called Repo Cleaner, which simplified the process significantly.
00:07:14.060 Another fail occurred when I inadvertently caused the bot to enter an infinite loop. I tweeted excitedly that users could now engage with the bot to receive images from the museum, which led to some unintended consequences. The bot started responding endlessly to itself, creating an infinite feedback loop.
00:07:45.440 Within minutes, Twitter blocked the account. The bot was set up with a sleep timer, which prevented it from tweeting too quickly, but within just a few minutes, it still managed to issue around 25 tweets. This incident gave me a newfound respect for Twitter, as they acted swiftly to shut it down.
00:08:05.440 Luckily, the issue was resolved, which was another fun learning opportunity. This project was built during the Code and Cake event, and it was my first venture into combining my passion for art and cultural institutions with programming. It certainly won't be my last.
Explore all talks recorded at Balkan Ruby 2018
+12