Event notification endpoint URL validation fails

Hi,
I am trying to create a webhook in my zoom app, I have created API using AWS API Gateway which executes AWS Lambda function (Node.Js) to validate. I have added code from the documentation as below:

const { body } = event;
if(body.event === ‘endpoint.url_validation’) {

  const hashForValidate = CryptoJS.createHmac('sha256', 'xxxxxxx').update(body.payload.plainToken).digest('hex')

   const response = {
    statusCode: 200,
    body: JSON.stringify({
      plainToken: body.payload.plainToken,
      encryptedToken: hashForValidate
    }),
   };
 return response;

}

But every-time when trying to validate it showing as

App type: Zoom App

@reyaz.ahmed Hope you will be fine

Here is the session → How to enable Zoom WebHooks

Hi @freelancer.nak , Thank you for your quick response, I am following the same code as in the docs/ your video session , you can check my code above in the query as well, I am using lambda function instead of node server, so my post request will come in event parameter, and rest is same as node, but not sure why the validation always failing.

@reyaz.ahmed You need to verify that is there any preflight requests or 302 redirects to with initial request.

Hi @freelancer.nak , I tried with adding headers

headers: {
‘Access-Control-Allow-Origin’: ‘*’,
},
but no luck.

@reyaz.ahmed

Please test first that POST request with Postman & verify that on that POST request are there any 302 redirects happening in the Postman console.