Skip to content

Instantly share code, notes, and snippets.

@RanKey1496
Created March 26, 2019 18:49
Show Gist options
  • Save RanKey1496/19d7704ec66d8ed7273d37a4ff21f778 to your computer and use it in GitHub Desktop.
Save RanKey1496/19d7704ec66d8ed7273d37a4ff21f778 to your computer and use it in GitHub Desktop.
View channels messages in Rocket.Chat
You can already do this by connecting to your Mongo database.
List the rooms with db.rocketchat_room.find({}), grab the ID of the room you want the history for.
Then you can see that room's history with db.rocketchat_message.find({"rid": "your_chatroom_id"}, {"u.username": 1, "msg": 1, "_id": 0}).sort({ts: 1}).map(function (d) {return d.u.username + ": " + d.msg})
It's not as intuitive as a web interface, but auditing your users' chat logs should seldom be done therefore this is a viable workaround in the meantime.
This topic attracts a great deal of controversy, as it should. That being said, this method is a workaround until there is a corresponding UI. This also means that you are already being recorded when chatting using RocketChat since your messages are saved in the database unencrypted (unless you use OTR). If you allow your users to edit/delete their messages, they are indeed modified/deleted from the database, so take that into account.
Credit: https://github.com/RocketChat/Rocket.Chat/issues/2869#issuecomment-280046547
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment