Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get/enable public URL for media uploaded to slack using slack API

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.

like image 854
rakeshpatra Avatar asked Sep 15 '25 05:09

rakeshpatra


2 Answers

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.

like image 135
Erik Kalkoken Avatar answered Sep 17 '25 18:09

Erik Kalkoken


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

like image 43
Paul G Avatar answered Sep 17 '25 20:09

Paul G