I have a workflow that is triggered by a Jobber webhook on job_update. Unfortunately on update 2 requests happen virtually simultaneously: eg Tue 2024-07-23 09:59:09 and Tue 2024-07-23 09:59:05.
In retool is there a way to detect this so the second update isn't run or filtered?
Here is a sample of the webhook data:
data {"webHookEvent":{"topic":"JOB_UPDATE","appId":"xxx","accountId":"yyy","itemId":"zzz","occurredAt":"2024-07-23T16:37:48-05:00"}}
After getting a response from the Jobber developers it is normal sometimes an update will trigger the webhook more than once depending on what was updated.
So I need to check for duplicate entries. I created a table to check for entries with the same id and time (to the minute).
Where I am stuck now is how to get proper data results from a query and use it in the filter.
how to setup correctly the filter. I have a query getStoredEvents which searches if a unique_identifier exists. When I hardcode it, I get the correct results:
SELECT unique_identifier
FROM processed_events
WHERE unique_identifier = 'Z2lkOi8vSm9iYmVyL0pvYi80NTA0OTQ1Mg==_JOB_UPDATE_2024-07-23T14:50:00.000Z'
SELECT unique_identifier
FROM processed_events
WHERE unique_identifier = {{ storeEventIdentifier.data.uniqueIdentifier }};
under data I get nothing array (0) []
Looking into the query I have the correct expressions though:
rawExpression
SELECT unique_identifier FROM processed_events WHERE unique_identifier = {{ storeEventIdentifier.data.uniqueIdentifier }};
evaluatedExpression
SELECT unique_identifier FROM processed_events WHERE unique_identifier = Z2lkOi8vSm9iYmVyL0pvYi80NTA0OTQ1Mg==_JOB_UPDATE_2024-07-23T14:50:00.000Z;