Reputation: 53
I'm unable to successfully upload a file even using Slacks file.upload
tester mechanism here: https://api.slack.com/methods/files.upload
I've applied a Slack app token, channel name, and chosen a file, but get the following result:
{
"ok": false,
"error": "missing_scope",
"needed": "files:write:user",
"provided": "identify,incoming-webhook"
}
I then created a new app, and ensured that files: write was in scope (it wasn't in the previous app). Now, I get a different error:
{
"ok": false,
"error": "not_in_channel"
}
As a test to confirm that the channel name was ok, I subsequently tried a nonexistent channel name, and the error indicated 'channel_not_found', so the channel name I used should be valid.
Upvotes: 5
Views: 3477
Reputation: 11
This solved my issue : https://stackoverflow.com/a/78933760/19252746
If you add the bot, have scopes etc. this would solve your problem. Slacks official doc is wrong i believe. This answer uses POST instead of PUT.
Upvotes: 0
Reputation: 331
You just need to invite the app that you created into the slack channel. Example:
@AppBot
Upvotes: 0
Reputation: 399
Before posting a message, reacting to any message or uploading files you need to open a conversation with the channel. You can also do it programmatically and achieve this with the help of API (https://api.slack.com/methods/conversations.open)
Upvotes: 1
Reputation: 51
I had the same issue and fixed it by adding the Slack app to the channel
I guess there are many ways to add it;
I just opened the corresponding channel I was trying to "files.upload" to, and clicked the "Add an app" link at the really top of the channel history:
Upvotes: 4