Tasks
Send Action
The sendaction task automatically executes an action on a stub, or a list of stubs.
Possible uses include conditionally executing a second action, alerting a different stub of an action taken, or even closing a list of stubs. It is worth noting that the sent action still needs to be available in the target stub's state, else the task will fail with the error action_not_in_state
.
It is possible to cause loops with this task. Be careful when using it.
If an action, eg. start_loop
, on a stub eg. 2024-01-01-XXXX-ABCD
, contains a send action
of start_loop
to the same stub, Stubber will block the task and return an error.
However, it is still possible to cause loops by eg. sending an action to another stub, eg.
2024-01-01-XXXX-1234
, which could then send an action back to the original stub.
Basic usage
Parameters
action_name
The name of the action you want to execute.
required
if the action_names
parameter is not set.
action_names
A list of action names you want to execute. Allows running multiple actions in a single task.
required
if the action_name
parameter is not set.
data
The data passed to the action in lieu of form data, which can be substituted in with ~~stubpost.data
.
message
The action's message.
stubref
The stubref of the stub the sent actions will be executed on.
required
if the stubrefs
parameter is not set.
stubrefs
A list of stubrefs of the stubs the sent actions will executed on.
required
if the stubref
parameter is not set.
bulk_action
If this is set to true
, the action will run on our bulk systems. Actions that run on the bulk systems do not have
a guaranteed order of execution, the upside is that more systems can handle these actions since order does not matter.
This is useful when you want to run thousands of a specific action and the order that they run in does not matter.
Result
Properties
sendActionsList
The list of actions that has be placed in the execution queue.
sendActionsList.action_name
The name of the action that has been sent to the execution queue.
sendActionsList.stubref
The stubref that the action was sent to and will execute on.
sendActionsList.data
The data that was sent as the action data.
sendActionsList.stubref
The message that was used for the action. In other words, the stubpost message.
Examples
Sending to multiple stubs
Using the stubrefs
parameter instead of stubref
allows you to execute the same action on multiple stubs.