gislack is a CLI tool to submit files to both Gist and Slack.
Please check it out. https://github.com/tanaikech/gislack
Gist
This sample script is for uploading image files to Slack using Incoming Webhooks by Google Apps Script.
When users try to upload image files to Slack using Incoming Webhooks, it has been known that although the access token is required to directly upload them, Incoming Webhooks can upload them by using the tag of image_url. In this sample script, it uploads image files (BMP, GIF, JPEG and PNG) on Google Drive to Slack using Incoming Webhooks. The script is written by Google Apps Script.
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.
gislack is a CLI tool to submit files to both Gist and Slack.
- v1.0.1 (June 30, 2017)
- Some modifications related to error handling.
Please check it out. https://github.com/tanaikech/gislack
Overview
This is a plugin of Sublime Text 3 for submitting files to both Gist and Slack.
Description
I like to use Sublime Text for developing scripts. And when I discuss about developing scripts, I often use Slack. When I submitted a script to Slack, I had saved the script to Gist as a backup. I had done manually this on my browser. Namely, I wanted to be saving the revision of script while I’m discussing about the script at Slack. One day, I wished this process had been able to be automatically run. So I created this plugin and gislack of a CLI tool.
Overview
This is a CLI tool to submit files to both Gist and Slack.
Description
When I discuss about developing scripts, I often use Slack. When I submitted a script to Slack, I had saved the script to Gist as a backup. I had done manually this on my browser. Namely, I wanted to be saving the revision of script while I’m discussing about the script at Slack. Recently, I wished this process had been able to be automatically run. So I created this tool.
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.log(res)
}