I want to skip a schedule that runs every day unde...
# community-help
p
I want to skip a schedule that runs every day under certain conditions. How can I implement this? 🤔 • There is a scheduled HTTP request that will be executed at 9:30AM every day. A) Executed a little earlier at 9:10 am from a Slack slash command → Skip the HTTP request that will be executed at 9:30 am that day B) As usual → automatically executed at 9:30 am
m
Hi Takeshi! The easiest way here is probably to deduplicate events from both paths for an hour. If you add in an Event Transformation Action in deduplicate mode you can set a
lookback
period in seconds. If you set this to
1800
or, to be safe,
3600
then only one event will be allowed through that deduplicate action every hour
very simple code
Copy code
{
  "agents": [
    {
      "disabled": false,
      "name": "Deduplicate Events",
      "options": "{\"mode\":\"deduplicate\",\"path\":\"anything\",\"period\":\"3600\"}",
      "position": {
        "x": 225,
        "y": 195
      },
      "type": "eventTransformation"
    },
    {
      "disabled": false,
      "name": "Run Every Morning",
      "options": "{\"url\":\"<https://snowy-pond-6977.tines.io/example-echo>\",\"content_type\":\"json\",\"method\":\"post\",\"payload\":{\"key\":\"value\",\"array_example\":[\"\\\"foo\\\"\",\"\\\"bar\\\"\"],\"object_example\":{\"key\":\"value\"}}}",
      "position": {
        "x": 480,
        "y": 60
      },
      "type": "httpRequest"
    },
    {
      "disabled": false,
      "name": "Receive Slash Command",
      "options": "{\"path\":\"ab4dd6d9786446172c10e9d3b671f1bd\",\"secret\":\"b80333858d2bceabf46257667dc57a71\",\"verbs\":\"get,post\"}",
      "position": {
        "x": 225,
        "y": 60
      },
      "type": "webhook"
    }
  ],
  "links": [
    {
      "sourceIdentifier": 2,
      "receiverIdentifier": 0
    },
    {
      "sourceIdentifier": 1,
      "receiverIdentifier": 0
    }
  ],
  "diagramNotes": []
}
you can try that by running the http request action and hitting the Webhook and see the events be deduplicated
Does this help?
r
The other way would be to store in a global resource the last run time, and then have a filter that compares the current run time with the last and only proceeds if it's been more than N hours since the last run.
p
Thank you both so much! We found that deduplicate did not meet the requirement because Slack commands could not be executed until more than N hour had passed. So, Jeremy’s suggestion of using a global resource was a great solution! I had never used deduplicate before, so I learned a lot from it. Thank you very much.