In a land rife with terrible disasters, mental health concerns, and buggy code, one savior rises above them all. That is the MemeBot, the one who will comfort you in your times of need.

Memes work together to provide a satirical outlook on the world, allowing its audience to maintain a critical perception of the issues surrounding them. We thought: what better way to streamline their outreach than by creating a chat bot that will give them to you whenever you need?

What it does

The MemeBot will send you an assortment of top hand-picked memes no matter what way you ask it (and it will learn from its mistakes through basic machine-learning). It will also send you compliments if you say anything else. There is an associated website with links to the facebook page and the github repo, hosted on heroku.

How we built it

Chat Bot: The foundation of the chat bot is built on Python Flask, the Messenger API, the Facebook API, and the API. The user IDs of each user were each provided by the Messenger API. Then, we used Flask pymessenger to let us listen for and send messages to the user IDs. We used the API as a basic machine-learning API to train our chat bot to detect whether the user was asking for memes (in multiple different ways; in phrases, with different spellings, etc.). If the user was not asking for a meme, MemeBot would send them a compliment (of different variations). We also can retrieve the posts with the most likes (and their attached memes) by using the Facebook API.

Subscription feature: Using MongoDB's MLab features, our goal was to create unique schedules for each user. This means that the user could possibly subscribe to the MemeBot, sign up for daily/chosen day memes to be sent, and otherwise "schedule" all their meme/positive compliment interactions between MemeBot. We created a NoSQL database which stored Facebook's User IDs and ideal meme times/scheduled days. We controlled the data using PyMongo and using python's Threading Timers to schedule multiple events at once.

Collecting Memes: We used Facebook Graph API to "log on" to Facebook using a user token, and then access a meme page token. From the meme page token, we gather a given number of the most recent posts (specified by the user). Then, we extract specific information: the meme image urls, picture preview, and total likes, from the page token. This allowed us to gather the most popular/recent memes and send them to the user.

Website: The website was built using HTML and CSS. We modified a basic template in order to include memes to give users a preview of what the MemeBot is about. We used fontawesome for the github and facebook icons, which lead to their respective websites. The memes on the website scroll to the left and loop around in order to set the "feel" of a "meme" website.

Challenges we ran into

The biggest challenge we faced was that our team members had different coding environments. Some team members coded in python2 while others coded in python3, and we struggled to compile correctly. Every time we ran into a mergeconflict or change in code, we had to change it back depending on the computer and user. This problem was also not understood until after we finished our respective sections of the project. We eventually solved the problem by realizing that the problematic code could be run on python2, but not python3, and therefore switching on the computer to run on python2.

The Facebook Graph API was also confusing to use, especially since it was hard to find developer code to follow. We had to search around and try a few options to use, and ran into a lot of bugs within the code. It also took us quite a bit of time to understand much of the syntax used in the Graph API and convert it to python code.

Accomplishments that we're proud of

I think the most impressive part was that when we were faced with dividing up the work into smaller, individual parts with a new team, we all took initiative to add our own functionalities. Amazingly, we successfully distributed the tasks and were able to coordinate using git in order to bring the different components together in order to make a multifaceted MemeBot with a website and parts with different purposes. We were proud of all being able to learn multiple APIs, languages, and servers on the spot including hosting our chatbot on heroku, which lets users from anywhere in the world to visit our website and chat with our bot.

When we first decided on our topic, we were probably frustrated the most with the Facebook Graph API and had many difficulties using it. At one point, we were considering using a different API and changing our MemeBot to Slack or other servers, but we eventually persevered until we got the Facebook Graph API to function.

What we learned

Throughout this hackathon, a small, funny idea quickly snowballed into an incredible learning experience. As we came up with additional features, we realized we had to learn a variety of APIs and tools. From past experience, we knew right off the bat that we needed to have a solid understanding of Git and put in the time to test and coordinate. When we wanted to parse through a page's data, we looked into Facebook's Graph API. In order to develop a subscription service, we learned to create a NoSQL database and using threads to address multiple users at once. The most exciting learning experience was implementing machine learning through natural language processing, especially after attending the Neural Network workshop.

What's next for MemeBot

MemeBot lives with a bright future. It will expand to be able to include memes from other public pages and be able to sift among the public pages to gather the best memes within Facebook. It could also expand to other public sites including Reddit, Instagram, Google, and iFunny. We will also improve the subscription service so that they can receive messages from topics of interest daily, in which a user can type in a word/phrase/sentence, and MemeBot would send a group of memes that best fits that word/phrase/sentence. We will also improve the website to include more memes and functionality, such as a share button and login/logout section.

Built With

Share this project: