# Updating Webhooks \> Lambda integration to support new authorization structure

**URL:** <https://devforum.zoom.us/t/updating-webhooks-lambda-integration-to-support-new-authorization-structure/80190>\
**Category:** API and Webhooks\
**Created:** [December 13, 2022, 1:23am UTC](https://devforum.zoom.us/t/updating-webhooks-lambda-integration-to-support-new-authorization-structure/80190 "2022-12-13T01:23:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![patrickgi](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/patrickgi/32/35452_2.png) [@patrickgi](https://devforum.zoom.us/u/patrickgi)\
**Post date:** [December 13, 2022, 1:23am UTC](https://devforum.zoom.us/t/updating-webhooks-lambda-integration-to-support-new-authorization-structure/80190/1 "2022-12-13T01:23:17Z")

</div>

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.

```auto
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;
}

```

---

<div class="post-metadata">

**Author:** ![elisa.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/elisa.zoom/32/47836_2.png) [@elisa.zoom](https://devforum.zoom.us/u/elisa.zoom)\
**Post date:** [December 16, 2022, 5:04pm UTC](https://devforum.zoom.us/t/updating-webhooks-lambda-integration-to-support-new-authorization-structure/80190/2 "2022-12-16T17:04:38Z")

</div>

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](https://marketplace.zoom.us/docs/api-reference/webhook-reference/#2-construct-the-message) with the webhook request header `x-zm-request-timestamp` value from the payload you received.

[https://marketplace.zoom.us/docs/api-reference/webhook-reference/#using-webhooks--omit-in-toc-](https://marketplace.zoom.us/docs/api-reference/webhook-reference/#using-webhooks--omit-in-toc-)

This message will be passed in your variable hashForValidate.

Here is a code snippet from our Docs that might be helpful for you:

```auto
const message = `v0:${request.headers['x-zm-request-timestamp']}:${JSON.stringify(request.body)}`

const hashForVerify = crypto.createHmac('sha256', ZOOM_WEBHOOK_SECRET_TOKEN).update(message).digest('hex')

const signature = `v0=${hashForVerify}`

if (request.headers['x-zm-signature'] === signature) {
  // Webhook request came from Zoom
} else {
  // Webhook request did not come from Zoom
}

```

We also have a sample app available :

> <https://github.com/zoom/webhook-sample-node.js/blob/master/index.js#L31>

Let me know if this helps and we can keep looking into this.  
Best,  
Elisa

---

<div class="post-metadata">

**Author:** ![patrickgi](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/patrickgi/32/35452_2.png) [@patrickgi](https://devforum.zoom.us/u/patrickgi)\
**Post date:** [December 16, 2022, 5:26pm UTC](https://devforum.zoom.us/t/updating-webhooks-lambda-integration-to-support-new-authorization-structure/80190/3 "2022-12-16T17:26:42Z")

</div>

Thank you, Elisa. I got this authentication flow figured out.

---

<div class="post-metadata">

**Author:** ![elisa.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/elisa.zoom/32/47836_2.png) [@elisa.zoom](https://devforum.zoom.us/u/elisa.zoom)\
**Post date:** [December 16, 2022, 5:27pm UTC](https://devforum.zoom.us/t/updating-webhooks-lambda-integration-to-support-new-authorization-structure/80190/4 "2022-12-16T17:27:11Z")

</div>

Amazing!! @patrickgi  
Please feel free to reach out back again if you need anything from us!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [December 20, 2023, 9:04am UTC](https://devforum.zoom.us/t/updating-webhooks-lambda-integration-to-support-new-authorization-structure/80190/5 "2023-12-20T09:04:13Z")

</div>

Closed on December 20, 2023, 9:04am UTC

This topic was automatically closed 368 days after the last reply. New replies are no longer allowed.
