Skip to content

Instantly share code, notes, and snippets.

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 peterforgacs/454b38c1e16f135251fb043b59a60f75 to your computer and use it in GitHub Desktop.
Save peterforgacs/454b38c1e16f135251fb043b59a60f75 to your computer and use it in GitHub Desktop.
slack-post.js
var request = require('request')
var postData = {"channel": "#bot-test", "username": "webhookbot", "text": "This is posted to #bot-test and comes from a bot named webhookbot.", "icon_emoji": ":ghost:"};
var url = "";
var options = {
method: 'post',
body: postData, // Javascript object
json: true, // Use,If you are sending JSON data
url: url,
headers: {
// Specify headers, If any
}
}
request(options, function (err, res, body) {
if (err) {
console.log('Error :', err)
return
}
console.log(' Body :', body)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment