0
votes

I have integrated slack in my custom application using the API provided by Slack.

I am able to fetch the post from Slack and able to display it in my application. I am able to fetch the image that was uploaded with the post (Few days back) but today when I added a post with the image. The image is not being displayed in the application, when I am trying to access the image URL in the browser it is asking for Authentication.

I am accessing the slack rest API to fetch the post from slack. from the response I am taking the "thumb_64" parameter from the "file" object.

I am able to access the below image URL, this image was uploaded on 2016-01-11

https://files.slack.com/files-tmb/T0F8RH7U7-F0J505EG1-33434fadf3/screenshot_from_2015-12-28_15_23_39_160.png

But I am not able to access the below mentioned URL ,this image is uploaded on 2016-02-16

https://files.slack.com/files-tmb/T0F8RH7U7-F0MHZL70Q-d740ed784b/configration_160.png

Thanks & Regards,

1

1 Answers

0
votes

Have you seen the update where @slackapi announced about accessing files using the Web API?

Essentially, you now need to provide authentication to access file assets, by specifying an HTTP Authorization header with an OAuth token that has the correct scopes to access that kind of data for a team.

For example, you'd send a header like this with your GET request:

GET https://files.slack.com/files-tmb/T0F8RH7U7-F0MHZL70Q-d740ed784b/configration_160.png
Authorization: Bearer YOUR_VALID_ACCESS_TOKEN_HERE

The File type documentation goes into further detail.