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

谁说我不能喝 提交于 2020-01-11 11:32:14

问题


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'

The idea is to have the file uploaded to a slack channel by a pipeline and have someone else edit the file. I can't seem to find the flag to allow a file uploaded by this method to be available for edit by others


回答1:


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).



来源:https://stackoverflow.com/questions/54178886/how-to-allow-a-slack-post-uploaded-via-curl-to-be-editable-by-others

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!