Add all users to the channel

Hi
Add all users to the channel using wildcards, example @*?
How to do it? Is there such a possibility?

Hi @brrrr66 ,

unfortunately this is not possible at the moment. If you want to add all local users to a channel, you’d have to either use the API or a small script using the mmctl tool to do that.

Thanks!
I looked through mctl, but it also needs an enumeration, as far as I understood. Get a list and then add users.

Did so. I don’t know how it will be if there are > 50 users :slight_smile:

We open “direct messages” and copy all users right from there. The “@” shows All users.
Then we go into the channel and send a message with this list. We will be asked to add the missing ones to the channel.
Screenshot_2023-03-15_11-16-12_2

Yes, but you can script it and it’s basically just one command then to add all users into a new channel if you’ve prepared the script properly.
Clicking through all of them manually works too, of course, but as you said, the more users you have, the harder it gets doing it manually.

1 Like

Do you have an example of such a script on mmctl?

Assuming you only have one team named “test”:

# Create Channel "teamhuddle" in team "test"
# mmctl --local channel create --team test --name teamhuddle --display-name teamhuddle
New channel teamhuddle successfully created

# Add all active users to this channel
# mmctl --local channel users add test:teamhuddle $(mmctl --local user list --all --json 2>/dev/null | jq -r '.[] | select (.delete_at ==0) | .username' | xargs )
#
1 Like

Thanks!
All working! Really had to download the local version of mmctl, I the using docker “sudo docker run -it mattermost/mattermost-team-edition:latest /bin/sh” and there was no “jq” command in the container :slight_smile:
Also I removed the parameter "–local, I connect remotely.
Swore when adding on, as I understand it, system users. I think it’s not critical :slight_smile:

$ ~/bin/mmctl channel users add teamtest:test1 $(~/bin/mmctl user list --all --json 2>/dev/null | jq -r '.[] | select (.delete_at ==0) | .username' | xargs )
Unable to add 'appsbot' to test1. Error: : No team member found for that user ID and team ID., resource: TeamMember id: teamId=okcpj9czktrgmpkke9g41pa6fh, userId=dt7ntcjp3jff9brgtcxgqutoyo
Unable to add 'boards' to test1. Error: : No team member found for that user ID and team ID., resource: TeamMember id: teamId=okcpj9czktrgmpkke9g41pa6fh, userId=a9g8x3dd7bf1ukfb5xu96mpx3a
Unable to add 'calls' to test1. Error: : No team member found for that user ID and team ID., resource: TeamMember id: teamId=okcpj9czktrgmpkke9g41pa6fh, userId=3g9xc9krmbnefqqy566d3dxrne
Unable to add 'channel-recommender' to test1. Error: : No team member found for that user ID and team ID., resource: TeamMember id: teamId=okcpj9czktrgmpkke9g41pa6fh, userId=sx4osxcgqb8y7g8umk47haq18w
Unable to add 'channelexport' to test1. Error: : No team member found for that user ID and team ID., resource: TeamMember id: teamId=okcpj9czktrgmpkke9g41pa6fh, userId=fqebgodaztd3zx868s468cskdr
Unable to add 'feedbackbot' to test1. Error: : No team member found for that user ID and team ID., resource: TeamMember id: teamId=okcpj9czktrgmpkke9g41pa6fh, userId=x1f9fxmz8fyc7g1u1354w7tsxw
Unable to add 'playbooks' to test1. Error: : No team member found for that user ID and team ID., resource: TeamMember id: teamId=okcpj9czktrgmpkke9g41pa6fh, userId=awya86f197frjygtg99d6rxx8o
Unable to add 'system-bot' to test1. Error: : No team member found for that user ID and team ID., resource: TeamMember id: teamId=okcpj9czktrgmpkke9g41pa6fh, userId=zrktr1kdnbftin7mrh4m171h5h
Unable to add 'welcomebot' to test1. Error: : No team member found for that user ID and team ID., resource: TeamMember id: teamId=okcpj9czktrgmpkke9g41pa6fh, userId=78hdqiak8bdj5jm48unrprwrfw

Yes, the warnings for the bot accounts are OK, I did not ignore them in the command, but we could do that but anyways… it gets the job done and these few warnings can be ignored :slight_smile:

Geat, so thanks for the feedback, will mark this issue as resolved now.

1 Like