Node-slack-sdk: Issue with files.upload

Created on 19 Sep 2019  路  3Comments  路  Source: slackapi/node-slack-sdk

I'm trying to upload a file through the SDK but having issues. Currently I'm getting a success with the code below:

    const res = await client.files.upload({
      channel: 'CHANNEL',
      file: Buffer.from('hello'),
      filename: 'test.txt',
      filetype: 'text/plain',
    });

The response looks something like:

{ ok: true,
  file:
   { id: 'FIDTM4IDM',
     created: 1568847491,
     timestamp: 1568847491,
     name: 'test.txt',
     title: 'test',
     mimetype: 'text/plain',
     filetype: 'text',
     pretty_type: 'Plain Text',
     ...
     ...
  }
}

However nothing is showing up in the channel when I check. I know things are configured correctly because I can post messages to the channel.

https://slack.dev/node-slack-sdk/web-api#upload-a-file

web-api question

Most helpful comment

Hey there @captDaylight , use 'channels' instead of 'channel'

All 3 comments

Hey there @captDaylight , use 'channels' instead of 'channel'

It seems like @smashah's suggestion solved this issue. Okay to close?

Allow me to close this issue but please feel free to reopen or write in if you have anything further to mention here.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

amkoehler picture amkoehler  路  13Comments

aoberoi picture aoberoi  路  11Comments

CoreyCole picture CoreyCole  路  12Comments

aoberoi picture aoberoi  路  10Comments

jayjanssen picture jayjanssen  路  13Comments