Presentation information is Device-specific, but notifications can be viewed from the Device level or the User level (via browser or callin). Since the example script does not have an interaction script yet (required for voice), the User-level callin portion can be ignored, but presentation information must be provided for the SMTP Email, Text Pager and browser Devices. The following code modifies the content being sent to each Device and makes it Device specific:
###################################################################
# Script: HelloWorld/PRESENTATION/presentation
#
# This script customizes presentation of content for a
# particular type of Device.
#
##################################################################
#/////////////////////////////////////////////////////////////////
# This is the main entry point for this script. Before a message is
# sent to the Device Engine(s), this script is called and enables
# customization of the content for each User/Device.
#/////////////////////////////////////////////////////////////////
main:
# set the log filename (only if debug token specified)
IF (EXISTS($event.debug))
@script::log("Presentation script called for device = " & $content.deviceclassification)
ENDIF
# if this is an email device, set presentation accordingly
IF ($content.deviceclassification == "email")
# before interacting with the content object,
# input the list of current choices stored in
# $main.genericContent.choices. if this step is skipped, the
# choice list would be limited to the single choice added later
$content.choices = $main.genericChoices
# add a custom menu item, change the subject and message body
$content.choices::add("Greeting Email World, we come in peace")
$content.subject = "Example #4, SMTP Email Device, Incident ID = " & $event.incident_id
$content.message = "Hello Email World!"
# for text pager devices, set presentation accordingly
ELSE-IF ($content.deviceclassification == "text_pager")
# before interacting with the content object,
# input the list of current choices stored in
# $main.genericContent.choices. if this step is skipped, the
# choice list would be limited to the single choice added later
$content.choices = $main.genericChoices
# add a custom menu item, change the subject and message body
$content.choices::add("Greetings Pager World, we come in peace")
$content.subject = "Example #4, Text Pager Device, Incident ID = " & $event.incident_id
$content.message = "Hello Pager World!"
# even though a browser Device is not being targeted, it is still
# necessary to create presentation content specific to this type
# of Device because the notifications are accessibly from the
# web regardless of which Devices are being targeted
# if an interaction script was also being included, content would
# need to be added here for the voice phone, because a User can
# always callin to check their notifications
ELSE-IF ($content.deviceclassification == "browser")
$content.message = "Hello Browser World!"
ENDIF
### DONE: main ###
If you log in to xMatters as a Company Administrator before responding to the notifications, you can review the browser presentation for this event.
Next topic: Testing the example script