Created
August 27, 2017 06:59
-
-
Save streetsmartdev/93d489c411842d10cd68e67af5b39b76 to your computer and use it in GitHub Desktop.
CB-SVRLESS-2 - Initial code to verify FB request
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.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