Messages can be sent as different types,
allowing for the display to match the message payload.
You can send messages as basic
, template
, minimal
, or form
type.
You may see an additional system
type in some responses.
system
type is reserved for internal use for sending messages.
This article gives a brief overview of each of the message types
and how to structure the message
object in your
sendMessage()
request.
basic
messages contain an array of text
, image
, or file
.
Array items are displayed in Inbox and the visitor's chat widget
as if each item was a separate message.
This example contains an image followed by two text messages:
The above example produces this output:
Inbox | Chat Widget |
---|---|
form
messages present form data submitted by the participant.
Form messages contain a title
, an optional description
,
and an array of fields
.
Each field in the array has a name
and submitted value
property.
Form messages are typically sent with a direction of PARTICIPANT_TO_BUSINESS
.
To hide the message from the visitor, set visibility
to BUSINESS
.
This example contains 4 form fields and an image:
The above example is not displayed in the visitor's chat widget
because visibility
is set to BUSINESS
.
It produces this output in Inbox:
Inbox |
---|
minimal
messages contain a single line of text and an optional icon.
They're useful for reporting an activity that took place.
To hide the message from the visitor, set visibility
to BUSINESS
.
This example reports that the visitor made a spa appointment:
The above example is not displayed in the visitor's chat widget
because visibility
is set to BUSINESS
.
It produces this output in Inbox:
Inbox |
---|
template
messages use buttons to allow the visitor to perform actions.
Buttons can be either ACTION
or POSTBACK
type.
Action buttons open a specified url
in the visitor's browser,
and postback buttons pass a buttonPayload
to the
Message Button Interacted.
This example tells the visitor their spa appointment has been booked and offers two buttons. The first is an action button, and the second is a postback button:
The above example produces this output:
Inbox | Chat Widget |
---|---|
system
messages convey system information from an integrated service
such as Facebook or Instagram.
System messages cannot be sent through the API. However, you may still need to consume system messages.
This example payload contains text and a "Learn More" link:
The above example produces this output:
Inbox |
---|