A tenant REST client is provided that automatically handles the construction of authenticated requests for each of operations available in the HipChat API v2. The REST client automatically generates and refreshes OAuth2 tokens as needed.
The REST client is available through the ctx.tenantClient
interface. Each of the listed methods below are asynchronous and return a promise. Where available, options
are specified as query parameters in the HipChat REST API documentation.
The ctx.roomClient
interface is thin wrapper around the tenantClient
object that's provided in room-specific request contexts. Only the methods of the tenantClient
that require a room id are exposed on this object, with the room id already partially applied for convenience.
Method |
Description |
getRooms(options) |
List non-achived rooms |
createRoom(room, options) |
Create a room. The room argument must be a map representing the request body. |
getRoom(roomIdOrName, options) |
Get room details |
updateRoom(roomIdOrName, room) |
Update room details |
deleteRoom(roomIdOrName) |
Delete room and kick participants |
getRoomHistory(roomIdOrName, options) |
Fetch chat history for this room |
getRecentRoomHistory(roomIdOrName, options) |
Fetches latest chat history for this room |
getRoomStatistics(roomIdOrName) |
Fetch statistics for this room |
getRoomMembers(roomIdOrName) |
Get all room members |
setRoomTopic(roomIdOrName, topic) |
Set the room topic |
shareLinkWithRoom(roomIdOrName, link, message) |
Share link with room |
addRoomMember(roomIdOrName, userIdOrEmail) |
Invite a user to a room |
removeRoomMember(roomIdOrName, userIdOrEmail) |
Remove user from a private room |
For details on webhook REST client operations, please see the Webhooks page.
Methods that operate on a room or a user can be instantiated using a thin wrapper that provides methods to operate on the specified user or room. For example:
#!js
var roomId = 1;
// Using room methods on ctx:
ctx.getRoom(roomId);
ctx.getRoomMembers(roomId);
// Using helper wrapper:
var roomHelper = ctx.forRoom(roomId);
roomHelper.getRoom();
roomHelper.getRoomMembers();
Method |
Description |
forRoom(roomIdOrName) |
Wrapper around room methods |
forUser(userIdOrEmail) |
Wrapper around user methods |