A list of all channels with all users in them

Hello.

Over the years, our colleagues have created many private channels where they communicate with specific people. Now my boss wants to know which channels are used by whom and which channels are unused and can be deleted. Since no one is in all groups, this probably has to be done through the CLI. Is there a simple and nice solution for this?
The output should look something like this:

  • Channel1
    User 1
    User 2
    User 3
  • Channel 2
    User 1
    User 5
    User 6
  • Channel 3
  • Channel 4

Regards
Thomas

Hello, @VincentVegas

I have this SQL query that I use to extract information of the users from each team and channel including their membership.

SELECT DISTINCT u.Username, t.DisplayName AS TeamName, c.DisplayName AS ChannelName, cm.SchemeUser AS User, cm.SchemeAdmin AS Admin FROM ChannelMembers AS cm JOIN Channels AS c ON (cm.ChannelId=c.Id) JOIN Users AS u ON (cm.UserId=u.Id) JOIN Teams AS t ON (c.TeamId=t.Id);

Will this be something that you can consider?

1 Like

Thanks, that works quite well.

Regards,
Thomas

1 Like

Hi, @VincentVegas

You are most welcome. Always happy to help.