Chat message structure for API's
Chat Messages
Chatlayer.ai supports different types of chat messages, each with his own object structure. Chat messages can be sent
As a response from the API plugin
From your webhook to Chatlayer.ai
Each message has two mandatory fields:
type: the messages type (carousel, buttons, list, media, text, …)
config: the message configuration
Text Messages
A text message includes an array of text messages.
Request format
Configuration object
Property
type
Description
textMessages
Array
A list of text message objects
Text message object
Property
type
Description
text
String
A text message
Button template
A button template includes an array of buttons and an array of text messages. A button can have three types
postback: redirects the user to a new dialog state. It is possible to save key values in the user session.
web_url: opens the website for this url.
phone_number: starts a telephone call.
Request format
Configuration object
Property
type
Description
textMessages
Array
A list of text message objects
buttons
Array
A list of button objects
Text message object
Property
type
Description
text
String
A text message
Button object
Property
type
Description
title
String
Title
type
String
Button type: postback / web_url / call
payload (only for type postback and phone_number)
String for type phone_number
Object for type
The button payload. An object with next dialog state and parameter key/value combinations for type postback. A telephone number for type phone_number.
url (only for type web_url)
String
The website url to open
call (only for type phone_number)
String
The phone number to call
Payload object for type postback
Property
type
Description
nextDialogstateId
String
Redirect the user to this dialog state
params
Array
A list of parameter objects. A parameter object has a key and value property
Quick replies template
A quick replies template includes an list of quick replies and a list of text messages.
Request format
Configuration object
Property
type
Description
textMessages
Array
A list of text message objects
quickReplies
Array
A list of quick reply objects
Text message object
Property
type
Description
text
String
A text message
Quick reply object
Property
type
Description
title
String
Title
type
String
Quick reply type: postback / location
payload
Object
The payload object with a next dialog state
imageUrl
String
The quick reply icon url
Payload object
Property
type
Description
nextDialogstateId
String
Redirect the user to this dialog state
params
Array
A list of parameter objects. A parameter object has a key and value property
Carousel
A carousel includes a list of carousel elements.
Request format
Configuration object
Property
type
Description
elements
Array
A list of carousel elements
Carousel element object
Property
type
Description
title
String
Title
subTitle
String
Subtitle
webUrl
String
The url to redirect the user to when a carousel element is tapped
imageUrl
String
The url of the carousel element image
buttons
Array
A list of buttons
Button object
Property
type
Description
title
String
Title
type
String
Button type: postback / web_url / call
payload (only for type postback and phone_number)
String for type phone_number
Object for type
The button payload. An object with next dialog state and parameter key/value combinations for type postback. A telephone number for type phone_number.
url (only for type web_url)
String
The website url to open
call (only for type phone_number)
String
The phone number to call
Payload object for type postback
Property
type
Description
nextDialogstateId
String
Redirect the user to this dialog state
params
Array
A list of parameter objects. A parameter object has a key and value property
Media
Media supports three types:
image
video
audio
Request format
Configuration object
Property
type
Description
media
Media object
A media object
Media object
Property
type
Description
isCache
Boolean
A flag to indicate if the media should be cached for performance optimization.
type
String
The media type: video / audio / image
url
String
The media url
Last updated
Was this helpful?