Modifying the presentation script

No changes are required for the response object, but the presentation script needs an additional deviceclassification test for “voice” as follows:

###################################################################

# 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 #5, 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("Greeting Pager World, we come in peace")

     $content.subject = "Example #5, Text Pager Device, Incident ID = " & $event.incident_id

    $content.message = "Hello Pager World!"

 

  # for voice devices, set presentation accordingly

  ELSE-IF ($content.deviceclassification == "voice")

 

    # add a custom menu item, change the subject and message body

    $content.subject = "Example #5, Voice Device, Incident ID = " & $event.incident_id

    $content.message = "Hello Voice 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 virtual phone, because a User can

  # always callin to check their notifications

  ELSE-IF ($content.deviceclassification == "browser")

  

    $content.message = "Hello Browser World!"

    

  ENDIF

 

### DONE: main ###

Next topic: Creating an Interaction Script