Last active
June 7, 2017 11:19
-
-
Save daikiojm/71f05cea345725ad5952d66899edfc10 to your computer and use it in GitHub Desktop.
slack-post
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use static'; | |
const request = require('request'); | |
let slack_endpoint = 'https://slack.com/api/chat.postMessage'; | |
let payload = { | |
form: { | |
token: '<slack_api_token>', | |
channel: '<slack_channel_name>', | |
username: '<post_user_name>', | |
text: '<message>' | |
} | |
} | |
request.post(slack_endpoint, payload, (error, response, body) => { | |
if (error) { | |
console.log(error); | |
} else { | |
console.log(body); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment