Trigger cooldown


(Jack Kelly) #1

Matrix Version: v6.31.1
Hi, I have a trigger that I am using to send an email when a REST Resource Asset returns a 401 error. As expected the email is triggered each time a user lands on the page, is there any time based cooldown I can implement before retriggering e.g once per day?

Here is the current state of the trigger:


#2

I haven’t used REST responses in a trigger, but here’s an idea using a metadata field of the REST asset.

  • On the REST asset, add a new metadata text field “lastTriggeredDate”.

  • In your trigger’s Condition section:

    • We want to only proceed with the trigger if the last triggered date is earlier than today.
    • Use Keyword value and check globals_asset_metadata_lastTriggeredDate:RESTASSETID^lt:{globals_date_Ymd} for an exact match to 1.
    • Add existing conditions.
  • In the Action section:

    • If trigger proceeds, update the metadata field with today’s date.
    • Use Set Metadata Value, with ‘on other assets’ checked, on RESTASSETID.
    • Set the metadata field ASSET ID to %globals_date_Ymd%. ‘Replace keywords’ should be checked.
    • Add existing actions.

I presume there is a performance hit when we use globals to find the REST asset’s metadata values, but I think (hope) it will be minor.


(Jack Kelly) #3

Thanks for this. I’ve already tried implementing something like this, but the REST asset is handling multiple endpoints, so it would also need to track what endpoints were triggered as well. I feel like triggers aren’t really designed for this scenario, so I’m likely going to use an external service.