title: Slack Bot not downloading files from direct message but is downloading when uploaded to a channel
body: <p>So I have written a code to download a file from a slack bot</p>
  
  <p>the code is </p>
  
  <pre><code>var https = require('https');
  var fs = require('fs');
  
  var pDownload= function (url, dest){
    var slug = url.split('.com').pop();
    console.log(slug);
    var options = {
    "method": "GET",
    "hostname": "files.slack.com",
    "path": slug,
    "rejectUnauthorized": "false",
    "headers": {
        "Authorization": "Bearer MYTOKEN"
      }
    }
    var file = fs.createWriteStream(dest);
    return new Promise((resolve, reject) =&gt; {
      var responseSent = false; // flag to make sure that response is sent only once.
  
      https.get(options, response =&gt; {
        response.pipe(file);
        file.on('finish', () =&gt;{
          file.close(() =&gt; {
            if(responseSent)  return;
            responseSent = true;
            resolve();
          });
        });
      }).on('error', err =&gt; {
          if(responseSent)  return;
          responseSent = true;
          reject(err);
      });
    });
  }
  
  module.exports.pDownload=pDownload;
  example
  pDownload('https://files.slack.com/files-pri/T7JRF8TCN-F7WDP24LV/analysis.r', './test/res.new')
     .then( ()=&gt; console.log('downloaded file no issues...'))
     .catch( e =&gt; console.error('error while downloading', e));
  </code></pre>
  
  <p>however, if a user talks to the bot on direct message, the file that is downloaded only contains <code>'https://files-origin.slack.com/files-pri/T7JRF8TCN-F7WDP24LV/analysis.r found'</code> and not the contents</p>
  
  <p>But if we are talking to the bot on a channel and upload a file, it correctly downloads the file and stores all the content to the file.</p>
  
  <p>Why is this issue caused? and why is it redirecting to files-origin.slack.com when i have set the scope to <code>files:read</code> and <code>files:write:user</code></p>
  
  <p>Can the bot download the file when sent a Direct Message?</p>