Create and configure rules

The Drupal Rules module lets you define a rule that specifies the action that occurs automatically in response to an event on the portal. For example, you can create a rule to automatically add a default app (action) to all new developer accounts (event). Or, you can create a rule to redirect a user to a specific page (action) on log in (event). Add and manage user accounts shows how to define those two rules.

The Drupal Rules module tracks events that are performed using the portal only. It does not track equivalent events that are performed using Apigee Edge. For example, if you have defined a rule that tracks when an app is updated, if an app is updated using the dev portal, the action will be triggered. If the app is updated using Apigee Edge, no action will be triggered.

The Rules module is very flexible and you can use it to create many different types of rules. A subset of the events include:

Adding, updating or deleting a developer app

Changing the status of a developer app

Adding, updating, or deleting a developer account

Adding, updating, or deleting a portal node

Drupal is initialized

A Drupal log entry is created

A subset of the types of actions that can be performed include:

Sending an email to an individual or group

Blocking a user

Promoting content

Showing a message on the site

Performing a page redirect

Blocking an IP address

If the event is the changing of the status of an app, and the action is to send an email, then the email is sent the next time the portal's cron job runs. In Edge for Private Cloud installations, you can set the frequency of the cron job to as short as one minute. In Edge cloud, the minimum frequency is one hour.

To set the frequency of the cron job, select Configuration > System > Cron in the Drupal administration menu.

To manually trigger the cron job, select the Home icon > Run cron.

You can also add conditions to rules, for example to test the role of a developer, as part of processing the rule.

For a compete list of capabilities, see the documentation on the Drupal Rules module.

In the React on event dropdown box, select Devconnect > Upon creation of a developer app.

Select Save
The Editing reaction rule page appears. You already set the event in the previous step, so it should say Upon creation of a developer app in under Events. Leave Conditions blank for this rule.

Under Actions, select + Add action.

Select System > Send mail in the dropdown.
The Add a new action page changes its layout to let you specify email information.

Edit all information including the email recipients, message body, sender, and other information.

Click Save to return to the Editing reaction rule page.

Click Save changes.

Now when a developer creates an app, an email is automatically sent to the list of recipients specified by the rule.