How to invite all users to a channel?

Hi, how do you invite all users to a channel? @all doesn’t seem to work.

Thanks,
SW

2 Likes

I would like to know also, someone has a solution?

Use command from chat console /invite-all-to <…> or /invite-all-from <…>

1 Like

/invite-all-to is to invite other users for other channel
/invite-all-from is to invite other users for your channel

1 Like

If you want to add “all” users to a single channel, there’s multiple ways:

Short & easy:
If you happen to have a “general” chat, that normally everyone is added to when they enter you can use the command @jeffpaul au suggested to invite everyone from that channel to the one where you want everyone to be as well.

Long-ish
You need a terminal (any OS) to get your user ID, an auth-token and probably your account needs to be admin to the server you’re trying to work on (not tested as non-admin).

User-ID & Auth-Token
enter the following into your terminal to get your ID + AuthToken
replace server address, email & password with the actual information for your rocket.chat + your user account

curl https://your.server.address/api/v1/login
-d “user=your@email.org&password=yourpasswordhere

The output should read something like
“{“status”:“success”,“data”:{“userId”:(…)”
here you can find and copy (strg+shift+c from terminal instead of strg+c) your
userId
and
auth-Token

Copy those two and save them somewhere.
If you run linux, run
sudo apt install jq
to get the application to show the following output in a better way
if you don’t use linux I’m not sure what this is called on Mac/Windows, ask google? it works without but the information is harder to read/find

Now run the following command with the newly obtained details:

curl -H “X-Auth-Token: yourauthTokenoutputhere
-H “X-User-Id: youruserIdhere
https://your.server.address/api/v1/rooms.get | jq

This will show you all public channels on your server with details attached you can’t see in the UI.
Use strg+shift+f to search for the name of the channel you want to add everyone to
Above the name there’ll be a line that’s called
“_id”:

this is the channel-ID
copy (again strg+shift+c) the ID somewhere safe

If you have multiple channels you want to add everyone to I suggest to open a second terminal and repeat the following command once for every channel with the channel-ID as a parameter. As before also add the authToken, userId and your server address + the channel-ID

curl -H “X-Auth-Token: yourauthTokenoutputhere
-H “X-User-Id: youruserIdhere
-H “Content-type: application/json”
https://your.server.address/api/v1/channels.addAll
-d ‘{ “roomId”: “channelID” }’

Before you repeat, check the channel by using the UI to see if everyone was successfully added.

Apparently all this can be found on the rocket.chat website but I couldn’t piece it together there by myself (no IT background whatsoever) so I thought I’d share.

1 Like

hi @Aljoscha that’s very good, thanks for sharing!