Rich Content Model

Rich Content Model

 Root properties - REQUIRED

property

required/optional

description

typeREQUIRED

The type of rich content.

Should be set to options.

name

OPTIONAL

Default: empty string

A human readable name for the message for easier tracking of messages. It is not displayed.
externalIdOPTIONALAn optional unique id of the rich content message. By setting an externalId, navigations can be traced back to the message.
bodyCssOPTIONAL

The css applied on the body container.

It can be flex for simpler content and grid for more advanced content. Or anything else really.

If omitted it will fallback to the layout setting for rich content in the chat interaction or default to the vertical layout with flex column styling:

{
        display: 'flex',
        flexDirection: 'column',
        alignItems: 'center',
        gap: '10px'
}
bodyREQUIRED

Contains an array of objects which the user can interact with.

When the user has interacted, the rich content becomes disabled or stays active based on the afterResponse setting.

afterResponse

OPTIONAL

Default: disable

A string identifier for what should happen to the UI after the user has made a selection.

Supported values:

disable: disables the richContent after a selection or confirmation of a selections is done.

sticky: The richContent continues to be active after a selection is made.

reponseMethod

OPTIONAL

Default: optionsResponse

This decides what should be sent after the user has interacted with the rich content.

It can send an optionsResponse or a chat message with the values or both.

Supported values:

optionsResponse , chatMessage, both

Using chatMessage will not disable the richContent when selecting an option, in effect making the content sticky

submitType

OPTIONAL

Default: singleChoice

Decides if the a response should be sent on a single selection or using the submitButton.

When using checkboxes, submitType needs to be set to multiChoice and a submitButton is needed.

Supported values

singleChoice

multiChoice

testFlow

OPTIONAL

Default: should not be part of the data if not in test.

Test flow is used for end to end testing of bot flows. The property should not be exposed to customers. That means completely omitted.

testFlow

Test flow is used for end to end testing of bot flows. It enables a simulation of user choices and responses. It’s an array with commands that will be executed in order.

CAUTIONKeep in mind that disabled buttons can still be clicked using testFlow. This means that buttons that have already been submitted can be clicked again.

CAUTIONMake sure that all buttons that are clicked actually exist in the richContent. Using click on missing buttons and submit button could generate errors or a crash.

CAUTION If a new richContent with testFlow is received during an ongoing testFlow the commands will be interleaved creating unpredictable results.

WARNINGThis should not be used to set initial values for the richContent or for any other hacks.

WARNINGThis feature should only be used for testing flows. It should not be in the data that is exposed to the customer.

WARNINGIf used incorrectly it will crash the front end application.

WARNINGUse at own risk.

testFlow commands

command

description

{
  type: 'click',
  id: 'id'
}
This will click a button with the id. It works on both multi select and single select buttons.
{
  type: 'click'
  id: 'submit'
}
This will click the submit button and trigger the submission. The id needs to be set to ‘submit’
{
  type: 'input',
  id: 'id',
  value: 'input text'
}
This will set the text of an input with id to value.
{
  type: 'wait'
  value: 1000
}
This will do a wait for the number of milliseconds in value. The wait command can be used the interaction more humanlike.
{
  type: 'chatMessage',
  value: 'the message'
}
This will send a regular chat message.

Published

Last updated

0
0