Anatomy of a task
Botize is a platform for creating tasks. When you create a task, you are telling Botize “whenever this happen, do that”. A task is therefore comprised of two blocks that share information: a trigger and an action.
- A trigger is a piece of code that is executed by Botize as the first step of a task execution. This code will basically check if something interesting has happened and produce a set of data with information about this “something”. Interesting events may be anything, from a new post on a social network to a new file on a cloud storage account or even data collected from any kind of sensor. Botize places no restriction on what a trigger may do, other than that it must generate data in a standardized format.
The name “trigger” may be confusing in that it may seem to suggest that there is code that executes spontaneously when a certain condition is met. It does not work that way; a trigger is only executed when it actively receives a request from Botize, and this happens at regular intervals configured by the user that has created the task.
- An action is another piece of code that is executed by Botize with the information generated by the trigger as input data. As in the case of triggers, there is no restriction on what an action can actually do, although an action will usually do something more “active” than just checking for some event to have happened.
Triggers and actions do not communicate directly; in fact, they are not aware of which tasks they are part of. Instead, they just accept input data and produce output data. The Botize engine takes care of all the necessary plumbing. Users create tasks by selecting a trigger and an action, which may or may not be part of the same application. An action that works with standard data only can be paired with any trigger; an action that requires one or more data variables of custom types can be paired with triggers that generate output data of the same type (see the get_function_info command description).