Resource: Message
A message in a conversation between an agent and a user.
JSON representation |
---|
{ "name" : string , "messageId" : string , "representative" : { object ( |
name
string
The name of the message, as set by Business Messages. Resolves to "conversations/{conversationId}/messages/{messageId}", where {conversationId} is the unique ID for the conversation and {messageId} is the unique ID for the message.
messageId
string
Required. The unique identifier of the message, assigned by the agent. If a message attempts to use the same messageId
as a previous message, the proper delivery of the message could be affected.
representative
object (
Representative
)
Details about the representative (human or chatbot) that sent the message.
suggestions[]
object (
Suggestion
)
A list of suggested replies that appear as a list of suggestion chips following the associated message. Maximum 13 suggestions.
The chips only display when the associated message is the most recent message within the conversation (including both agent and user messages). The user can tap a suggested reply to send the text reply to the agent.
fallback
string
Optional. Fallback text that displays if the user's device doesn't support the message type or content. Maximum 3,072 characters.
containsRichText
boolean
Optional. If true
, indicates that the message contains rich text. If the message contains invalid formatting, Business Messages returns an error.
content
. The content of a message. content
can be only one of the following:text
string
Text message. Maximum 3,072 characters.
image
object (
Image
)
Image message.
richCard
object (
RichCard
)
Rich Card message.
Image
An image.
JSON representation |
---|
{ // Union field |
content
. Image content. content
can be only one of the following:contentInfo
object (
ContentInfo
)
Information about an image, including the URL of the image and the URL of the image's thumbnail.
ContentInfo
Message containing the content information.
JSON representation |
---|
{ "fileUrl" : string , "thumbnailUrl" : string , "forceRefresh" : boolean , "altText" : string } |
Fields | |
---|---|
fileUrl
|
Publicly reachable URL of the file. The platform determines the MIME type of the file from the content-type field in the HTTP headers when the platform fetches the file. The content-type field must be present and accurate in the HTTP response from the URL. Maximum 5 MB. Supported content types: image/jpeg, image/jpg, image/png, image/webp |
thumbnailUrl
|
Optional. Publicly reachable URL of the thumbnail. If you don't provide a thumbnail URL, the platform displays a blank placeholder thumbnail until the user's device downloads the file. Maximum 25 KB. Supported content types: image/jpeg, image/jpg, image/png, image/webp |
forceRefresh
|
If set, the platform fetches the file and thumbnail from the specified URLs, even if the platform has cached copies of the file (and/or of the thumbnail). |
altText
|
Text describing the details about the media for accessibility purposes. |
RichCard
A standalone rich card or a carousel of rich cards sent from the agent to the user.
JSON representation |
---|
{ // Union field |
card
. Possible types of rich cards. card
can be only one of the following:standaloneCard
object (
StandaloneCard
)
Standalone card.
carouselCard
object (
CarouselCard
)
Carousel of cards.
StandaloneCard
Standalone card.
JSON representation |
---|
{
"cardContent"
:
{
object (
|
Fields | |
---|---|
cardContent
|
Card content. |
CardContent
Card content.
JSON representation |
---|
{ "title" : string , "description" : string , "media" : { object ( |
Fields | |
---|---|
title
|
Optional. Title of the card. Maximum 200 characters. |
description
|
Optional. Description of the card. Maximum 2,000 characters. |
media
|
Optional. Media to include in the card. |
suggestions[]
|
Optional. List of suggestions to include in the card. Maximum 4 suggestions. |
Media
A media file within a rich card.
JSON representation |
---|
{ "height" : enum ( |
height
enum (
Height
)
The height of the media within a rich card.
content
. Media content. content
can be only one of the following:contentInfo
object (
ContentInfo
)
Information about a file, including the URL of the file and the URL of the file's thumbnail.
Height
Media height
Enums | |
---|---|
HEIGHT_UNSPECIFIED
|
Not specified. |
SHORT
|
112 DP. |
MEDIUM
|
168 DP. |
TALL
|
264 DP. Not available for rich card carousels when the card width is set to SMALL
. |
Suggestion
A suggestion within a chip list.
JSON representation |
---|
{ // Union field |
option
. A suggested reply. option
can be only one of the following:reply
object (
SuggestedReply
)
A suggestion for the user to reply with specified text.
action
object (
SuggestedAction
)
A suggested action that initiates a native action on the device.
liveAgentRequest
object (
LiveAgentRequest
)
A request to have a live agent join the conversation.
authenticationRequest
object (
AuthenticationRequest
)
A request to start authentication flow.
SuggestedReply
When tapped, sends the text reply back to the agent.
JSON representation |
---|
{ "text" : string , "postbackData" : string } |
Fields | |
---|---|
text
|
Text that is shown in the suggested reply and sent to the agent when the user taps it. Maximum 25 characters. |
postbackData
|
The string that the agent receives when a user taps the suggested reply. Maximum 2,048 characters. |
SuggestedAction
When tapped, initiates the corresponding native action on the device.
JSON representation |
---|
{ "text" : string , "postbackData" : string , // Union field |
text
string
Text that is shown in the suggested action. Maximum 25 characters.
postbackData
string
The string that the agent receives when a user taps the suggested action. Maximum 2,048 characters.
action
. The native action initiated on the device when the user taps the suggested action. action
can be only one of the following:openUrlAction
object (
OpenUrlAction
)
Opens the specified URL.
dialAction
object (
DialAction
)
Opens the user's default dialer app.
OpenUrlAction
Opens the specified URL.
JSON representation |
---|
{ "url" : string } |
Fields | |
---|---|
url
|
URL |
DialAction
Opens the user's default dialer app with the specified phone number filled in.
JSON representation |
---|
{ "phoneNumber" : string } |
Fields | |
---|---|
phoneNumber
|
Required. The specified phone number, in RFC 3966 format. For example, "+1-201-555-0123". |
LiveAgentRequest
This type has no fields.
When tapped, sends a request for a live agent to join the conversation.
AuthenticationRequest
Request to authenticate a conversation.
JSON representation |
---|
{ // Union field |
authentication_type
. The authentication type. authentication_type
can be only one of the following:oauth
object (
Oauth
)
Details for authentication via OAuth.
Oauth
Details for authentication via OAuth.
JSON representation |
---|
{ "clientId" : string , "codeChallenge" : string , "scopes" : [ string ] , "codeChallengeMethod" : string } |
Fields | |
---|---|
clientId
|
Required. The ID of the application that asks for authorization. |
codeChallenge
|
Required. The code challenge used to exchange access tokens. |
scopes[]
|
Required. An array that specifies the scopes of the request. |
codeChallengeMethod
|
Optional. The code challenge method
used to generate the code challenge. If this parameter is omitted, the server assumes |
CarouselCard
Carousel of cards.
JSON representation |
---|
{ "cardWidth" : enum ( |
Fields | |
---|---|
cardWidth
|
The width of the cards in the carousel. |
cardContents[]
|
The list of contents for each card in the carousel. A carousel can have a minimum of 2 cards and a maximum 10 cards. |
CardWidth
The width of the cards in the carousel.
Enums | |
---|---|
CARD_WIDTH_UNSPECIFIED
|
Not specified |
SMALL
|
136 DP. Can't include tall media. |
MEDIUM
|
280 DP. |
Methods |
|
---|---|
|
Sends a message from an agent to a user. |
|
Sends a receipt for a message from an agent to a user. |