-
-
Save ypcode/6e79a259a6ee98ed2cae85a8e24793bc 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
module.exports = async function (context, req) { | |
context.log('Executing Webhook endpoint...'); | |
// Validate the subscription creation | |
if (req.query.validationToken) { | |
context.log('Validating new subscription...'); | |
context.log('Validation token:'); | |
context.log(req.query.validationToken); | |
context.res = { | |
headers: { | |
'Content-Type': 'text/plain' | |
}, | |
body: req.query.validationToken | |
}; | |
} | |
else { | |
context.log('Received new notification...'); | |
context.log('Notification: '); | |
context.log(JSON.stringify(req.body)); | |
context.res = { body: "" }; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment