GETRICHMESSAGE

This help page is for CXone Studio. This information is also available for Desktop Studio.

A speech bubble with lines in it and an arrow pointing down.

Passes rich message JSON to the digital AskCaller action or TExtMsg action.  This allows you to use rich message templates created on the Point of Contact Digital page in ACD in your scripts instead of building the JSON in the script.

Dependencies

  • This action requires Digital Experience.
  • Before working with digital scripts, learn about the differences between traditional ACD scripts and digital scripts.
  • Must be used with one of the following actions: AskCaller or TExtMsg.
  • Place GETRICHMESSAGE before AskCaller or TExtMsg in your script.
  • Support for rich messaging content type varies by channel, as shown in the following drop-down.

  • Create rich message templates to use with this action on the Point of Contact Digital page in CXone. You can create templates for list pickers, time pickers, rich links, and quick replies. If you need to use other rich media, you cannot use GETRICHMESSAGE. Instead, you must build the JSON in a Snippet action and pass it directly to AskCaller or TExtMsg. See the Dependencies section in the online help for those actions for more information.

Supported Script Types

Digital

Comparison of Similar Actions

The following actions have similar functions, but with some key differences: 

Input Properties

These properties define data that the action uses when executing.

Property

Description

Add Caption

Enter a short phrase that uniquely identifies this action in the script. The caption appears on the script canvas under the action icon.

channelID

Select the digital channel this script uses to send messages.

Output Properties

These properties contain variables that hold data returned from executing the action. They're available for reference and use when the action completes.

Property

Description

resultSet Holds the JSON returned from CXone. Pass the contents of this variable to Askcaller or TExtmsg as a JSON string.

Result Branch Conditions

Result branch conditions allow you to create branches in your script to handle different outcomes when an action executes.

Condition

Description

Default

Path taken unless the script meets a condition that requires it to take one of the other branches. It is also taken if the action's other branches are not defined.

Error

Path taken when the action fails to execute properly. For example, when there is an unexpected problem such as poor connectivity, syntax errors, and so on. The _ERR variable, with a single underscore character, should be populated with a condensed explanation of the problem.

Success

Path taken if the action completes without errors and any API calls or data returns were successful (2xx response codes).

Required SNIPPET Action Code

This action may require a Snippet action with code that handles the rich media templates that the GETRICHMESSAGE action returns from the digital point of contact. If the point of contact only has one template, you don't need snippet code. You can use the variable specified in the Result Set property. For points of contact that have more than one template, you need snippet code.

  1. Create a template on the Points of Contact Digital page in the ACD application and assign it to the point of contact you want to use it with. You may need assistance from a CXone administrator to complete this step.

  2. Create a script with the digital media type.

  3. Add a GETRICHMESSAGE action and either an ASKCALLER action or a TeXTMSG action. If the point of contact has more than one template, you also need a SNIPPET action.
  4. Configure the ChannelId property in GETRICHMESSAGE with the point of contact you assigned the template to.
  5. Add the appropriate code to the SNIPPET action:
    • If you only have one template or if you only want to send one template with this script, use code such as:

      DYNAMIC json1 
      ASSIGN json1.data[1] = resultset.data[1]
    • If you have multiple templates and want to be able to send more than one with this script, use code such as:

      DYNAMIC json1
      DYNAMIC json2
      DYNAMIC json3
      				 
      ASSIGN json1.data[1] = resultset.data[1]
      ASSIGN json2.data[1] = resultset.data[2]
      ASSIGN json3.data[1] = resultset.data[3]
  6. Change the index number that identifies the template you want to send. In the example code from the previous step, you would change the index numbers in the resultset.data[x] variable. Do not change the index in the variable you're assigning the template to. In the example code, the variable is jsonY.data[Z], and you could change Y but not Z. Each jsonY variable holds one template.
  7. Modify the variable names if you want. If you do, change the variable names as needed in the other actions in the script. For example, resultSet is the default variable name in the resultSet property of GETRICHMESSAGe. The jsonY variables are used in the Message property of AskCaller and Textmsg.
  8. Configure AskCaller or Textmsg
    1. Set the MessageFormat property to JSON.
    2. Configure Message with the name of the variable that holds the JSON of the template you're sending. It must be sent as a JSON string. You can use variable substitution in this field. If you do, add code to a Snippet to choose the template to send and pass the right variable on.
    3. Configure other properties of the actions as needed, including connecting the branches. Refer to the online help for the ASKCALLER action or TeXTMSG action.

Script Example

This is an example to show how this action can be used in scripts. It is not intended to be a complete script. Additional scripting may be required.

This example shows the GETRICHMESSAGE action connected to a SNIPPET action, which is connected to TeXTMSG. It could also be connected to ASKCALLER. When the script runs, GETRICHMESSAGE retrieves the available rich message templates for the digital channel specified in ChannelId. They're stored in the variable specified in the Result Set property. In this example, the variable is resultId. The snippet code contains a dynamic data object that will hold a specific rich message template JSON and pass it to TeXTMSG.