Unable to Validate webhook endpoint URL

Trying to setup an endpoint for a webhook, and the url we setup has failed to validate, with message URL validation failed. Try again later. The endpoint works just fine on Postman. We’ve setup localy a ngrok link and it validated just fine.

We looked into the server configurations and did not find anything that could be causing this issue, so coming here to ask how to better troubleshoot and find a solution to this issue.

@Filadelfia what language are you using on the webhook server side? It might sometimes be an .env issue where the secret is not loaded correctly.

We use javascript, it can not be an issue with the .env, we have other zoom api calls working just fine, we are only having issues validating the webhook endpoint.

@Filadelfia I run this on my server side.

// Define a function to handle webhook requests
function handleWebhookRequest(req, res, secretToken, path) {

if (req.method === ‘POST’) {
// Check if the event type is “endpoint.url_validation”
if (req.body.event === ‘endpoint.url_validation’) {
const hashForValidate = crypto.createHmac(‘sha256’, secretToken)
.update(req.body.payload.plainToken)
.digest(‘hex’);

res.status(200).json({
  "plainToken": req.body.payload.plainToken,
  "encryptedToken": hashForValidate
});

} else {

res.status(200).send();

}
}else if (req.method === ‘GET’) {

} else {
// Handle unsupported HTTP methods
res.status(405).send(“Method Not Allowed”);
}

}