In-app UI
Message types
Schema reference

Message types schema reference

Learn more about the schema and available fields for message types.

A message type schema defines the fields that a message type will have in the template editor and forms the structure of the message contents returned by the guides API.

An example schema is shown below:

Variants

#

Your schema must have one or more variants. Each of these variants must have:

  • A key uniquely identifying the variant for the message type
  • A name to display in the message template editor to select the variant
  • One or more fields (see below)

Every schema must define a variant with the key "default". You can name your variants anything you would like, but the variant key must be unique.

Fields

#

All fields must have:

  • type: The type of the field to render (see below)
  • key: A unique key for the field in the variant
  • label: A label to render

Field types

#

Text

#

A plain text, single line text field.

Settings

#
requiredboolean

Indicates this field is required

descriptionstring

An optional friendly description

defaultstring

The default value to display

minLengthinteger

The minimum length to validate

maxLengthinteger

The maximum length to validate against

Example

Markdown

#

A markdown editor for creating rich text. Will always be rendered as HTML.

Settings

#
requiredboolean

Indicates this field is required

descriptionstring

An optional friendly description

defaultstring

The default value to display

Example

#

Textarea

#

A multi-line plain text area

Settings

#
requiredboolean

Indicates this field is required

descriptionstring

An optional friendly description

defaultstring

The default value to display

minLengthinteger

The minimum length to validate

maxLengthinteger

The maximum length to validate against

Example

#

Boolean

#

A checkbox that returns either true or false (checked or unchecked).

Settings

#
requiredboolean

Indicates this field is required

descriptionstring

An optional friendly description

defaultboolean

The default value to set

Example

#

Select

#

A single select box that defines a static list of options for editors to pick from.

Settings

#
optionsobject[]

A list of option objects that must include a label and a value

requiredboolean

Indicates this field is required

defaultstring

The value of the default option to set

Example

#

Usage

#

In your template preview, you can access the value of the selected option using the field's key. For example:

Multi-select

#

A multi-select box that defines a static list of options for editors to pick from.

Settings

#
optionsobject[]

A list of option objects that must include a label and a value

requiredboolean

Indicates this field is required

defaultstring[]

The values of the default options to set

Example

#

Usage

#

In your template preview, you can access the selected values using the field's key. For example:

Button

#

A button, with text to display and an action to perform when clicked.

Every button field contains two subfields:

textstring

A text field that represents the button's text

actionstring

A text field that represents the button's action

Settings

#
requiredboolean

Indicates this field is required

descriptionstring

An optional friendly description

Example

#

URL

#

Settings

#
requiredboolean

Indicates this field is required

descriptionstring

An optional friendly description

defaultstring

The default URL to display

Example

#

Image

#

An image field, used to display an image with alt text and an optional action to perform when clicked.

Every image field contains three subfields:

urlstring

A URL field that represents the source of the image to be displayed

altstring

A text field that represents the image's alt text

actionstring

An optional text field that represents an action to perform when the image is clicked

Settings

#
requiredboolean

Indicates this field is required

descriptionstring

An optional friendly description

Example

#