2

I'm using slack api to upload media to a public channel, in-response I'm getting different urls for the uploaded media including 'permalink_pulic' which seems as the public URL, but that link doesn't work.Other Links are only accessible by slack team members.

Is there any way we can enable those public_link, so that media can be accessible outside slack.

2 Answers 2

5

In general Slack files are not public, but you can open public access to them if you want.

Call the method files.sharedPublicURL after you uploaded it to enable public access to a Slack file via its permalink_public URL.

See API documentation for more info.

1
  • 2
    Note that you have to call both upload and sharedPublicURL with the token parameter set to your App's User OAuth Token (found in App -> OAuth & Permissions -> OAuth Tokens for your Workspace). I didn't realize this initially and kept getting not_allowed_token_type.
    – V Maharajh
    Nov 20, 2021 at 0:25
2

To enable the public link, your app requires the file:write:user permission scope from the team, the team's access_token and the specific file_id you're trying to make public

Then send a request to Slack's files.sharedPublicURL(access_token, file_id) endpoint to receive a JSON object containing the file id.

You can use the new Slack Events API to have Slack send your app file information, including the file id, when events as file_created or file_shared occur. Here's a list of events Slack supports

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.