Created
January 19, 2017 17:58
-
-
Save voipnorm/5649668799cff0c791037fc66c53bcac to your computer and use it in GitHub Desktop.
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
var request = require('request'); | |
var logger = require('log4js'); | |
logger.configure({ | |
appenders: [ | |
{type:'console'}, | |
{type: 'file', filename: 'logs/application.log', catergory:'application'} | |
], | |
replaceConsole: true | |
}); | |
exports.newMessage = function sparkMessage(sparkToken, text, to) { | |
request({ | |
url: 'https://api.ciscospark.com/v1/messages', | |
method: 'POST', | |
headers: { | |
'Content-Type': 'application/json', | |
'Authorization': 'Bearer ' + sparkToken | |
}, | |
body: | |
JSON.stringify({'toPersonEmail': to, | |
'markdown': text}) | |
}, 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