Actions

Actions are the work-house of an Automation. They execute the resulting business logic for an Automation, as set up by the User.

Booting

Actions are able to asynchronously boot before being ready to execute. This is useful for fetching external data or establishing WebSocket connections as an example.

async mounted() {
    await super.mounted();

    // Establish a WebSocket connection, start longpolling, etc.
}

Execution

When a Trigger is executed in an Automation and all Conditions pass, all Actions will be executed together (Or asynchronously if the User enables Sequential Actions). A function inside the Action will be called to execute the logic, run. It accepts a single parameter, input, which is the data output from the Trigger that executed the Automation.

Each Trigger can define it's own I/O schema, as such, it's better to test or hard-encode certain services/systems your Action works with if you rely on the given input.

async run(input) {
    /**
     * You don't need to return anything since the function
     * is defined using `async`. Otherwise, return a resolved
     * Promise using `Promise.resolve()`
     */
}