Avoid launching an action twice

Hello,

I’ve built an action allowing users to add a status to a public “status page” (via an API).

Is there a way to save the content that was pushed and check it when the action is launched next time in order to avoid pushing the same text twice ?

I don’t know if I was clear enough… so I’ll try to give you an example :


Step 1 : I’m adding the text “:tada: Hello” in Drafts and launching the action “Status”
Step 2 : I’m re-launching the action “Status”, but it detects that my text haven’t change so it does nothing
Step 3 : I’m adding the text “World” in the draft and launching the action “Status”. Now, as my text is different, the action will make the POST call and update the API


Thanks in advance :slight_smile:

What you need is a way to compare your current text to the last posted text. If it is the same, warn you, if it is different, post it.

You just need somewhere to store the last posted content so you can check against it in the future. You could update the content of a particular draft each time (e.g. a draft in your archive, referenced by UUID), or in a file you read/write from drafts.

For what it’s worth, I would avoid checking the previous version of the draft as other actions for example could trigger an intermediate version save which may make the content differ, but not necessarily differ to the content last posted.

1 Like

Thank you for the idea :slight_smile: