Building a Slackbot 8: Starting Over with BotKit


A few weeks ago I got stuck with my bot. There was this weird bug where if I tried to save a second word to my database it only recorded the first one. I had no idea why. So honestly, I gave up for awhile and decided to get back into CS50. I powered through CS50, which is an amazing course btw, and for the final project I decided to work and finish my bot. Got back on beepboop and this is what I saw:

Yup beepboop was shutting down. I tried reading through the docs and figuring what needed to change so I could deploy on Heroku instead, but I couldn’t figure it out. After hours of messing around with environment variables and changing urls on slack, I gave up and decided to look into some other bot solutions. Eventually I decided on trying botkit.

It was pretty easy getting started. They have pretty good guides for that, but I started getting tripped up on the difference between things like

bot.say
bot.whisper

and

bot.reply

. But after two long days of playing around with the bot and migrating my code, I actually got my bot working!

Annnnd, the save function also works now too. I figured I’d stop there, because I didn’t quite understand how to start the export of vocabulary, but after that I was working my way through EdX’s programming with javascript course. I just got to the last part and it talked about making your api. It never occurred to me that an api is just some function sending back an object formatted as a JSON. So that’s where I’ll head next then. Instead of working on the final project for that class and building an API for some app I don’t care about, I’m going to work on building an export function for my bot.

Until next time!