Configuration

One of the most useful parts of the modules framework in Sirportly is the ability to request that modules be enabled/disabled within your web interface. This is mostly useful in the cloud edition where many modules may be set up however only used by a small sub-section of account holders to whom they are relevant. Having said that, all users should consider using this system so that future configuration is easily configurable.

Configuring required parameters

In order to tell Sirportly which configuration parameters you would like to request from account owners, you need to add a few options into your module class. These examples are taken from the Hipchat module which is present in all Sirportly installations.

class Hipchat < Module

  ## ... other information up here as displayed on module intro page.

  config_option :room, "Room Name", "The name of the room", :required => true
  config_option :api_key, "API Key", "Your Hipchat API key", :required => true
  config_option :from_name, "Sender", "Name to send Hipchat messages from"
  config_option :colour, "Colour", "Message Colour", :options => ['Yellow', 'Red']

  icon "/images/modules/hipchat.png"
  public_description "Enter a description about your module to display"
  url "http://hipchat.com"

  publicise
end

Using config_option

  • The first parameter should be a symbol which is used as a "system" key to identify this property and which you can use to access the data entered by the account owner later.
  • The second parameter is a short name for the field.
  • The third parameter is a description for the field and is displayed to the account owner.
  • Once these parameters have been passed, you can send a number of options including:
    • :required => true - this will ensure that the field is entered by the account owner
    • :options => ['Opt1', 'Opt2'] - this is an array of options. If entered, a select list will be displayed instead of text field.

Other properties

You also need to specify a number of other options within your module configuration which help generate the configuration page shown to account owners.

  • The icon property should be a URL to a 16x16 icon to represent your module.
  • The public_description property should be text to outline what your module does and is displayed to account owners.
  • The url property should be a URL for further information about this module. This is optional and leaving it blank will mean that a 'More Information' link is not displayed.

Using publicise

The final method you need to call is publicise. This tells Sirportly that you wish this module to be public and to be displayed on the Integration Options page in the Admin UI. If this is not selected, any module actions you configure (callbacks, macro actions, web actions etc...) will be invoked for all users.

The configuration options page

The page incudes a a full list of all public modules and looks like the screenshot below:

Image

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