Skip to content

Instantly share code, notes, and snippets.

@hatimn02
Created July 26, 2016 07:54
Show Gist options
  • Save hatimn02/7ed6684d937bf040d14b95a414074779 to your computer and use it in GitHub Desktop.
Save hatimn02/7ed6684d937bf040d14b95a414074779 to your computer and use it in GitHub Desktop.
NodeJS sample code
//Load the request module
var request = require('request');
//Lets configure and request
request({
url: 'http://flow.viasocket.com/trigger/sample_url/slack_integration', //Replace with your socket api
qs: {from: 'socket sample', time: +new Date()}, //Query string data
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Auth-Key': 'YourAuthKey' //Your Auth Key
},
body: '{"Hello":"World"}' //Set the body as a string
}, function(error, response, body){
if(error) {
console.log(error);
} else {
console.log(response.statusCode, body);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment