Macro Actions

One of the key parts of Sirportly is the macros system and your module can get right in on this action. With macro actions, you can define methods which can be configured as part of an administrator-defined macro.

In our Hipchat module, for example, we have a macro action called poke_via_hipchat which allows anyone to press a button and send a message to the company's Hipchat room to ask someone to take a look at a ticket.

class Hipchat < Module

  add_macro_action :poke_via_hipchat, "Poke via. Hipchat" do |config, macro, ticket, options|
    ## The code in this block will be executed whenever a macro which calls this action is
    ## invoked either through a button or through a rule.


Using add_macro_action

This method accepts two parameters:

  • The first parameter is the "system" name for the macro action and should be a Ruby symbol and unique across all modules configured in the application.
  • The second parameter is a title for the action which will be displayed in the macro management UI.

When executing the block, you are passed 4 objects to work with:

  • config - contains a hash of the configuration for the account. See the configuration page for further details.
  • macro - contains the object of the macro which invoked the block
  • ticket - contains the ticket which the macro is being executed on
  • options - contains options which are pursuant to the macro invocation for example, :current_user may exist if the macro execution is directly attributable to a system user (i.e. they clicked a button to call it).

Proudly powered by Katapult. Running on 100% renewable energy.