Skip to content

Instantly share code, notes, and snippets.

@ypcode
Last active Jan 5, 2020
Embed
What would you like to do?
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