A Campfire component for CakePHP
Here at work we use Campfire for collaboration between our teams and external clients. We find that it makes things easier when you can just email them a URL and don't have to setup up an IM client or worry about public and private servers, those sorts of things.
To give our applications the ability to communicate to our development channel I wrote a component for CakePHP that utilizes Campfire's API for retrieving information and sending messages to an account.
You setup the component in your AppController and provide it with account name (the part before campfirenow.com in the URL) and your authentication token, which can be found under My Info when logged in.
var $components = array(
'Campfire' => array(
'auth' => 'TrLaTiehOeTiAhieP8iedoUPiaSO5SoExl9spius',
'account' => 'acmecorp'
)
);
Note that whichever account you retrieve the authentication token from will be the account that the CampfireComponent will act as, this means it will be bound by the permissions for that account and messages sent will appear from this user.
When you're using the API, it's always through an existing user in Campfire. There's no special API user. So when you use the API as "david", you get to see and work with what "david" is allowed to. Authenticating is done with an authentication token, which you'll find on the "Edit my Campfire account" screen in Campfire (click the "Reveal authentication token for API" link).You can find the source code as a Gist, here at Github.