JSON Schemas for Digital Channels

JSON schemas define the structure of JSON data. Use them as templates for adding content to the messages you configure on your Digital Experience (Digital Experience) channels. These schemas allow you to add rich media content to messages. Rich media include things like list pickers, galleries, and menus.

Each Digital Experience channelClosed A way for contacts to interact with agents or bots. A channel can be voice, email, chat, social media, and so on. supports different types of rich media. Each channel also requires a different schema for the same rich media content. For example, the schema for including an image in Digital Experience Live Chat is different from the schema to include an image in other channels.

Currently, schema documentation is available for DFO chat channels (live chat and chat messaging) and Apple Messages for Business.

Schemas and Virtual Agent Hub

Virtual agentsClosed A software application that handles customer interactions in place of a live human agent. support some Digital Experience channels. You can use JSON schemas for the supported channels to configure messages that you want your text virtual agent to send to contacts. Use the schema for the channel you're using your text virtual agent with.

Currently, the following schemas are supported for use with virtual agents:

When you want to use rich media content in your chatbotsClosed A software application that handles customer interactions in place of a live human agent. for Digital Experience channels, you need to add the content to the bot. Add it in the console for managing the bot, not in the Studio script or Virtual Agent Hub app. The content must follow the JSON schema specific to the channel you're using the virtual agent with.

Watch the NICE CXone demo on using JSON schemas with chatbots. The demo shows adding content with SmartAssist, Dialogflow, and Amazon Lex V1.

Schemas in Studio Scripts

You need to include JSON schemas in your script for the rich media you want included in messages to contacts. You can do this in two ways: 

  • Hard-code the JSON and assign it to a variable. 
  • Build it in a dynamic object in a Snippet action.

Examples of both approaches are provided in this section. The JSON in these examples is an example for Digital Experience chat. Other examples for Digital Experience chat are available.

The following example shows JSON assigned to a variable: 

ASSIGN jsonbody = $"\{\"prompts\":[\{\"transcript\":\"Welcome!  Choose Sales or Support and an agent will be with you shortly.\"},\{\"mediaSpecificObject\":\{\"dfoMessage\":\{\"messageContent\":\{\"type\":\"PLUGIN\",\"payload\":\{\"postback\":\"\",\"elements\":[\{\"id\":\"Ek4tPy1h4\",\"type\":\"TEXT_AND_BUTTONS\",\"elements\":[\{\"id\":\"TID1\",\"type\":\"TEXT\",\"text\":\"Please select an option\"},\{\"id\":\"BID1\",\"type\":\"BUTTON\",\"text\":\"Sales\",\"postback\":\"payment-button-1\"},\{\"id\":\"BID2\",\"type\":\"BUTTON\",\"text\":\"Support\",\"postback\":\"payment-button-2\"}]}]}}}}}]}" 

The following example shows the same JSON built in a dynamic object in a Snippet action:

DYNAMIC json
json.prompts[1].transcript="Welcome!  Choose Sales or Support and an agent will be with you shortly."
json.prompts[2].mediaSpecificObject.dfoMessage.messageContent.type="PLUGIN"
json.prompts[2].mediaSpecificObject.dfoMessage.messageContent.payload.postback=""
json.prompts[2].mediaSpecificObject.dfoMessage.messageContent.payload.elements[1].id="Ek4tPy1h4"
json.prompts[2].mediaSpecificObject.dfoMessage.messageContent.payload.elements[1].type="TEXT_AND_BUTTONS"
json.prompts[2].mediaSpecificObject.dfoMessage.messageContent.payload.elements[1].elements[1].id="TID1"
json.prompts[2].mediaSpecificObject.dfoMessage.messageContent.payload.elements[1].elements[1].type="TEXT"
json.prompts[2].mediaSpecificObject.dfoMessage.messageContent.payload.elements[1].elements[1].text="Please select an option"
json.prompts[2].mediaSpecificObject.dfoMessage.messageContent.payload.elements[1].elements[2].id="BID1"
json.prompts[2].mediaSpecificObject.dfoMessage.messageContent.payload.elements[1].elements[2].type="BUTTON"
json.prompts[2].mediaSpecificObject.dfoMessage.messageContent.payload.elements[1].elements[2].text="Sales"
json.prompts[2].mediaSpecificObject.dfoMessage.messageContent.payload.elements[1].elements[2].postback="payment-button-1"
json.prompts[2].mediaSpecificObject.dfoMessage.messageContent.payload.elements[1].elements[3].id="BID2"
json.prompts[2].mediaSpecificObject.dfoMessage.messageContent.payload.elements[1].elements[3].type="BUTTON"
json.prompts[2].mediaSpecificObject.dfoMessage.messageContent.payload.elements[1].elements[3].text="Support"
json.prompts[2].mediaSpecificObject.dfoMessage.messageContent.payload.elements[1].elements[3].postback="payment-button-2"
ASSIGN jsonBody="{json.asJSON()}"		

Verify JSON with the Mirror Tool

You can verify rich media JSON before adding it to your scripts or third-party providers' systems. The  JSON mirror tool is a script-based tool that's set up to work with a digital chat-based channel such as Live Chat.

Using the tool, you can paste in JSON and see how it will appear to contacts and agents. The script processes it and displays the output for you in the chat window. This allows you to test your JSON and ensure it's correct before adding it to your scripts or the console for your virtual agent or digital channel provider.