Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
456 views
in Technique[技术] by (71.8m points)

python - Get a list of all private channels with Slack API

I've been trying to get a list of all "groups" in my Slack team. However, even with admin privs, groups.list only provides the groups that the token owner's account belongs to.

The closest solution I've seen in my research involves getting a bot to sit in the channel. The bot's membership allows it to report on the channel, but then there's the logistical problem of getting the bot into every private channel, despite the fact that we can't list them programmatically.

The code I've used to dig up private channel listings:

import requests
import json

token = '...'

r = requests.post('https://slack.com/api/groups.list', data={'token': token, 'exclude_archived': 1})
if r.ok:
  privatechannels = { c['id']: c['name'] for c in json.loads(r.text)['groups'] }
  print(privatechannels)
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

slacks privacy policy does not support this.

The most fundamental privacy principle we follow is that by default, anything you post to Slack is private to your team. That is, viewing the messages and files shared within a specific team requires authentication as a member of that team.

The company's upcoming paid Plus plan will include an optional feature called Compliance Exports, which will let administrators access their team's communications, encompassing public and private messages.

which is the closest thing to getting access to private channels from which you are not part of, but will require a written letter...here for more details


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...