Last active
January 26, 2016 19:55
-
-
Save dtolb/cf5abc03730b832943e7 to your computer and use it in GitHub Desktop.
Callback Handler
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
module.exports.event = function (req, res, next) { | |
var hasBody = (typeof req.body !== 'undefined' && req.body !== null); | |
res.sendStatus(201); //Immediately respond to request | |
if (hasBody) { | |
var hasEvent = (typeof req.body.eventType !== 'undefined'); | |
if (hasEvent) { | |
if (req.body.eventType === 'sms') { | |
logger.debug('Starting broadcast event'); | |
bandcast.handleMessage({ | |
fromNumber: req.body.from, | |
text: req.body.text | |
}) | |
.catch(function (error) { | |
logger.error(error); | |
}); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment