Blake Frederick
Blake Frederick

Reputation: 1670

How to use Slack's API to return direct conversations between other users?

I am trying to clear out all Slack message history using Slack's API. I am using the im.list method https://api.slack.com/methods/im.list, which only appears to list direct conversations between my logged in user and other users. I would like to return (or just delete) messages between other users. I know it may be a privacy risk to allow an admin to access these messages, but surely there must be a way to delete them somehow?

Upvotes: 1

Views: 222

Answers (2)

Blake Frederick
Blake Frederick

Reputation: 1670

Here's a solution that worked for my particular use case:

  1. Ask the owner of the Slack team account to make you an owner
  2. Upgrade the Slack team to a paid plan (which was free because of a sign up credit)
  3. Change the file and message retention policy to 1 day
  4. Wait 24 hours - make tea, eat biscuits, etc.
  5. All your previous messages and files should now be deleted, so go ahead and modify the retention policy to your preference
  6. Downgrade the Slack team account to an unpaid membership

*This (imperfect and tedious) method will incur costs unless you have a Slack credit like we did.

Upvotes: 1

Erik Kalkoken
Erik Kalkoken

Reputation: 32852

Due to Slack's security architecture your Slack App can only see conversations, which either the installing user or the apps bot user is a member off. That includes IMs between other people. And it does not matter if your user is admin or owner.

Thers is one solution though: get user tokens of all you Slack members and use them to get access to those other IMs and private conversations.

This is possible by letting each user install your Slack app (which creates additional "configurations" of your Slack app) and thereby collecting all the user tokens.

Upvotes: 1

Related Questions