It wasn’t difficult, but like they say, blog about what would have helped your previous self.
Presumbaly, you’re here because you have a rad bot you built using Botkit, and you’re looking for a bit of guidance on getting it out of your local environment and into the real world using Heroku.

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:
Set my
tokenenvironmental variable on my Heroku app using Heroku’s toolbelt:heroku config:set token=all-sorts-of-alphanumeric-biz-from-slackAt the top of my
snark-bot.jsfile, set up the web server:
- Put together my minimal Procfile, as explained in the Heroku tutorial:
web: node snark-bot.js
- In order to save myself some time, I’ll test Heroku locally using a
.envfile containing my sandbox-Slack token and theheroku localcommand [more info here]. That.envfile will look something like this:
token=different-sorts-of-alphanumeric-biz-from-my-sandbox-slack
When everything is working as expected using
heroku local, I’ll thengit push heroku feature-branch:masterand check the logs usingheroku logs --tailwhile testing the newly-hosted-on-Heroku bot to confirm that everything still looks good.My last step will be merging
feature-branchintomaster, and redeploying to Heroku usinggit push heroku master.
Easy peasy, chicken breezy.