Created
July 24, 2016 20:04
-
-
Save peterforgacs/454b38c1e16f135251fb043b59a60f75 to your computer and use it in GitHub Desktop.
slack-post.js
This file contains hidden or 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
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