opensoul.org

Tinder: Campfire API

update: Tinder can listen

update: Tinder is now available as a gem from rubyforge. Check out http://rubyforge.org/projects/tinder for more information.

For a project that I’m currently working, the client wants to be able provide live chat to its users. So, instead of re-inventing the wheel, we decided to try to use Campfire. The only problem is that I need to be able to create and destroy chat rooms automatically, and Campfire doesn’t have an API.

Caboo.se has done some work on a Campfire bot called Marshmallow but the code repository is unavailable. And, it doesn’t seem to allow you to create and delete rooms.

So, introducing Tinder, an API for interfacing with Campfire:

require 'rubygems'
require 'tinder'
campfire = Tinder::Campfire.new 'mysubdomain'
campfire.login 'myemail@example.com', 'mypassword'
room = campfire.create_room 'New Room', 'My new campfire room to test tinder'
room.speak 'Hello world!'
room.paste File.read("path/to/your/file.txt")
room.destroy

Install

gem install tinder

You can get the source from:

git clone git://github.com/collectiveidea/tinder.git

Tinder can also be installed as a gem or a rails plugin.

script/plugin install git://github.com/collectiveidea/tinder.git

Thanks to Zach Dennis for the name. Feedback and patches are welcome!

Tinder
image courtesy of Tutorials.com

api, campfire, popular, ruby, and tinder December 08, 2006

7 Comments

  1. Mark Haliday Mark Haliday December 9, 2006

    I’m very curious to see how far you can get with this. I’ve been waiting and waiting for 37s to do an API to Campfire but I think they are tied up with other things (like Sunrise and getting Rails 1.2 out the door).

    Keep going I say :-)

  2. Brandon Brandon December 9, 2006

    Contributions would be appreciated :) It pretty much does all that I needed it to do (login, create rooms, destroy rooms) for the project I wrote it for, but it would be cool to make it a full featured “API”.

  3. AJP AJP February 22, 2007

    Hey man. You’re linked up on the campfire homepage.

    Cool beans!

  4. Tim Harper Tim Harper December 15, 2009

    It appears that tinder no longer works after the 37 signals authentication overhaul. Anyone experiencing the same issue?

  5. Todd Todd December 17, 2009

    I’m having the same problem. Attempting to get rooms or users for a campfire site returns empty arrays.

  6. Brandon Brandon December 17, 2009

    Yep, 37Signals broke a bunch of stuff. I probably won’t have time to get it fixed until this weekend.

  7. Robert Robert January 25, 2010

    Yup, I’m having troubles as well. I’m trying to get the camper.rb and running into issues with how it uses room.listen (I think?). ’Would be great if there were some sample code that showed how listen() might be used in such a context. thx.

Post a Comment

Comments use textile. Anonymous comments will be deleted.

My name is Brandon Keepers. I like to build things, usually in Ruby or JavaScript. I work at GitHub and live in Holland, MI.

Popular Posts