Get list of channels a user is a member of

Matt Burland picture Matt Burland · Dec 11, 2017 · Viewed 13.9k times · Source

Writing a slack bot and I would like to be able to get a list of all the channels my bot is a member of. One way to do this is to call https://slack.com/api/channels.list, get a (potentially large) list of all channels and then search for the channels that the current (bot) user is a member of. This works fine, but seems very heavy handed.

Is there a better way? To get just the channels that a given user is a member of?

Answer

Nico Durstewitz picture Nico Durstewitz · May 3, 2018

I think users.conversations is what you're looking for. Without additional params it will return all public channels the calling user is a member of.