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.
Execution Note : Send actions are aggregated as the tasks are performed and then sent off after the task is completed.
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.
Uses
This task is very useful for coordinating actions between stubs. For example if you have a template that analyzes documents and you'd like to use this functionality in multiple stubs, you can use the send action task to send the action to the stub that needs it.
The stub that receives the action will then execute it and do a send action back to the original stub with the results.
Basic usage
Parameters
action_name optional string
The name of the action you want to execute.
required if the action_names parameter is not set.
action_names optional string[]
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 string
The action's message.
stubref optional string
The stubref of the stub the sent actions will be executed on.
required if the stubrefs parameter is not set.
stubrefs optional string[]
A list of stubrefs of the stubs the sent actions will executed on.
required if the stubref parameter is not set.
bulk_action required boolean
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 array
The list of actions that has be placed in the execution queue.
sendActionsList.action_name string
The name of the action that has been sent to the execution queue.
sendActionsList.stubref string
The stubref that the action was sent to and will execute on.
sendActionsList.data string
The data that was sent as the action data.
sendActionsList.stubref string
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.