# Glide webhook trigger doPost in google app script multiple times

**URL:** <https://community.glideapps.com/t/glide-webhook-trigger-dopost-in-google-app-script-multiple-times/61936>\
**Category:** Ask for Help\
**Created:** [May 20, 2023, 8:38am UTC](https://community.glideapps.com/t/glide-webhook-trigger-dopost-in-google-app-script-multiple-times/61936 "2023-05-20T08:38:09Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Muhammed\_Emir](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/muhammed_emir/32/44830_2.png) [@Muhammed\_Emir](https://community.glideapps.com/u/Muhammed_Emir)\
**Post date:** [May 20, 2023, 8:38am UTC](https://community.glideapps.com/t/glide-webhook-trigger-dopost-in-google-app-script-multiple-times/61936/1 "2023-05-20T08:38:09Z")

</div>

Hello Guys,

Yesterday I was trying to make glide triggers doPost webApp in google sheet script. it worked just fine but it got called multiple times, and after some research i found this

> [@globe\_with\_meridians Please help us test: API Column and Webhook action](https://community.glideapps.com/t/please-help-us-test-api-column-and-webhook-action/19920/3):
>
> Updated: The Glide API This is a quick reference on how to implement a Glide API endpoint. API endpoints are used for the API column and the webhook action. Implementing your endpoint The endpoint must be HTTPS and support the POST method. Glide will send a JSON request body. The format of the body differs between the API column and the Webhook action. The API column For the API column, the request body will contain the following fields: hookKind is the string api-column. appID is the call…

mentioning the

> ## Webhook action
> 
> - `hookKind` is the string `app-action`.
> - `appID` is the calling app’s ID.
> - `idempotencyKey` is a unique string identifying the webhook request. Webhooks will be retried if they fail, but it is possible that webhooks will be called with the same invocation more than once in very rare circumstances. You may use the `idempotencyKey` to ensure you only service the request exactly once.
> - `timestamp` is the approximate date/time when the action was triggered.
> - `params` is an object containing one field per argument passed to the API column. Its format is described below.
> 
> Glide will try a webhook endpoint up to five times to improve delivery reliability. The response body is ignored, but HTTP status codes are respected. HTTP 2xx is treated as a success, HTTP 3xx is respected and followed, and all other statuses, including socket connection failures, are treated as failures and are eligible for retrying.
> 
> Retries occur on an exponential backoff schedule, but attempt timing is not precise. You may expect retries to follow this schedule with up to two additional minutes of delay:
> 
> | Failed attempts | Retry after |
> | --- | --- |
> | 1 | 2 minutes |
> | 2 | 4 minutes |
> | 3 | 8 minutes |
> | 4 | 16 minutes |
> | 5 | never |

I couldnt get it to stop retrying even though I tried the following in google app script

```auto
  return ContentService.createTextOutput(JSON.stringify({ 'status': 'success' }))
        .setMimeType(ContentService.MimeType.JSON);

```

after several tries I used idempotencyKey to prevent duplicate handling of the tries until it stops from glide side.

```auto
    var cache = CacheService.getScriptCache();
    // Check if this request has been processed before
    //this will solve glide triggering the API multitple times
    if (cache.get(data.idempotencyKey)) {
      // This request has been processed before, so we can ignore it
      return;
    }
    cache.put(data.idempotencyKey, 'processed', 21600);

```

I know this is a bad solution but I couldn’t get glide to stop retrying.

Any suggestions?

---

<div class="post-metadata">

**Author:** ![Eric\_Penn](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_penn/32/73888_2.png) [@Eric\_Penn](https://community.glideapps.com/u/Eric_Penn)\
**Post date:** [May 20, 2023, 9:55am UTC](https://community.glideapps.com/t/glide-webhook-trigger-dopost-in-google-app-script-multiple-times/61936/2 "2023-05-20T09:55:08Z")

</div>

> [@Muhammed\_Emir](#):
>
> `timestamp` is the approximate date/time when the action was triggered.

What is your setup here for the timestamp?

---

<div class="post-metadata">

**Author:** ![Muhammed\_Emir](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/muhammed_emir/32/44830_2.png) [@Muhammed\_Emir](https://community.glideapps.com/u/Muhammed_Emir)\
**Post date:** [May 20, 2023, 9:59am UTC](https://community.glideapps.com/t/glide-webhook-trigger-dopost-in-google-app-script-multiple-times/61936/3 "2023-05-20T09:59:31Z")

</div>

I didnt understand the question  
as far as I know the timestamp is a field sent by glide in the request specifying when the trigger happened. how can I benefit from it in regard of duplicate requests. Duplicate requests are related to response status that should be 2xx that seems GAS is not sending

---

<div class="post-metadata">

**Author:** ![Eric\_Penn](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_penn/32/73888_2.png) [@Eric\_Penn](https://community.glideapps.com/u/Eric_Penn)\
**Post date:** [May 20, 2023, 10:00am UTC](https://community.glideapps.com/t/glide-webhook-trigger-dopost-in-google-app-script-multiple-times/61936/4 "2023-05-20T10:00:09Z")

</div>

The glide current date time refreshes every 10 seconds. You gotta set it and then clear it

---

<div class="post-metadata">

**Author:** ![Muhammed\_Emir](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/muhammed_emir/32/44830_2.png) [@Muhammed\_Emir](https://community.glideapps.com/u/Muhammed_Emir)\
**Post date:** [May 20, 2023, 5:09pm UTC](https://community.glideapps.com/t/glide-webhook-trigger-dopost-in-google-app-script-multiple-times/61936/5 "2023-05-20T17:09:50Z")

</div>

Still dont get it. where should I set the timestamp?

---

<div class="post-metadata">

**Author:** ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)\
**Post date:** [May 20, 2023, 9:52pm UTC](https://community.glideapps.com/t/glide-webhook-trigger-dopost-in-google-app-script-multiple-times/61936/6 "2023-05-20T21:52:15Z")

</div>

You do not need to use Glide webhook for that… it is not reliable. It failed me many times. As Eric mentioned, you can control refreshing using a current date or other more specific methods.

---

<div class="post-metadata">

**Author:** ![Muhammed\_Emir](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/muhammed_emir/32/44830_2.png) [@Muhammed\_Emir](https://community.glideapps.com/u/Muhammed_Emir)\
**Post date:** [May 21, 2023, 10:45am UTC](https://community.glideapps.com/t/glide-webhook-trigger-dopost-in-google-app-script-multiple-times/61936/8 "2023-05-21T10:45:41Z")

</div>

My webhook isnt for refreshing. the webhook is calling a webApp created in google app script that handles complex logic in google sheets as mentioned in this question

> [@Creating Class Sessions in Glide: Incorporating Days of the Week and Holiday Considerations](https://community.glideapps.com/t/creating-class-sessions-in-glide-incorporating-days-of-the-week-and-holiday-considerations/61920/5):
>
> Yeah that’s true. You have to add separate rows, sequentially, and that’s not able to be natively done for now.

the problem is that the glide kept triggering the webhook as retries and I couldnt get it to stop so I had to do caching of the idempotencyKey walk around solution

---

<div class="post-metadata">

**Author:** ![Eric\_Penn](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_penn/32/73888_2.png) [@Eric\_Penn](https://community.glideapps.com/u/Eric_Penn)\
**Post date:** [May 21, 2023, 12:36pm UTC](https://community.glideapps.com/t/glide-webhook-trigger-dopost-in-google-app-script-multiple-times/61936/9 "2023-05-21T12:36:58Z")

</div>

We’re suggesting to build your own webhook. But if it’s working for you then I’d stick with that

---

<div class="post-metadata">

**Author:** ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)\
**Post date:** [May 21, 2023, 5:43pm UTC](https://community.glideapps.com/t/glide-webhook-trigger-dopost-in-google-app-script-multiple-times/61936/10 "2023-05-21T17:43:30Z")

</div>

I never said that your webhook is for refreshing… I said you can control refreshing of your webhook.
