Created
July 26, 2016 07:54
-
-
Save hatimn02/7ed6684d937bf040d14b95a414074779 to your computer and use it in GitHub Desktop.
NodeJS sample code
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
//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