It wasn’t difficult, but like they say, blog about what would have helped your previous self.
If you’re not already familiar with Heroku, or just need a refresher, check out their tutorial on deploying Node.js apps.
Quick tip: from the command line, using Homebrew on OSX, run
brew install heroku-toolbelt and then
heroku login to get started.
After deploying my working-locally bot using the Heroku tutorial, I kept getting a port error, which DarrenN mentioned in an issue filed on Github. Following benbrown’s suggestions, I first tried running my bot as a background process [as specified in my Procfile], but that didn’t work, likely because I did something wrong. Trying out the second suggestion, I set up a web server using some of Botkit’s built-in functionality. Works as advertised!
The next time I deploy a bot using Botkit and Heroku [which will likely be sooner than later], this is the process I’ll use:
token environmental variable on my Heroku app using Heroku’s toolbelt:
heroku config:set token=all-sorts-of-alphanumeric-biz-from-slack
At the top of my
snark-bot.js file, set up the web server:
web: node snark-bot.js
.envfile containing my sandbox-Slack token and the
heroku localcommand [more info here]. That
.envfile will look something like this:
When everything is working as expected using
heroku local, I’ll then
git push heroku feature-branch:master and check the logs using
heroku logs –tail while testing the newly-hosted-on-Heroku bot to confirm that everything still looks good.
My last step will be merging
master, and redeploying to Heroku using
git push heroku master.
Easy peasy, chicken breezy.