Updates: Check the release notes for new features and product updates.

REST Resource: conversations.messages

Resource: Message

A message in a conversation between an agent and a user.

JSON representation
{
  "name": string,
  "messageId": string,
  "representative": {
    object (Representative)
  },
  "suggestions": [
    {
      object (Suggestion)
    }
  ],
  "fallback": string,
  "containsRichText": boolean,

  // Union field content can be only one of the following:
  "text": string,
  "image": {
    object (Image)
  },
  "richCard": {
    object (RichCard)
  }
  // End of list of possible types for union field content.
}
Fields
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, Business Messages returns an ALREADY_EXISTS error.

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.

containsRichText

boolean

Optional. If true, indicates that the message contains rich text. If the message contains invalid formatting, Business Messages returns an error.

Union field content. The content of a message. content can be only one of the following:
text

string

Text message.

image

object (Image)

Image message.

richCard

object (RichCard)

Rich Card message.

Image

An image.

JSON representation
{
  "contentInfo": {
    object (ContentInfo)
  }
}
Fields
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

string

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

thumbnailUrl

string

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

forceRefresh

boolean

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

string

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 can be only one of the following:
  "standaloneCard": {
    object (StandaloneCard)
  },
  "carouselCard": {
    object (CarouselCard)
  }
  // End of list of possible types for union field card.
}
Fields
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 (CardContent)
  }
}
Fields
cardContent

object (CardContent)

Card content.

CardContent

Card content.

JSON representation
{
  "title": string,
  "description": string,
  "media": {
    object (Media)
  },
  "suggestions": [
    {
      object (Suggestion)
    }
  ]
}
Fields
title

string

Optional. Title of the card. Maximum 200 characters.

description

string

Optional. Description of the card. Maximum 2000 characters.

media

object (Media)

Optional. Media to include in the card.

suggestions[]

object (Suggestion)

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),
  "contentInfo": {
    object (ContentInfo)
  }
}
Fields
height

enum (Height)

The height of the media within a rich card.

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 can be only one of the following:
  "reply": {
    object (SuggestedReply)
  },
  "action": {
    object (SuggestedAction)
  },
  "liveAgentRequest": {
    object (LiveAgentRequest)
  },
  "authenticationRequest": {
    object (AuthenticationRequest)
  }
  // End of list of possible types for union field option.
}
Fields
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

string

Text that is shown in the suggested reply and sent to the agent when the user taps it. Maximum 25 characters.

postbackData

string

The string that the agent receives when a user taps the suggested reply.

SuggestedAction

When tapped, initiates the corresponding native action on the device.

JSON representation
{
  "text": string,
  "postbackData": string,

  // Union field action can be only one of the following:
  "openUrlAction": {
    object (OpenUrlAction)
  },
  "dialAction": {
    object (DialAction)
  }
  // End of list of possible types for union field action.
}
Fields
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.

Union field 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

string

URL

DialAction

Opens the user's default dialer app with the specified phone number filled in.

JSON representation
{
  "phoneNumber": string
}
Fields
phoneNumber

string

Required. The specified phone number, in RFC 3966 format. For example, "+1-201-555-0123".

LiveAgentRequest

When tapped, sends a request for a live agent to join the conversation.

AuthenticationRequest

Request to authenticate a conversation.

JSON representation
{
  "oauth": {
    object (Oauth)
  }
}
Fields
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

string

Required. The ID of the application that asks for authorization.

codeChallenge

string

Required. The code challenge used to exchange access tokens.

scopes[]

string

Required. An array that specifies the scopes of the request.

codeChallengeMethod

string

Optional. The code challenge method used to generate the code challenge. If this parameter is omitted, the server assumes plain.

CarouselCard

Carousel of cards.

JSON representation
{
  "cardWidth": enum (CardWidth),
  "cardContents": [
    {
      object (CardContent)
    }
  ]
}
Fields
cardWidth

enum (CardWidth)

The width of the cards in the carousel.

cardContents[]

object (CardContent)

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

create

Sends a message from an agent to a user.