SlackTips

Multipart-POST Request Using Node.js

Gists Here, I introduce 2 scripts for uploading files to Slack using Node.js as samples. These 2 sample scripts are for uploading files to Slack. Sample script 1: You can upload the zip file by converting byte array as follows. At first, it builds form-data. Adds the zip file converted to byte array and boundary using Buffer.concat(). This is used as body in request. Basically, this is almost the same to the method using GAS.

Changing Slack Status using Google Apps Script

This script changes slack status using GAS. If you want to change it on time you decided, it can be achieved by installing this method as a trigger. In order to use this, the required scope is users.profile:write. function setSlackStatus(token, user, status_text, status_emoji) { return UrlFetchApp.fetch( 'https://slack.com/api/users.profile.set', { method: 'post', payload: { token: token, user: user, profile: JSON.stringify({status_text: status_text, status_emoji: status_emoji}) }, muteHttpExceptions: true } ).getContentText(); } function main() { var res = setSlackStatus( '### Your access token ###', '### User ID ###', 'sample', ':coffee:' ); Logger.