We’re developing a connector for our application and we want it to trigger when a value crosses a threshold. Our API just returns the current value as a number (and there’s not a way to call the API to ask “what was this value 5 minutes ago?”). If the zap could remember the previous value it saw, then our connector’s code could check if (previousValue < threshold && currentValue >= threshold)
and only trigger the one time it crosses the threshold.
Is this possible?
What we’re currently doing is essentially this:
return i{
id: value >= threshold ? "above" : "below"
}];
Zapier thinks it’s a new object when the ID changes, but once Zapier has seen both IDs (“above” and “below”) then it stops triggering. We can append the current date to the ID so it triggers once a day at least, but ideally we’d like to only trigger on transitions (i.e. crossing above or below the threshold).