I've been fighting slack's files.upload API. Even if I insist the file should be any kind of format that isn't plain text, example:
request.post({
url: 'https://slack.com/api/files.upload',
formData: {
token: bot.config.token,
channels: message.channel,
file: fs.createReadStream(realLocalPath),
filetype: 'zip',
mode: 'hosted'
},
}, function (err, response) {
console.log(JSON.parse(response.body));
});
It seems to insist on making it plaintext with preview:
mimetype: 'text/plain',
filetype: 'text',
pretty_type: 'Plain Text',
...
mode: 'snippet'
That's from the API response's file property. Does anyone know how I can override this?
I want my file to be a downloadable one. No snippet, no preview, just a downloadable file.