Campfire API

Messages

Speak

POST /room/#{id}/speak.xml

Sends a new message with the currently authenticated user as the sender. The XML for the new message is returned on a successful request.

The valid types are:

  • TextMessage (regular chat message),
  • PasteMessage (pre-formatted message, rendered in a fixed-width font),
  • SoundMessage (plays a sound as determined by the message, which can be either “rimshot”, “crickets”, or “trombone”),
  • TweetMessage (a Twitter status URL to be fetched and inserted into the chat)

If an explicit type is omitted, it will be inferred from the content (e.g., if the message contains new line characters, it will be considered a paste).

Newline characters are ignored for TextMessages. In order to include newlines inside of a PasteMessage, use this escape code: 


Request

<message>
  <type>TextMessage</type>
  <body>Hello</body>
</message>

Response

Status: 201 Created

<message>
  <id type="integer">1</id>
  <body>Hello</body>
  <room-id type="integer">1</room-id>
  <user-id type="integer">2</user-id>
  <created-at type="datetime">2009-11-22T19:11:41Z</created-at>
  <type>TextMessage</type>
  <starred>false</starred>
</message>

Highlight

POST /messages/#{message_id}/star.xml

Highlights a message.

Response

Status: 200 OK

Remove a highlight

DELETE /messages/#{message_id}/star.xml

Removes a message highlight.

Response

Status: 200 OK