I’d like to know if anybody has built any recent automations between Zoom Webhooks and Lambda, and might have an example of how to update it to the new authorization requirements for 2023. I have gone through the documentation, but still cannot manage to verify the endpoint URL from Zoom. My lambda function looks like what is below, any help is appreciated.
exports.handler = async (req) => {
console.log(`endpoint hit at ${new Date().toDateString()}, see below:`);
console.log(req);
//validation
if (req.event == "endpoint.url_validation") {
console.log(`validation hit ${req}`);
const hashForValidate = crypto.createHmac('sha256', process.env.ZOOM_SECRET_TOKEN).update(req.payload.plainToken).digest('hex');
let response = {
statusCode: 200,
body: ({
"plainToken": req.payload.plainToken,
"encryptedToken": hashForValidate
})
};
console.log(`response below...`)
console.log(response);
return response;
//alert
} else if (req.event == "zoomroom.alert") {
let sendDoc = `${req.payload.object.room_name} reports: ${req.payload.object.issue}`;
await sendSlackMessage(process.env.SLACK_WEBHOOK_URL, sendDoc);
//generate reponse
let response = {
statusCode: 200,
// body: JSON.stringify('This is my Zoom Webhook API endpoint')
body: req
};
}
//generate reponse
let response = {
statusCode: 200,
// body: JSON.stringify('This is my Zoom Webhook API endpoint')
body: req
};
};
return response;
}
Hi @Patrick,
Thanks for reaching out to the Zoom Developer Forum!
I am happy to help here!
By looking at your code snippet, I am wondering if you are probably missing one step before validating your endpoint.
If you look into our Docs, to verify Webhook events the first step is receiving the event, followed by the second step which is constructing a message with the webhook request header x-zm-request-timestamp value from the payload you received.