Open camuthig opened 4 years ago
The API docs are here: https://api.slack.com/methods/files.upload
No strong feelings about how this should be done, but looks like it will need a new top-level method we export publically in api.py
. What do you think? Will probably have to abstract out a bunch of config handling...
My initial thought was that it would need to be a new top-level method as well, but wasn't certain. For a first implementation, I think you could leave it up to the developer to create the content
of the upload, rather than use file
. I only did some basic testing, but using content worked well for me right out of the box with the default backend, at least.
Fields that would be fairly easy and could work with logic already present in the existing templates are:
initial_comment
(just text
of a message)token
can come from the existing settingschannels
could use the existing channel
with just a bit of tweakingOtherwise, the only new fields I think you need are
filename
filetype
title
Cool, thanks for your input - really useful. (Just to let you know though - I don't have the ability to prioritise this volunteer work right now around my other work and stuff.)
Not a problem. I have a working implementation on my side for specifically what I need. If I come across some time, I'll see if I can work through a PR for you as well.
If you could paste your code here that would be good, even without any other context or even if it's broken - will provide a good place to start. :+1:
I recently needed to implement a new feature where I uploaded a CSV file to Slack along with a the message I was sending. I was not able to implement this using django-slack natively, so had to access the
files.upload
Slack API directly instead. I haven't yet thought of a clean way to do it, but what are your thoughts on providing some sort of support for file uploads in this project?