How to use arguments, defined in a custom event, for an action I've just defined this event with the two arguments: number and message. I want to use them to verify the message and send a response back to the number. I have an action for that but I don't know how to pass the arguments.

function sms_rules_rules_event_info() {
  return array(
      'sms_rules_sms_received' =&gt; array(
         'label' =&gt; t('SMS received'),
         'module' =&gt; 'sms_rules',
         'arguments' =&gt; array(
            'number' =&gt; array('type' =&gt; 'text', 'label' =&gt; t('Number from where the message was received.')),
            'message' =&gt; array('type' =&gt; 'long text', 'label' =&gt; t('Contents of message.')),
         ),
      ),
  );
}
In your action you might have something like

function mymodule_rules_action_info() {
  return array(
    'my_action' =&gt; array(
      'label' =&gt; t('Label'),
      'module' =&gt; t('My module'),
      'arguments' =&gt; array(
        'number' =&gt; array('type' =&gt; 'text', 'label' =&gt; t('Number from where the message was received.')),
        'message' =&gt; array('type' =&gt; 'long text', 'label' =&gt; t('Contents of message.')),
      ),
      'base' =&gt; 'mymodule_my_action',
    ),
  );
}


The 'base' property indicates the callback for the action. You can also use the key of your action as the callback if you choose not to set a 'base'. In this case it would be function my_action(). The arguments defined in the action will automatically be passed to that function. Now, whether the action is available is dependent upon which arguments your event makes available and which arguments your action requires. So, if I had an event that passes a 'type' =&gt; 'user' and 'type' =&gt; 'node' then only actions that have arguments 'user' and 'node' would be available. This is how Rules 1 works. Alternatively, by using a simple 'text' data type the actions will always be available because the data type is not unique. You can specify your own data types by implementing hook_rules_data_type_info().

Anyways, I got off track. So, with your base being mymodule_my_action:

function mymodule_my_action($number, $message) {
  // Do stuff here.
  return $number;
}


Another addition you can make if necessary is adding a settings form to your action.

function mymodule_my_action_form($settings, &amp;$form) {
  $form['settings']['my_options'] = array(
    '#type' =&gt; 'select',
    '#title' =&gt; t('Select an option'),
    '#options' =&gt; array(
      'this' =&gt; t('this'),
      'that' =&gt; t('that'),
      'also' =&gt; t('also'),
    ),
    '#default_value' =&gt; $settings['my_options'],
    '#required' =&gt; TRUE,
  );
}


In this case, you would just add the settings array to your action callback as the last argument:

function mymodule_my_action($number, $message, $settings) {
  if ($settings['my_options'] == 'this') {
    // Do stuff.
  }
}


Hmm... I don't even know if I answered your question, but I tried to provide as much info as possible. If I completely missed it please give me some guidance. I maintain three Rules modules, so I've been around that module for a while and I'm glad to help.