CoffeeScript2でSlackの認証テスト
# https://ja.ojit.com/so/slack/3498196 SLACK_USER_TOKEN = 'xoxp-881518928711-868191264403-00x0dfd0v1766-10458077c--36681ce0599334ca5' SLACK_BOT_TOKEN = 'xoxb-881518928711-1609760895585-rfrigjirjirPECn47fgdfvf--ljIV' BASE_URL = 'https://slack.com/api/' headers = {'Authorization': "Bearer #{SLACK_BOT_TOKEN}"} request = require('request') postOptions = uri: BASE_URL + 'auth.test' method: 'POST' json: true headers: headers # DEBUG console.log BASE_URL + 'auth.test' request postOptions, (error, response, body) -> if error console.log 'OOPPPPS....we hit an error in auth.test: ' + error else console.log 'auth.test response: ' + JSON.stringify(response) return #res.send("Sent Test...check logs");
C:\Somewhere>.\node_modules\.bin\js2coffee auth-test.js > auth-test.coffee
C:\Somewhere>.\node_modules\.bin\coffee.cmd auth-test.coffee