Structured Responses

(For custom responses, see custom actions.)

Responses
Responses, the message sent back to the user, are a basic building block for your app's turn in the conversation. Each response can include multiple components such as text, speech, buttons, and custom code, as well as unconditional and conditional variants. Jargon assembles the response components at runtime, and delivers it to the app. In Rasa, Responses are a type of action, along with Forms and Custom Actions.

Response variants
For conversational content to be engaging, it is best practice to add variety to app responses. Having multiple variants of the same message said in a different way can prevent the app from sounding repetitive. One might say “Congrats!” another “Well done!” etc. All Jargon responses consist of one or more variants, where each variant contains its own components, such as text and buttons, and conditions.

Variant conditions
Adding a condition to a variant allows you to tailor the variant’s content to a specific user context, such as when the user is on a specific platform or channel (i.e. “Rasa Channel: Slack”) or when a variable has a specific value (i.e. “userType: New”). You can add conditions to variants by clicking the “edit” button to the right of the variant and then selecting the “conditions” tab.

Variant selection logic
If multiple response variants are available, Jargon first considers all variants that are eligible by matching conditions in the response request. If it finds multiple variants that match the condition(s), it will select randomly from among those. For example, say your response contains the following variants:

  • Variant 1: No conditions
  • Variant 2: No conditions
  • Variant 3: No conditions
  • Variant 4: Condition “Rasa Channel: Slack”
  • Variant 5: Condition “Rasa Channel: Slack”

If your user is on Slack, Jargon will randomly choose either variant 4 or 5.
If your user is on another channel, Jargon will randomly choose from 1, 2 or 3.

Response components
Each response variant in Jargon consists of one or more response components. These components can differ for each variant.

Text
A text component is a written message sent to the user through a screen display, such as a website or mobile phone.

Speech
A speech component, also referred to as a prompt, is a message that is verbally sent back to the user. It can be any combination of text-to-speech and audio files. The editor contains tooling for Speech Synthesis Markup Language (SSML). SSML tags can be added to direct the sound and delivery of the synthetic voice. For example, pauses, emphases, prosody, and other speech effects can be tagged using SSML. Jargon catches and reports SSML errors as you edit. A simulator below the editor can play back the response for an immediate quality check, using a variety of available synthetic voices to choose from. The synthetic voices available are specific to the locale you are editing.

Reprompt
A reprompt is another speech component that is played if the user needs another prompt to take action. For example, if the user does not respond in a timely manner, a reprompt can clarify the initial response by providing examples for the user to respond.

Rasa Image
Rasa Images are, as the name suggests, images that accompany a chatbot’s text response. All that needs to be provided is simply a URL to the image. See how this appears in the Rasa code here.

Rasa Buttons
Rasa Buttons are interactive buttons users can click on as a message that is sent to the chatbot. Each button consists simply of a title and payload. In Jargon, to add more buttons, click “Add Another” at the bottom of the interface. See more about how this appears in the Rasa code here.

Rasa Custom
Rasa Custom is a JSON-formatted payload that is sent to the output channel. It’s primary benefit is the versatility of actions capable of being performed. See more about how this appears in the Rasa code here.

Google Cards
The Google Assistant Basic Card is designed to be a display of concise or summarized information. The card can contain: a title, a subtitle, a text body, an image and a link button. The link button is traditionally used to lead users to a source with more information about the subject described in the card. At minimal, a text body or image is required. Learn more here.

Alexa Cards
Alexa Cards are graphical cards used to enhance the user voice experience by adding a visual display of content. There are two types of Alexa cards that Jargon supports: Simple and Standard. The Simple cards contain plain text and consist of the card title and content. The Standard cards, like the Simple cards, use plain text for title and content. Unlike the Simple cards, however, the Standard cards add more complexity by permitting the inclusion of images through url links. To switch card types in Jargon, press the name of the card type next to the text “Alexa card type” at the top of the interface screen. Learn more about Alexa cards here.

Google Media
The Google Assistant Media Response stores audio content that can be played for longer than SSML’s 240 second limit. The component works for both audio-only and display devices. On a display, the component is accompanied by an automatically employed visual component that allows users to navigate the track (i.e. provides features like forwarding the audio track by 30 seconds and a bar that shows the progress of the playback).

The audio file used for playback needs to be specified in the form of a HTTPS URL. Aside from the URL, the media response allows the addition of a title, a description and an image or icon. The image and icon are optional and have different requirements. In Jargon, you can choose to add this by clicking on the text to the right of “Picture type” at the bottom of the interface.

Learn more about the media response and its specifications here.

Alexa Directives
Directives are the way Alexa packages user intents. The directives, written in JSON format, are sent to the Lambda as events wherein the Lambda then responds by performing the actions delineated in the directive. More detail and examples of directives can be found here.

Variables
Variables, otherwise known as parameters, are dynamic elements that your app fills. Variable names can be managed in Jargon and configured within a speech component. A variable in Jargon is defined using "{ }" syntax. For example, a response might contain a user’s first name in the following sentence as "Hello {userFirstName}, welcome to Jargon." You create a new variable, select “Create new...” under Variables in the right navigator. You can also select available variables that have been used in other responses throughout your app by selecting “Select from other responses…”. You can insert a response into an eligible response component in the tools to the right of the text editor.

ICU message format
Within your content you can control the process of rendering variables using ICU Message Format constructs. Beyond simple substitution, ICU Message Format helps you to author content that's grammatically correct when dealing with such things as pluralization, gender, or formality.

Plural forms
This example expects a numerical variable, count.
"{count, plural, =0 {You have zero items} =1 {You have one item} other {You have # items}}.
The 'other' case (used when count is neither 0 nor 1) inserts the value of count at '#'."

Gendered forms
This example expects a string variable gender.
"{gender, select, female {She did it!} male {He did it!} other {It did it!}}"

Snippets
Snippets are pieces of content that can be written once and referenced in multiple places throughout a conversational app. To maintain consistency and simplify the management of phrases, names, entities, or any other piece of readily referenced content, a snippet can be created. A snippet in Jargon is defined using "[ ]" syntax and can be managed in the right navigator of the studio when a response is selected. You can insert a snippet with the “Insert Snippet” button to the right of the text editor in eligible components.

Media Assets
Multimodal responses may include media assets such as static images, video, or pre-recorded audio. Jargon supports these media assets in the responses. Furthermore, Jargon detects corrupt or missing media asset pointers and validates the assets’ compatibility with each platform’s requirements. These checks can identify incompatibilities before they become issues impacting your customers or preventing your app from being deployed in the first place.

Media assets, such as audio clips or images, are hosted outside of Jargon and can be referenced in responses in Jargon by inserting a media asset to the right of the text editor within an eligible component. Jargon allows users to store the URL paths for assets, allowing for cataloging and referencing. The media assets are organized with a parent path URL, called a collection, which then stores the individual assets for users to insert into any component.

To edit a media asset’s parent path URL, select the edit icon to the right of the collection name. To edit the individual asset path URL, select the specific media asset and a prompt will appear.


Standalone Resources

Standalone resources -- strings and objects -- are for content that your application might need outside of a structured response. You can also incorporate standalone string resources into other content via a cross-reference.

Strings
Strings provide additional ways to include content and are suitable for the following use cases:

  1. When your content doesn't fit Jargon's basic format of response components (speech, reprompt, card, etc.). In this use-case, the application calls the string directly instead of referencing the string within a response.
  2. When your response consists of two or more parts strung together, each pulling randomly from a predefined list of options, analogous to how a slot machine works. For example, the string may consist of the parts [congratulations] and [another] with content variations defined for each, so that the randomized response will be "Well done! Ready for another?" or "Nice job! Would you like another?" or however many combinations can be made from the number of variations provided for each part. It's similar to variants, but without needing to write out each possible combination.

Strings can be managed in the studio below Responses. Much like responses, strings can be categorized in folders and include multiple variants for each string. To cross-reference a string (i.e. incorporate it into a response), use the following format: [string:<key>]

Objects
Objects provide a way for an application to access structured data. Much like Strings, Objects can be inserted into a response or accessed by the application directly. They can serve a number of purposes, but aren't something that every application needs.

A common use for objects is to store Alexa Directives, such as APL documents, that are used in multiple responses, and incorporated via a cross-reference.