Glide webhook trigger doPost in google app script multiple times

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

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

  return ContentService.createTextOutput(JSON.stringify({ 'status': 'success' }))

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

    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
    cache.put(data.idempotencyKey, 'processed', 21600);

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

Any suggestions?

What is your setup here for the timestamp?

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

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

1 Like

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

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.

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

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

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

1 Like

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