More efficient way to add a user to the group


Is there a more efficient way to add a user to the group? let’s say I have 20 admin users and I want to create one more, after that I must add this user to all common user groups (so every common user is in a group with all admins). today to do this i make about 2k requests to add this admin user to groups and i don’t think it’s the best solution. Is there any feature that makes this easier?


Server Setup Information

  • Version of Rocket.Chat Server: 3.10.7


You can easily create a script that can do almost anything, from creating users, adding to channels, groups, teams, applying roles, configuring Rocket.Chat and what not using our Rest APIs.

My go to language is Python, so I would use this library (optional):

to consume those APIs and accomplish what you need:

Hi. Isn’t there a more efficient way? If I have to add a user to 2000 groups, then do I have to make 2000 requests?

Oh. Sorry!

I completely missed that your probably considered this approach and the 2k were literal :rofl:

Looks like we can probably do something. I just discovered an undocumented feature.

This is the code for the API

that will eventually use this code here:

Turns out the payload to that API could be something like

{ "roomId": "YcJbJEeRh3CmXrNav", "userIds": ["zyYbkJ4dy69et7uwC", "DHm5KWrYSZoQpRyyJ"] }

instead of

{ "roomId": "ByehQjC44FwMeiLbX", "userId": "nSYqWzZ4GsKTX4dyK" }

Let me know if this works, or what API are you using specifically.


I need the opposite :frowning: … an array of roomIds for a user.

I’m using REST API without a wrapper.
Version of Rocket.Chat Server: 3.10.7

I figured that.

But that’s the place to change it. We can open a feature request for that, so we can discover if we have more users that would benefit from this feature.