java-slack-sdk icon indicating copy to clipboard operation
java-slack-sdk copied to clipboard

Functionality to download attachment/file from messages using token

Open victormarcus opened this issue 6 years ago • 4 comments

Enhancement/Question

TODO: Functionality to download attachment/file in a message using the user token

Is there already any functionality to do this using the token we can download the file/attachment in a message?

victormarcus avatar May 13 '20 12:05 victormarcus

If your app's bot user has permission to access a file, your app can download file data by accessing url_private_download etc. with Authorization: Bearer xoxb-*** header.

This SDK doesn't provide a handy method for downloading data but you can do that with any HTTP clients. This SDK depends on okhttp. Using the library may be quick.

seratch avatar May 13 '20 12:05 seratch

I've added a code snippet demonstrating how to do that. Hope you find this helpful. https://github.com/slackapi/java-slack-sdk/commit/1712133988264cccc0c180c89d4cf2a76e0f30e7

seratch avatar May 13 '20 13:05 seratch

@kumbhaj Is the above information helpful for you? Let me know if you have anything further to ask here. Otherwise, could you close this issue now?

seratch avatar May 13 '20 22:05 seratch

Thank you. Yes, Please close it

victormarcus avatar May 14 '20 04:05 victormarcus