Workflow of a task execution

The following is a high level description of all the steps that Botize performs when executing a task.

This description references commands that must be implemented by the application; full details about how these commands must be implemented can be found in the Commands reference section.

  1. Botize decides that it is time to execute a task. It then executes the process_trigger command by passing the trigger identifier in the id parameter.
  2. Botize saves the contents of the data_to_save element in the returned data (if present), in order to pass it in the saved_data element the next time the trigger is executed in the same task.
  3. If anything of the following happens after executing the process_trigger command, the task execution stops (the first two cause an entry to be written in the task log):
    • The command returns an HTTP error
    • The command returns a trigger execution error (a value of status_code different from zero in the returned data)
    • The command returns no output data (empty or missing output_data element in the returned data)
  4. Botize executes the do_action command by passing the action identifier in the id parameter. The contents of the output_data element in the data returned by the trigger is supplied in the input_data element of the data passed to the action. This data is also appropriately combined with the form data configured by the user and passed in the form_data element (see Configuring tasks with forms).
  5. Botize saves the contents of the data_to_save element in the returned data (if present), in order to pass it in the saved_data element the next time the action is executed in the same task.
  6. If one of the following happens, Botize writes an entry in the task log:
    • The command returns an HTTP error
    • The command returns an action execution error (a value of status_code different from zero in the returned data)

Depending on the value returned in the status_code variable by the trigger and the action, Botize may decide to disable the task, so that it does not execute anymore until the user manually re-enables it. See the process_trigger command description for more details.