# Webhook endpoint url is not validating it is throwing error

**URL:** <https://devforum.zoom.us/t/webhook-endpoint-url-is-not-validating-it-is-throwing-error/93882>\
**Category:** API and Webhooks\
**Tags:** webhooks, api\
**Created:** [August 24, 2023, 5:26am UTC](https://devforum.zoom.us/t/webhook-endpoint-url-is-not-validating-it-is-throwing-error/93882 "2023-08-24T05:26:58Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![marc.moreno](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/marc.moreno/32/34100_2.png) [@marc.moreno](https://devforum.zoom.us/u/marc.moreno)\
**Post date:** [August 24, 2023, 5:26am UTC](https://devforum.zoom.us/t/webhook-endpoint-url-is-not-validating-it-is-throwing-error/93882/1 "2023-08-24T05:26:58Z")

</div>

When we are validating the webhook endpoint in PHP it throws the error, the **return type is invalid** but we are returning the correct JSON object as per the endpoint validation documentation.

We are using below PHP code to validate the webhook endpoint URL:-

$body = file\_get\_contents(‘php://input’);  
$params = json\_decode($body, true);  
$plainToken = $params[‘payload’][‘plainToken’];  
$secretToken = “SECRET\_TOKEN”;  
$message = $plainToken;  
$secretTokenByte = utf8\_encode($secretToken);  
$messageBytes = utf8\_encode($message);  
$hashmessage = hash\_hmac(“sha256”, $messageBytes, $secretTokenByte, true);  
$hexMessage = implode(“”, array\_map(function ($x) {  
return sprintf(“%02x”, $x);  
}, unpack(“C\*”, $hashmessage)));  
$response = [  
“plainToken” =\> $plainToken,  
“encryptedToken” =\> $hexMessage  
];  
return json\_encode($response);

---

<div class="post-metadata">

**Author:** ![marc.moreno](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/marc.moreno/32/34100_2.png) [@marc.moreno](https://devforum.zoom.us/u/marc.moreno)\
**Post date:** [September 6, 2023, 1:02pm UTC](https://devforum.zoom.us/t/webhook-endpoint-url-is-not-validating-it-is-throwing-error/93882/2 "2023-09-06T13:02:02Z")

</div>

Please help us regarding the above issue.

Also, we have checked the code multiple times as per the webhook validation documentation

---

<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:** [September 8, 2023, 3:09pm UTC](https://devforum.zoom.us/t/webhook-endpoint-url-is-not-validating-it-is-throwing-error/93882/3 "2023-09-08T15:09:29Z")

</div>

Hi @marc.moreno  
Thanks for reaching out to us  
Have you taken a look at our sample app here:

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

It looks like you are probably missing the validating the signature step

---

<div class="post-metadata">

**Author:** ![marc.moreno](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/marc.moreno/32/34100_2.png) [@marc.moreno](https://devforum.zoom.us/u/marc.moreno)\
**Post date:** [September 14, 2023, 2:09am UTC](https://devforum.zoom.us/t/webhook-endpoint-url-is-not-validating-it-is-throwing-error/93882/4 "2023-09-14T02:09:35Z")

</div>

Hi Elisa,

Thank you. as per my developer “=\> We have validated the signature as Zoom support suggested, But we are getting the same error when validating the webhook, So kindly ask to Zoom support team why we are getting the “Invalid return type” error” could you please advise? Thank you!

---

<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:** [September 14, 2023, 2:08pm UTC](https://devforum.zoom.us/t/webhook-endpoint-url-is-not-validating-it-is-throwing-error/93882/5 "2023-09-14T14:08:16Z")

</div>

Thanks @marc.moreno  
Can you ask your developer to look at the sample app I shared and run it locally and try to replicate the code on php

---

<div class="post-metadata">

**Author:** ![marc.moreno](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/marc.moreno/32/34100_2.png) [@marc.moreno](https://devforum.zoom.us/u/marc.moreno)\
**Post date:** [September 15, 2023, 4:51am UTC](https://devforum.zoom.us/t/webhook-endpoint-url-is-not-validating-it-is-throwing-error/93882/6 "2023-09-15T04:51:35Z")

</div>

Thank you so much. I will tell them that.

---

<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:** [September 22, 2023, 5:58pm UTC](https://devforum.zoom.us/t/webhook-endpoint-url-is-not-validating-it-is-throwing-error/93882/7 "2023-09-22T17:58:19Z")

</div>

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