# JS to listen to a webhook

**URL:** <https://community.glideapps.com/t/js-to-listen-to-a-webhook/31314>\
**Category:** Ask for Help\
**Tags:** custom-code\
**Created:** [September 3, 2021, 11:30am UTC](https://community.glideapps.com/t/js-to-listen-to-a-webhook/31314 "2021-09-03T11:30:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark\_Turrell](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mark_turrell/32/26605_2.png) [@Mark\_Turrell](https://community.glideapps.com/u/Mark_Turrell)\
**Post date:** [September 3, 2021, 11:30am UTC](https://community.glideapps.com/t/js-to-listen-to-a-webhook/31314/1 "2021-09-03T11:30:58Z")

</div>

It occurs to me that this might be not overly hard. An XC that picks up a webhook. And returns a value. Feasible? Already been done?

---

<div class="post-metadata">

**Author:** ![gvalero](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/gvalero/32/1037_2.png) [@gvalero](https://community.glideapps.com/u/gvalero)\
**Post date:** [September 3, 2021, 12:02pm UTC](https://community.glideapps.com/t/js-to-listen-to-a-webhook/31314/2 "2021-09-03T12:02:11Z")

</div>

> [@Mark\_Turrell](#):
>
> An XC that picks up a webhook.

Hola Mark!

Do you mean a Yes-Code (YC)? … If so, I think so!.

Maybe a webhook or making an HTTP request to process its reply can be carried out:

```auto
const data = await fetch("YOUR_URL")
const json = await data.json();
return json.{Param1} + " / " + json.{Param2} + " / " + json.{Param3} 

```

Saludos

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [September 3, 2021, 11:09pm UTC](https://community.glideapps.com/t/js-to-listen-to-a-webhook/31314/3 "2021-09-03T23:09:47Z")

</div>

Sorry if this is a wrong question to ask but does it trigger when data is passed to the webhook or are we sending calls every X seconds to the webhook to ask if it has new data? Is there a chance of new data being missed if we don’t call at the right time? Thank you 😄

---

<div class="post-metadata">

**Author:** ![gvalero](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/gvalero/32/1037_2.png) [@gvalero](https://community.glideapps.com/u/gvalero)\
**Post date:** [September 4, 2021, 1:28am UTC](https://community.glideapps.com/t/js-to-listen-to-a-webhook/31314/4 "2021-09-04T01:28:19Z")

</div>

Hola Thinh

If I understood well your question 😆, I’d say the code showed above does:

1- makes an http request  
2- waits for its reply  
3- retrieves the entire JSON data  
4- returns your wished values

In theory, this should be done every time you run the code manually but if you create a way to fire it based on time (using Math and Now), you might have your data updated periodically.

Saludos
