I think that you can now use Automations (although I’ve not tried it myself). If you want to use the API then you should probably read this…
Pete.