Docs
/
/

Message types Management API reference

Complete reference documentation for the Message types resource.

Message types

#

A message type is a schema for a message that maps to a UI component or element within your application.

List message types

#

Returns a paginated list of message types available in a given environment.

Endpoint

GET/v1/message_types

Query parameters

environment
string

The environment slug.

branch
string

The slug of a branch to use. This option can only be used when environment is "development".

annotate
boolean

Whether to annotate the resource. Only used in the Knock CLI.

hide_uncommitted_changes
boolean

Whether to hide uncommitted changes. When true, only committed changes will be returned. When false, both committed and uncommitted changes will be returned.

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

limit
integer

The number of entries to fetch per-page.

Returns

PaginatedMessageTypeResponse

A paginated list of MessageType. Contains a list of entries and page information.

A list of entries.

archived_at
string(date-time)

The timestamp of when the message type was deleted.

created_at
string(date-time)
Required

The timestamp of when the message type was created.

deleted_at
string(date-time)

The timestamp of when the message type was deleted.

description
string

An arbitrary string attached to a message type object. Useful for adding notes about the message type for internal purposes. Maximum of 280 characters allowed.

environment
string
Required

The environment of the message type.

icon_name
string

The icon name of the message type.

key
string
Required

The unique key string for the message type object. Must be at minimum 3 characters and at maximum 255 characters in length. Must be in the format of ^[a-z0-9_-]+$.

name
string
Required

A name for the message type. Must be at maximum 255 characters in length.

owner
enum(string)
Required

The owner of the message type.

systemuser
preview
string
Required

An HTML/liquid template for the message type preview.

semver
string
Required

The semantic version of the message type.

sha
string
Required

The SHA hash of the message type.

updated_at
string(date-time)
Required

The timestamp of when the message type was last updated.

valid
boolean
Required

Whether the message type is valid.

variantsRequired

The variants of the message type.

fields
object[]
Required

The field types available for the variant.

key
string
Required

The unique key string for the variant. Must be at minimum 3 characters and at maximum 255 characters in length. Must be in the format of ^[a-z0-9_-]+$.

name
string
Required

A name for the variant. Must be at maximum 255 characters in length.

page_info

The information about a paginated result.

after
string

The cursor to fetch entries after. Will only be present if there are more entries to fetch.

before
string

The cursor to fetch entries before. Will only be present if there are more entries to fetch before the current page.

page_size
integer

The number of entries to fetch per-page.

Get message type

#

Retrieve a message type by its key, in a given environment.

Endpoint

GET/v1/message_types/{message_type_key}

Path parameters

message_type_key
string

The key of the message type to retrieve.

Query parameters

environment
string

The environment slug.

branch
string

The slug of a branch to use. This option can only be used when environment is "development".

annotate
boolean

Whether to annotate the resource. Only used in the Knock CLI.

hide_uncommitted_changes
boolean

Whether to hide uncommitted changes. When true, only committed changes will be returned. When false, both committed and uncommitted changes will be returned.

Returns

A message type is a schema for a message that maps to a UI component or element within your application.

archived_at
string(date-time)

The timestamp of when the message type was deleted.

created_at
string(date-time)

The timestamp of when the message type was created.

deleted_at
string(date-time)

The timestamp of when the message type was deleted.

description
string

An arbitrary string attached to a message type object. Useful for adding notes about the message type for internal purposes. Maximum of 280 characters allowed.

environment
string

The environment of the message type.

icon_name
string

The icon name of the message type.

key
string

The unique key string for the message type object. Must be at minimum 3 characters and at maximum 255 characters in length. Must be in the format of ^[a-z0-9_-]+$.

name
string

A name for the message type. Must be at maximum 255 characters in length.

owner
enum(string)

The owner of the message type.

systemuser
preview
string

An HTML/liquid template for the message type preview.

semver
string

The semantic version of the message type.

sha
string

The SHA hash of the message type.

updated_at
string(date-time)

The timestamp of when the message type was last updated.

valid
boolean

Whether the message type is valid.

The variants of the message type.

fields
object[]
Required

The field types available for the variant.

key
string
Required

The unique key string for the variant. Must be at minimum 3 characters and at maximum 255 characters in length. Must be in the format of ^[a-z0-9_-]+$.

name
string
Required

A name for the variant. Must be at maximum 255 characters in length.

Upsert message type

#

Updates a message type, or creates a new one if it does not yet exist.

Note: this endpoint only operates in the development environment.

Endpoint

PUT/v1/message_types/{message_type_key}

Path parameters

message_type_key
string

The key of the message type to upsert.

Query parameters

environment
string

The environment slug.

branch
string

The slug of a branch to use. This option can only be used when environment is "development".

annotate
boolean

Whether to annotate the resource. Only used in the Knock CLI.

commit
boolean

Whether to commit the resource at the same time as modifying it.

commit_message
string

The message to commit the resource with, only used if commit is true.

Request body

message_type
MessageTypeRequest

A request to create a message type.

description
string
Required

An arbitrary string attached to a message type object. Useful for adding notes about the message type for internal purposes. Maximum of 280 characters allowed.

icon_name
string

The icon name of the message type.

name
string
Required

A name for the message type. Must be at maximum 255 characters in length.

preview
string
Required

An HTML/liquid template for the message type preview.

semver
string

The semantic version of the message type.

The variants of the message type.

fields
object[]
Required

The field types available for the variant.

key
string
Required

The unique key string for the variant. Must be at minimum 3 characters and at maximum 255 characters in length. Must be in the format of ^[a-z0-9_-]+$.

name
string
Required

A name for the variant. Must be at maximum 255 characters in length.

Returns

WrappedMessageTypeResponse

Wraps the MessageType response under the message_type key.

message_type

A message type is a schema for a message that maps to a UI component or element within your application.

archived_at
string(date-time)

The timestamp of when the message type was deleted.

created_at
string(date-time)

The timestamp of when the message type was created.

deleted_at
string(date-time)

The timestamp of when the message type was deleted.

description
string

An arbitrary string attached to a message type object. Useful for adding notes about the message type for internal purposes. Maximum of 280 characters allowed.

environment
string

The environment of the message type.

icon_name
string

The icon name of the message type.

key
string

The unique key string for the message type object. Must be at minimum 3 characters and at maximum 255 characters in length. Must be in the format of ^[a-z0-9_-]+$.

name
string

A name for the message type. Must be at maximum 255 characters in length.

owner
enum(string)

The owner of the message type.

systemuser
preview
string

An HTML/liquid template for the message type preview.

semver
string

The semantic version of the message type.

sha
string

The SHA hash of the message type.

updated_at
string(date-time)

The timestamp of when the message type was last updated.

valid
boolean

Whether the message type is valid.

The variants of the message type.

fields
object[]
Required

The field types available for the variant.

key
string
Required

The unique key string for the variant. Must be at minimum 3 characters and at maximum 255 characters in length. Must be in the format of ^[a-z0-9_-]+$.

name
string
Required

A name for the variant. Must be at maximum 255 characters in length.

Validate message type

#

Validates a message type payload without persisting it.

Note: this endpoint only operates on message types in the development environment.

Endpoint

PUT/v1/message_types/{message_type_key}/validate

Path parameters

message_type_key
string

The key of the message type to validate.

Query parameters

environment
string

The environment slug.

branch
string

The slug of a branch to use. This option can only be used when environment is "development".

Request body

message_type
MessageTypeRequest

A request to create a message type.

description
string
Required

An arbitrary string attached to a message type object. Useful for adding notes about the message type for internal purposes. Maximum of 280 characters allowed.

icon_name
string

The icon name of the message type.

name
string
Required

A name for the message type. Must be at maximum 255 characters in length.

preview
string
Required

An HTML/liquid template for the message type preview.

semver
string

The semantic version of the message type.

The variants of the message type.

fields
object[]
Required

The field types available for the variant.

key
string
Required

The unique key string for the variant. Must be at minimum 3 characters and at maximum 255 characters in length. Must be in the format of ^[a-z0-9_-]+$.

name
string
Required

A name for the variant. Must be at maximum 255 characters in length.

Returns

WrappedMessageTypeResponse

Wraps the MessageType response under the message_type key.

message_type

A message type is a schema for a message that maps to a UI component or element within your application.

archived_at
string(date-time)

The timestamp of when the message type was deleted.

created_at
string(date-time)

The timestamp of when the message type was created.

deleted_at
string(date-time)

The timestamp of when the message type was deleted.

description
string

An arbitrary string attached to a message type object. Useful for adding notes about the message type for internal purposes. Maximum of 280 characters allowed.

environment
string

The environment of the message type.

icon_name
string

The icon name of the message type.

key
string

The unique key string for the message type object. Must be at minimum 3 characters and at maximum 255 characters in length. Must be in the format of ^[a-z0-9_-]+$.

name
string

A name for the message type. Must be at maximum 255 characters in length.

owner
enum(string)

The owner of the message type.

systemuser
preview
string

An HTML/liquid template for the message type preview.

semver
string

The semantic version of the message type.

sha
string

The SHA hash of the message type.

updated_at
string(date-time)

The timestamp of when the message type was last updated.

valid
boolean

Whether the message type is valid.

The variants of the message type.

fields
object[]
Required

The field types available for the variant.

key
string
Required

The unique key string for the variant. Must be at minimum 3 characters and at maximum 255 characters in length. Must be in the format of ^[a-z0-9_-]+$.

name
string
Required

A name for the variant. Must be at maximum 255 characters in length.

MessageType

#

A message type is a schema for a message that maps to a UI component or element within your application.

Attributes

archived_at
string(date-time)

The timestamp of when the message type was deleted.

created_at
string(date-time)

The timestamp of when the message type was created.

deleted_at
string(date-time)

The timestamp of when the message type was deleted.

description
string

An arbitrary string attached to a message type object. Useful for adding notes about the message type for internal purposes. Maximum of 280 characters allowed.

environment
string

The environment of the message type.

icon_name
string

The icon name of the message type.

key
string

The unique key string for the message type object. Must be at minimum 3 characters and at maximum 255 characters in length. Must be in the format of ^[a-z0-9_-]+$.

name
string

A name for the message type. Must be at maximum 255 characters in length.

owner
enum(string)

The owner of the message type.

systemuser
preview
string

An HTML/liquid template for the message type preview.

semver
string

The semantic version of the message type.

sha
string

The SHA hash of the message type.

updated_at
string(date-time)

The timestamp of when the message type was last updated.

valid
boolean

Whether the message type is valid.

The variants of the message type.

fields
object[]
Required

The field types available for the variant.

key
string
Required

The unique key string for the variant. Must be at minimum 3 characters and at maximum 255 characters in length. Must be in the format of ^[a-z0-9_-]+$.

name
string
Required

A name for the variant. Must be at maximum 255 characters in length.

MessageTypeVariant

#

A variant of a message type.

Attributes

fields
object[]

The field types available for the variant.

key
string

The unique key string for the variant. Must be at minimum 3 characters and at maximum 255 characters in length. Must be in the format of ^[a-z0-9_-]+$.

name
string

A name for the variant. Must be at maximum 255 characters in length.

MessageTypeTextField

#

A text field used in a message type.

Attributes

key
string

The unique key of the field.

label
string

The label of the field.

settings
object

Settings for the text field.

default
string

The default value of the text field.

description
string
max_length
integer
min_length
integer
required
boolean

Whether the field is required.

type
enum(string)

The type of the field.

text
New chat