code: function fetchData(token) {
      sdk.feed.startpage(token).then(function(stream) {
          return stream.messages.map(function(message) {
              return message.attachments.filter(function(attachment) {
                  return attachment.type === 'IMAGE';
              });
          });
      }).then(function(imageAttachmentArrays) {
          return imageAttachmentArrays.reduce(function(prev, cur) {
              return prev.concat(cur);
          }, []);
      }).then(function(imageAttachments) {
          imageAttachments.forEach(function(attachment) {
              var file_name = attachment.url.split('/').reverse()[0];
              request('https://' + sdk.config.domain + attachment.url)
                  .pipe(fs.createWriteStream(file_name))
                  .on('finish', function() {
                      console.log('saved attachment ' + file_name);
                  });
          });
      }).catch(function(err) {
          console.log('Error:', err);
      });
  }
docs: /*
  Fetches the start page feed, filters out all image attachments and stores
  them in the current working directory.