Modifying Script Packages for Subscriptions

Each Event Domain has a separate Script Package that must be configured to handle Subscriptions. Use the xMatters Developer IDE to configure a Script Package (for more information on using the Developer IDE, refer to the xMatters Online Developer's Guide ).

To enable Subscriptions in a Script Package:
  1. Using the xMatters Developer IDE, check out the Script Package for the selected Event Domain.
    1. The “default” Script Package is configured to handle subscriptions out-of-the-box; no changes are necessary if you are using the “default” Event Domain.
  2. Add the following section to the “PROCESS - initial” script, immediately after the @alert::performNotification() method:
#added for subscriptions handling
$subscriptionList = @event::getSubscriptions()        
FOR ($subscriptionId : $subscriptionList )     
  @subscription = @event::getSubscription($subscriptionId)        
  @subscriptionAlert = @subscription::notification()        
  @subscriptionAlert::setHandlerScript("response")        
  @subscriptionAlert::setPresentationScript("messaging")        
  @subscriptionContent = @subscription::content()        
  $subscriptionContent.message = "undefined"        
  if (EXISTS($subscriptionContent.choices))        
    $main.subscriptionChoices = $subscriptionContent.choices        
  endif        
  @subscriptionAlert::setContent(@subscriptionContent)        
  @subscriptionAlert::performNotification()        
ENDFOR
 
  1. Ensure the “response” handler script exists and is configured to handle the responses defined in the two-way responses section of the Subscription.
    1. Any handler script can be used for this purpose, as long as the @subscriptionAlert::setHandlerScript() method is calling the correct script.
  2. Ensure the “messaging” presentation script exists and generates the correct content.
    1. Any presentation script can be used for this purpose, as long as the @subscriptionAlert::setPresentationScript() method is calling the correct script.
  3. Check in the modified Script Package as a production version.