node package manager


wadey's fork of: A node.js library for interacting with Campfire


Ranger is a node.js library for interacting with Campfire.

Install ranger using npm.

npm install ranger

Create a new client with the following:

var client = require("ranger").createClient("account", "api-key");

The createClient function takes two parameters:

  1. The account name, which is the subdomain of your account url. If your account url is then your account name would be 37signals.
  2. The api key of the user to connect as. You can get it from the "My info" link once logged into Campfire.

Get a room by id:, function (room) { console.log(room); });

Get an array of all rooms:

client.rooms(function (rooms) { console.log(rooms); });

Get an array of all rooms the api user is in:

client.presence(function (rooms) { console.log(rooms) });

Search for messages containing terms:"party time", function (messages) { console.log(messages) });

Get a user by id:

client.user(12345, function (user) { console.log(user); });

Get the api user: (user) { console.log(user); });

Speak a message:

room.speak("hello world");

Paste some text:


Play a sound:"trombone");

Show a tweet:


Update the room:

room.update({ name: "Lounge", topic: "Anything goes" });

Join the room:


Leave the room:


Lock the room:


Unlock the room:


Get an array of users in the room:

room.users(function (users) { console.log(users); });

Get an array of up to 5 recent file uploads in the room:

room.recentUploads(function (uploads) { console.log(uploads); });

Get an array of up to 100 recent messages in the room:

room.recentMessages(function (messages) { console.log(messages); });

Listen for messages in the room:

room.listen(function (message) { console.log(message); });

Get whether messages are being listened for:


Stop listening for messages in the room:


Get an array of messages for a day:

room.transcript(function (messages) { console.log(messages); });

var newYears = new Date(2011, 0, 1);
room.transcript(newYears, function (messages) { console.log(messages); });

Star the message:;

Unstar the message:


Get the upload details for the message:

message.upload(function (upload) { console.log(upload); });

The following example joins room 123456 and plays the vuvuzela sound whenever anyone uses the word "soccer".

var client = require("ranger").createClient("account", "api-key");, function (room) {
  room.join(function () {
    room.listen(function (message) {
      if (message.type === "TextMessage" && message.body.match(/soccer/i)) {"vuvuzela");
  1. Fork Ranger
  2. Create a topic branch - git checkout -b mybranch
  3. Push to your branch - git push origin mybranch
  4. Create a new pull request

Matt Duncan | |