Slack Upload : Error while trying to upload using Curl

眉间皱痕 提交于 2019-12-11 17:18:22

问题


I am trying to upload a local file using curl command which I got to know about from here but while trying to run the command, It is not working and throwing error:

{"ok":false,"error":"not_authed"}

Command I am running is:

curl -F file=testsend.txt -F channels=#channel -F token='token' -F filetype=post https://slack.com/api/files.upload

回答1:


According to the error message you got, the access token you are using does not seam to be valid. Please double-check that you are using a valid access token, should look something like this:

-F token='xoxo-123456789-123456789'

I am assuming you did not use 'token' as access token. That would obviously not work.

to get an access token you want to create a Slack app and install it to your workplace (see documentation here), or you can get a legacy token for test purposes.

Also make sure your access token has the needed permissions for uploading files, e.g. files:write:user



来源:https://stackoverflow.com/questions/46770153/slack-upload-error-while-trying-to-upload-using-curl

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