Search code examples
slack

Unable to successfully upload a file via Slack API


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.


Solution

  • You just need to invite the app that you created into the slack channel. Example:

    @AppBot