Scamp is a great bot framework for Campfire, and here’s how to get a bot up and running in no time on Heroku.
First up, create a new directory for the project and make sure
bundler and heroku gems are installed.
mkdir scampbot;cd scampbot
gem install bundler heroku
Then create a Gemfile
1 2 3 | |
bundle, set up a git repo, and then create a new Heroku app
bundle
git init
git commit -a -m "boom"
heroku create
As Heroku is happy running Rack based apps, all we need to do here is include a rackup file named config.ru in the root directory.
1 2 3 4 5 6 7 8 | |
This tiny Rack app will just respond to any request with “It’s Alive!” - handy for stopping Heroku apps sleeping on the job. Push it up to Heroku and try it out.
git add .
git commit -m "Adding config.ru"
git push heroku master
heroku open
Next grab your Campfire API key - rather than checking this into the repo create some config vars instead
heroku config:add CAMPFIRE_KEY=your_api_key SUBDOMAIN=your_subdomain
With those variables in place start on Scamp
1 2 3 4 5 6 | |
Now the basics are in place all that’s left to do is define some simple behaviour and connect to the rooms
1 2 3 4 5 6 7 8 | |
And that’s it, push it up to Heroku!
git commit -m "adding scamp"
git push heroku master
Or for the super quick version, clone my example app.
When you’ve got the basic setup in place I highly recommend checking out the Scamp Readme to learn about some of Scamp’s other moves.