Your Friend Ken
Your Friend Ken

Reputation: 8872

Slack API file uploads: permissions and ownership

I am using the Slack API to upload files. https://api.slack.com/methods/files.upload

If you include a channel when you upload a file to it becomes accessible to everyone in that channel, otherwise it is only available to the person who created the API key. Also, when a file is posted to a channel it displays as the user who created the API key.

Questions

  1. Is a way to share with everyone on a team without posting the file in a public channel?
  2. Is there a way to upload a file as another user or as a bot?

I tried files.sharedPublicURL, but these links allow anyone to view files. I want to make file accessible only to a slack team.

There is an option when on the channel info pane when you click "View all file in #channel" to "Include files from integrations & bots". This seems to indicate that it is possible to upload files as a bot.

Include files from integrations & bots

Upvotes: 0

Views: 1076

Answers (1)

Erik Kalkoken
Erik Kalkoken

Reputation: 32698

  1. Sure, by choosing in which channels you share the file, you can control who can see it. That also works with private channels.

  2. No, a file must always belong to a user, a bot would not be sufficient. Also the file is always owned by the user linked to the access token used. If you want to rather use a generic user, A workaround is to create a generic user fort you Slack that is only used for bot-related tasks. (Mine is called slackadmin)

Upvotes: 2

Related Questions