 		try	
 			this.response.setTimeout(1000)			
 			return RocketChat.API.v1.success
-				integrations: RocketChat.models.Integrations.find({"channel":decodeURIComponent(@urlParams.channel)}).fetch()
+				integrations: RocketChat.models.Integrations.find({"channel":decodeURIComponent(@urlParams.rid)}).fetch()
 		
 		catch e 
+			return RocketChat.API.v1.failure e.name + ': ' + e.message
+
+
+### Retrieve messages for a specific room
+Requires manage-messages role. The room channel needs to be URL encoded, as the names begin with characters that
+are not URL safe (e.g., '#' and '@'). Example:
+'http://domain.com:3000/api/room/%23testRoom/history'
+###
+RocketChat.API.v1.addRoute 'room/:rid/history', authRequired: true,
+	get: ->
+		if not Meteor.call('canAccessRoom', @urlParams.rid, this.userId)
+			return RocketChat.API.v1.unauthorized()
+
+		try
+
+			rpage = if @queryParams.page then Number(@queryParams.page) else 1
+			ritems = if @queryParams.items then Number(@queryParams.items) else 100
+			msgs = RocketChat.models.Messages.findVisibleByRoomId(@urlParams.rid,
+					sort:
+						ts: -1
+					skip: (rpage-1)*ritems
+					limit: ritems
+				).fetch()
+			return RocketChat.API.v1.success
+				msgs: msgs
+				page: rpage
+				items: msgs.length
+				total: RocketChat.models.Messages.findVisibleByRoomId(@urlParams.rid).count()
+
+		catch e
 			return RocketChat.API.v1.failure e.name + ': ' + e.message
 		
 

that are not URL safe (e.g., '#' and '@'). Example:
'http://domain.com:3000/api/v1/room/%23testRoom/integrations'
###
RocketChat.API.v1.addRoute 'room/:channel/integrations', authRequired: true,
	get: ->
		
		if RocketChat.authz.hasPermission(@userId, 'manage-integrations') is false

			
### Create Private Group
Request example:
  { "name": "room5", "members": ["Jeff","Larry","Stephen"]}
###
RocketChat.API.v1.addRoute 'groups.create', authRequired: true,
	post: ->
