7

Hi, all.

I need to retrieve the list of unread channel messages for each user in order to create a graph for internal use in my company. Looks like there is no "impersonate" feature available via the API. Gitlab says this discussion will be moved to the forum, and the forum redirects to Gitlab. Dead end.

var client = new RocketChatClient(url, "admin", password);
var bobMessages = client.sendAs("bob").getMessagesApi().list();
var johnMessages = client.sendAs("john").getMessagesApi().list();
var janeMessages = client.sendAs("jane").getMessagesApi().list();

Is this somehow possible? Or do I need to manually access the database for getting this info?

Nico Jones
  • 211
  • 1
  • 6
  • detail what you mean by "impersonate". – Hellon Canella Machado Jun 22 '20 at 22:50
  • Achieving the same behavior Google provides via API: the possibility of consuming an API "simulating" you are a given user. You need the proper privileges for doing so, obviously. – Nico Jones Jun 22 '20 at 23:14
  • to every single request to rocket-chat, you should pass the `X-Auth-Token`, and `X-User-Id`. To obtain these params, you need to make a POST to `/api/v1/login` . Refer to https://docs.rocket.chat/api/rest-api/methods/authentication/login – Hellon Canella Machado Jun 22 '20 at 23:35
  • `X-Auth-Token` expires. So you will need to renew the credentials always it is necessary. – Hellon Canella Machado Jun 22 '20 at 23:37
  • Thanks, but this is not what I meant. I don't want to send credentials for login as every user. Please, take a look at the question, I updated the contents to illustrate better what I want. It looks like what I want to do is not possible -yet. – Nico Jones Jun 23 '20 at 10:55

0 Answers0