Skip to content

Instantly share code, notes, and snippets.

@daikiojm
Last active June 7, 2017 11:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daikiojm/71f05cea345725ad5952d66899edfc10 to your computer and use it in GitHub Desktop.
Save daikiojm/71f05cea345725ad5952d66899edfc10 to your computer and use it in GitHub Desktop.
slack-post
'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