How to allow a slack post uploaded via curl to be editable by others

后端 未结 1 1851
深忆病人
深忆病人 2021-01-24 16:40

I am using this curl request to upload a file:

curl -s -F file=@%s -F channels=%s -F initial_comment=%s -F token=%s https://slack.com/api/files.upload\'

相关标签:
1条回答
  • 2021-01-24 16:50

    I did some research on files.upload and my result is that it is not possible to upload a file in a way that would make it editable by other users.

    If you upload a file as plain text (e.g. filetype = plain) the file becomes editable, but only by the user who uploaded the file, e.g the token owner. The API does not provide an option to make it editable by other users.

    If you upload a file as post (e.g. filetype = post) the owner of the file can later make that post editable by anyone, but only manually. Again, there is no option to do that by the API.

    The only solution to your issue I can think of is creating a Slack app that manages file uploads and editing. e.g. you could have a Dialog with a textarea element to edit the content of a file. Textarea elements can hold up to 3.000 chars.

    Note that for that app you probably want to store your files outside of Slack while it can be edited, because Slack does not allow you to edit a file after it has been uploaded. (At least not with the official API, there is the unofficial files.edit method, but this can only be used in special cases).

    0 讨论(0)
提交回复
热议问题