Search code examples
slackslack-api

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?


Solution

  • 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.