do_action (POST)
Purpose
Execute the code associated to an action, using the data variables produced by a trigger.
Input parameters
- id: Function identifier for the action, as returned by the get_function_info command in the id parameter.
- data: A JSON object with the following format:
{ "input_data":{ "text":"Hello world", "link":"http://www.botize.com" }, "form_data":{ "city":"Tokyo" }, "saved_data":"..." "authentication":{ "user_id":"theUser", "auth_saved_data":"..." } }
- input_data: The data variables produced by the trigger of the task in which the action is being executed.
- form_data: The action configuration data as supplied by the user via the action configuration form, with the data substitution markers appropriately replaced with the data provided by the trigger. See the Configuring tasks with forms section for details.
- saved_data and authentication: These elements work the same way as in the process_trigger command.
Output data
A JSON object with this format:
{ "status_code":"0", "status_message":"Ok", "data_to_save":"..." }
This is the same object returned by the process_trigger command, except that there is no output_data element.
Notes
Botize will invoke this command after the execution of the trigger for the same task finishes successfully or with a warning status code, passing in the variables returned by the trigger in output_data. See the Workflow of a task execution section for details. The rules for status_code and status_message are the same as in the case of the process_trigger command, except that a failure condition will not have effect in the task execution workflow since there is nothing else to do in a task after the action has been invoked.