PyCon 2019 in Cleveland, Ohio

Sunday 10 a.m.–1 p.m. in Expo Hall

Chirps: A Twitter Bot Framework written in Python

Saurabh Chaturvedi, Parth Shandilya


Twitter bots are a powerful way to up your social media game as well as extracting information from the microblogging network. By leveraging Twitter’s versatile APIs, a bot can do a lot of things - tweet, retweet, “fav-tweet”, follow, reply automatically and much more! When done in the right way, the combination of the above actions can be of great utility. Even though some bots can abuse their power and give a negative experience to other users, research shows that people view Twitter bots as a credible source of information. For example, a bot can keep your followers engaged with content even when you’re not online. Some bots even provide critical and helpful information (e.g, @EarthquakesSF). It is estimated that bots account for about 24% of all tweets on Twitter. While there are lots of Twitter bots out there executing different tasks - from tracking politically invoked Wikipedia edits to giving AI-driven answers, most bots are based on certain rudimentary actions. For example, every bot (obviously) tweets. Many also reply to celebrities. Majority of them mine useful information from rest of the web and tweet it out. Thus, there arises a need of a tool that allows us to quickly build such bots (instead of coding them from scratch) and deploy them with ease. This was our motivation behind developing Chirps - a flexible and open source Twitter bot building framework written in Python3. In this poster presentation, we will demonstrate how you can set up your personalized Twitter bot with Chirps. Later we’ll dive into some interesting implementation details of our framework. We will first go through the process of obtaining the Twitter APIs’ credentials, then feeding information to Chirps for customizing your bot behavior, and even some basic monetization (yes, a Twitter bot can even buy you a cup of coffee)! Later we’ll talk about how we combined the concepts of multi-threading paradigm, Python’s generator functions, web scraping, some SQL and even a bit of NLP to build this efficient, robust and (of course) Pythonic Twitter bot framework, aka Chirps. Moreover, we’ll also give ideas about possible extensions to Chirps so that you can come up with your own (and perhaps better) bot framework and deploy your own army of amazing bots 🙂. We’ll also mention about certain important responsibilities which come with owning Twitter bots (also referred to as “botiquette”). Finally, we’ll discuss some ideas for using bots and describe their prospective implementation with Python and Chirps as well as some popular bot deployment methodologies. After all, when it comes to building Twitter bots, the sky is the only limit!