Skip to content

Instantly share code, notes, and snippets.

@streetsmartdev
Created August 27, 2017 06:59
Show Gist options
  • Save streetsmartdev/93d489c411842d10cd68e67af5b39b76 to your computer and use it in GitHub Desktop.
Save streetsmartdev/93d489c411842d10cd68e67af5b39b76 to your computer and use it in GitHub Desktop.
CB-SVRLESS-2 - Initial code to verify FB request
module.exports.fbVerify = (event, context, callback) => {
if (event.query['hub.mode'] === 'subscribe' &&
event.query['hub.verify_token'] === 'sometoken') {
console.log("Validating webhook");
return callback(null, parseInt(event.query['hub.challenge']));
} else {
console.error("Failed validation. Make sure the validation tokens match.");
return callback('Invalid token');
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment