I've been trying to find the relevant docs for Rules module, in order to add functionality/configurability at the user level. 
The docs say:

"Rules are reconfigurable micro-programs that can run at the click of a button or as a reaction upon any detected situation. Site builders and module developers can configure various actions and control sequences that will then be fired in simple or complex sequences." https://github.com/backdrop-contrib/rules/wiki

But thus far I have not found any useful examples of how to modify the Rules variables via code, eg to make the system send out 5 of something instead of 1, or to change a time period from 1 day to 2.

Accepted answer

Hi onyx.

Rules are extensible through hooks. Take a look at the file rules.api.php, inside the rules module folder. That has quite a bit of example code. You can create new actions, new conditions, new events, new data types, etc. Some things are easier than others. In general the hooks are used to create "info" about each, and to define callbacks and parameters. 

There is still documentation for Drupal 7. Take a look at the Tiny Book of Rules, as well as help pages in Drupal spaces, such as https://www.drupal.org/documentation/modules/rules

A lot can be done with actions, events and conditions already defined by Rules. It seems to me that the two examples that you cite there do not need you to create new ones - they could be handled with existing ones.

If you are trying to create rules in code (using existing events, conditions, data and actions), either take a look at the exported JSON-like code generated by Rules -> export, or look at the multiple tests in the tests folder of rules. Those tests create a multitude of simple Rules and Components with code (without necessarily creating new actions, etc). 

Comments

Hi onyx.

Rules are extensible through hooks. Take a look at the file rules.api.php, inside the rules module folder. That has quite a bit of example code. You can create new actions, new conditions, new events, new data types, etc. Some things are easier than others. In general the hooks are used to create "info" about each, and to define callbacks and parameters. 

There is still documentation for Drupal 7. Take a look at the Tiny Book of Rules, as well as help pages in Drupal spaces, such as https://www.drupal.org/documentation/modules/rules

A lot can be done with actions, events and conditions already defined by Rules. It seems to me that the two examples that you cite there do not need you to create new ones - they could be handled with existing ones.

If you are trying to create rules in code (using existing events, conditions, data and actions), either take a look at the exported JSON-like code generated by Rules -> export, or look at the multiple tests in the tests folder of rules. Those tests create a multitude of simple Rules and Components with code (without necessarily creating new actions, etc).