When I was younger I had a really obnoxious toy called the Insultinator. It generated random PG to G-rated insults, and was a pretty fun toy all-in-all. The memory of it would later inspire me to write my first-ever application that would see any sort of real-world activity. The InsultinatorBot. It was written as an extremely simple python script that used ascii text files for data storage and used an out-moded version of the slackclient SDK for Python. Afterwards, I decided to make a nearly-identical counter-part, the ComplimentorBot. Both were installed in a workspace I share with some college friends. But both apps are in dire need of a complete overhaul.

There are several benefits of giving and receiving compliments that have been documented in scientific studies. Receiving compliments activates the same parts of the brain that receiving gifts activates (source), and receiving praise can help us learn new skills faster (source). They may also foster mindfulness, confidence, and emotional wellbeing.

What it does

Any member of a workspace that ComplimentorBot is installed on may invoke the bot with one of two commands (so far). The /compliment-someone command invokes ComplimentorBot to generate a random compliment for a random workspace team member. the /compliment-myself command causes the bot to generate a random compliment for the user that entered the command.

How I built it

ComplimentorBot is written as a Flask webapp hosted with Apache2 on an Amazon EC2 instance. It also has a database managed by MariaDB running on an Amazon RDS instance which it uses for storing its vocabulary and necessary information about workspaces that have installed the app. It uses the Slack EventsAPI and Slack WebAPI to interface with the slack service. I also set up a Dynamic DNS service and SSL/TLS which is required to use slash commands with the Slack API.

Challenges I ran into

There were no shortage of challenges. Prior to this weekend, I had never used AWS, Apache, or Flask. And I had never set up DynDNS or SSL/TLS. I had only very limited experience with the Slack API, and what little I had used it was largely abstracted away by the SDK the previous bot versions had been written with.

It took me the first two days to get AWS, Apache, Flask, DynDNS, and TLS set up and configured correctly. I wrote virtually no code for my application until the last day of the event! Then and only then could the Slack API-based challenges begin!

Accomplishments that I'm proud of

I am very proud that I overcame the many challenges I ran into. Perhaps it was foolish to jump into a project with so many unfamiliar frameworks, but I made it through to the other end.

What I learned

I learned a ton! I learned how to spin up and configure AWS EC2 servers and RDS databases. I learned how to configure them so they can talk to each other and the outside world. I learned how to install and configure Apache to securely host a webapp (or at least that I'm capable of slowly and painfully stumbling through the process). I learned about setting up Dynamic DNS services and getting an SSL/TLS certificate through CertBot to enable HTTPS encrypted communications. And finally I learned how to write a Flask app that receives and responds to requests and communicates with a database.

What's next for ComplimentorBot

I was not able to accomplish everything I had set out to do. In its current state, ComplimentorBot still cannot be installed across multiple workspaces. I would also like to incorporate more commands. These might include the option to compliment a particular person and a way to add words to ComplimentorBot's vocabulary (once they're approved by the bot's administrator).

Share this project: