Google Apps Chat V1 Client - Class Message (0.4.0)

Reference documentation and code samples for the Google Apps Chat V1 Client class Message.

A message in a Google Chat space.

Generated from protobuf message google.chat.v1.Message

Namespace

Google \ Apps \ Chat \ V1

Methods

__construct

Constructor.

Parameters
Name Description
data array

Optional. Data for populating the Message object.

↳ name string

Resource name of the message. Format: spaces/{space}/messages/{message} Where {space} is the ID of the space where the message is posted and {message} is a system-assigned ID for the message. For example, spaces/AAAAAAAAAAA/messages/BBBBBBBBBBB.BBBBBBBBBBB. If you set a custom ID when you create a message, you can use this ID to specify the message in a request by replacing {message} with the value from the clientAssignedMessageId field. For example, spaces/AAAAAAAAAAA/messages/client-custom-name. For details, see Name a message.

↳ sender Google\Apps\Chat\V1\User

Output only. The user who created the message. If your Chat app authenticates as a user, the output populates the user name and type.

↳ create_time Google\Protobuf\Timestamp

Optional. Immutable. For spaces created in Chat, the time at which the message was created. This field is output only, except when used in import mode spaces. For import mode spaces, set this field to the historical timestamp at which the message was created in the source in order to preserve the original creation time.

↳ last_update_time Google\Protobuf\Timestamp

Output only. The time at which the message was last edited by a user. If the message has never been edited, this field is empty.

↳ delete_time Google\Protobuf\Timestamp

Output only. The time at which the message was deleted in Google Chat. If the message is never deleted, this field is empty.

↳ text string

Plain-text body of the message. The first link to an image, video, or web page generates a preview chip. You can also @mention a Google Chat user, or everyone in the space. To learn about creating text messages, see Send a text message.

↳ formatted_text string

Output only. Contains the message text with markups added to communicate formatting. This field might not capture all formatting visible in the UI, but includes the following: * Markup syntax for bold, italic, strikethrough, monospace, monospace block, and bulleted list. * User mentions using the format <users/{user}>. * Custom hyperlinks using the format <{url}|{rendered_text}> where the first string is the URL and the second is the rendered text—for example, <http://example.com|custom text>. * Custom emoji using the format :{emoji_name}:—for example, :smile:. This doesn't apply to Unicode emoji, such as U+1F600 for a grinning face emoji. For more information, see View text formatting sent in a message

↳ cards array<Google\Apps\Chat\V1\ContextualAddOnMarkup\Card>

Deprecated: Use cards_v2 instead. Rich, formatted, and interactive cards that you can use to display UI elements such as: formatted texts, buttons, and clickable images. Cards are normally displayed below the plain-text body of the message. cards and cards_v2 can have a maximum size of 32 KB.

↳ cards_v2 array<Google\Apps\Chat\V1\CardWithId>

An array of cards. Only Chat apps can create cards. If your Chat app authenticates as a user, the messages can't contain cards. To learn about cards and how to create them, see Send card messages. Card builder

↳ annotations array<Google\Apps\Chat\V1\Annotation>

Output only. Annotations associated with the text in this message.

↳ thread Google\Apps\Chat\V1\Thread

The thread the message belongs to. For example usage, see Start or reply to a message thread.

↳ space Google\Apps\Chat\V1\Space

If your Chat app authenticates as a user, the output populates the space name.

↳ fallback_text string

A plain-text description of the message's cards, used when the actual cards can't be displayed—for example, mobile notifications.

↳ action_response Google\Apps\Chat\V1\ActionResponse

Input only. Parameters that a Chat app can use to configure how its response is posted.

↳ argument_text string

Output only. Plain-text body of the message with all Chat app mentions stripped out.

↳ slash_command Google\Apps\Chat\V1\SlashCommand

Output only. Slash command information, if applicable.

↳ attachment array<Google\Apps\Chat\V1\Attachment>

User-uploaded attachment.

↳ matched_url Google\Apps\Chat\V1\MatchedUrl

Output only. A URL in spaces.messages.text that matches a link preview pattern. For more information, see Preview links.

↳ thread_reply bool

Output only. When true, the message is a response in a reply thread. When false, the message is visible in the space's top-level conversation as either the first message of a thread or a message with no threaded replies. If the space doesn't support reply in threads, this field is always false.

↳ client_assigned_message_id string

Optional. A custom ID for the message. You can use field to identify a message, or to get, delete, or update a message. To set a custom ID, specify the messageId field when you create the message. For details, see Name a message.

↳ emoji_reaction_summaries array<Google\Apps\Chat\V1\EmojiReactionSummary>

Output only. The list of emoji reaction summaries on the message.

↳ private_message_viewer Google\Apps\Chat\V1\User

Immutable. Input for creating a message, otherwise output only. The user that can view the message. When set, the message is private and only visible to the specified user and the Chat app. Link previews and attachments aren't supported for private messages. Only Chat apps can send private messages. If your Chat app authenticates as a user to send a message, the message can't be private and must omit this field. For details, see Send private messages to Google Chat users.

↳ deletion_metadata Google\Apps\Chat\V1\DeletionMetadata

Output only. Information about a deleted message. A message is deleted when delete_time is set.

↳ quoted_message_metadata Google\Apps\Chat\V1\QuotedMessageMetadata

Output only. Information about a message that's quoted by a Google Chat user in a space. Google Chat users can quote a message to reply to it.

↳ attached_gifs array<Google\Apps\Chat\V1\AttachedGif>

Output only. GIF images that are attached to the message.

↳ accessory_widgets array<Google\Apps\Chat\V1\AccessoryWidget>

One or more interactive widgets that appear at the bottom of a message. You can add accessory widgets to messages that contain text, cards, or both text and cards. Not supported for messages that contain dialogs. For details, see Add interactive widgets at the bottom of a message. Creating a message with accessory widgets requires app authentication.

getName

Resource name of the message.

Format: spaces/{space}/messages/{message} Where {space} is the ID of the space where the message is posted and {message} is a system-assigned ID for the message. For example, spaces/AAAAAAAAAAA/messages/BBBBBBBBBBB.BBBBBBBBBBB. If you set a custom ID when you create a message, you can use this ID to specify the message in a request by replacing {message} with the value from the clientAssignedMessageId field. For example, spaces/AAAAAAAAAAA/messages/client-custom-name. For details, see Name a message.

Returns
Type Description
string

setName

Resource name of the message.

Format: spaces/{space}/messages/{message} Where {space} is the ID of the space where the message is posted and {message} is a system-assigned ID for the message. For example, spaces/AAAAAAAAAAA/messages/BBBBBBBBBBB.BBBBBBBBBBB. If you set a custom ID when you create a message, you can use this ID to specify the message in a request by replacing {message} with the value from the clientAssignedMessageId field. For example, spaces/AAAAAAAAAAA/messages/client-custom-name. For details, see Name a message.

Parameter
Name Description
var string
Returns
Type Description
$this

getSender

Output only. The user who created the message.

If your Chat app authenticates as a user, the output populates the user name and type.

Returns
Type Description
Google\Apps\Chat\V1\User|null

hasSender

clearSender

setSender

Output only. The user who created the message.

If your Chat app authenticates as a user, the output populates the user name and type.

Parameter
Name Description
var Google\Apps\Chat\V1\User
Returns
Type Description
$this

getCreateTime

Optional. Immutable. For spaces created in Chat, the time at which the message was created. This field is output only, except when used in import mode spaces.

For import mode spaces, set this field to the historical timestamp at which the message was created in the source in order to preserve the original creation time.

Returns
Type Description
Google\Protobuf\Timestamp|null

hasCreateTime

clearCreateTime

setCreateTime

Optional. Immutable. For spaces created in Chat, the time at which the message was created. This field is output only, except when used in import mode spaces.

For import mode spaces, set this field to the historical timestamp at which the message was created in the source in order to preserve the original creation time.

Parameter
Name Description
var Google\Protobuf\Timestamp
Returns
Type Description
$this

getLastUpdateTime

Output only. The time at which the message was last edited by a user. If the message has never been edited, this field is empty.

Returns
Type Description
Google\Protobuf\Timestamp|null

hasLastUpdateTime

clearLastUpdateTime

setLastUpdateTime

Output only. The time at which the message was last edited by a user. If the message has never been edited, this field is empty.

Parameter
Name Description
var Google\Protobuf\Timestamp
Returns
Type Description
$this

getDeleteTime

Output only. The time at which the message was deleted in Google Chat. If the message is never deleted, this field is empty.

Returns
Type Description
Google\Protobuf\Timestamp|null

hasDeleteTime

clearDeleteTime

setDeleteTime

Output only. The time at which the message was deleted in Google Chat. If the message is never deleted, this field is empty.

Parameter
Name Description
var Google\Protobuf\Timestamp
Returns
Type Description
$this

getText

Plain-text body of the message. The first link to an image, video, or web page generates a preview chip.

You can also @mention a Google Chat user, or everyone in the space. To learn about creating text messages, see Send a text message.

Returns
Type Description
string

setText

Plain-text body of the message. The first link to an image, video, or web page generates a preview chip.

You can also @mention a Google Chat user, or everyone in the space. To learn about creating text messages, see Send a text message.

Parameter
Name Description
var string
Returns
Type Description
$this

getFormattedText

Output only. Contains the message text with markups added to communicate formatting. This field might not capture all formatting visible in the UI, but includes the following:

  • Markup syntax for bold, italic, strikethrough, monospace, monospace block, and bulleted list.

  • User mentions using the format <users/{user}>.

  • Custom hyperlinks using the format <{url}|{rendered_text}> where the first string is the URL and the second is the rendered text—for example, <http://example.com|custom text>.
  • Custom emoji using the format :{emoji_name}:—for example, :smile:. This doesn't apply to Unicode emoji, such as U+1F600 for a grinning face emoji. For more information, see View text formatting sent in a message
Returns
Type Description
string

setFormattedText

Output only. Contains the message text with markups added to communicate formatting. This field might not capture all formatting visible in the UI, but includes the following:

  • Markup syntax for bold, italic, strikethrough, monospace, monospace block, and bulleted list.

  • User mentions using the format <users/{user}>.

  • Custom hyperlinks using the format <{url}|{rendered_text}> where the first string is the URL and the second is the rendered text—for example, <http://example.com|custom text>.
  • Custom emoji using the format :{emoji_name}:—for example, :smile:. This doesn't apply to Unicode emoji, such as U+1F600 for a grinning face emoji. For more information, see View text formatting sent in a message
Parameter
Name Description
var string
Returns
Type Description
$this

getCards

Deprecated: Use cards_v2 instead.

Rich, formatted, and interactive cards that you can use to display UI elements such as: formatted texts, buttons, and clickable images. Cards are normally displayed below the plain-text body of the message. cards and cards_v2 can have a maximum size of 32 KB.

Returns
Type Description
Google\Protobuf\Internal\RepeatedField

setCards

Deprecated: Use cards_v2 instead.

Rich, formatted, and interactive cards that you can use to display UI elements such as: formatted texts, buttons, and clickable images. Cards are normally displayed below the plain-text body of the message. cards and cards_v2 can have a maximum size of 32 KB.

Parameter
Name Description
var array<Google\Apps\Chat\V1\ContextualAddOnMarkup\Card>
Returns
Type Description
$this

getCardsV2

An array of cards.

Only Chat apps can create cards. If your Chat app authenticates as a user, the messages can't contain cards. To learn about cards and how to create them, see Send card messages. Card builder

Returns
Type Description
Google\Protobuf\Internal\RepeatedField

setCardsV2

An array of cards.

Only Chat apps can create cards. If your Chat app authenticates as a user, the messages can't contain cards. To learn about cards and how to create them, see Send card messages. Card builder

Parameter
Name Description
var array<Google\Apps\Chat\V1\CardWithId>
Returns
Type Description
$this

getAnnotations

Output only. Annotations associated with the text in this message.

Returns
Type Description
Google\Protobuf\Internal\RepeatedField

setAnnotations

Output only. Annotations associated with the text in this message.

Parameter
Name Description
var array<Google\Apps\Chat\V1\Annotation>
Returns
Type Description
$this

getThread

The thread the message belongs to. For example usage, see Start or reply to a message thread.

Returns
Type Description
Google\Apps\Chat\V1\Thread|null

hasThread

clearThread

setThread

The thread the message belongs to. For example usage, see Start or reply to a message thread.

Parameter
Name Description
var Google\Apps\Chat\V1\Thread
Returns
Type Description
$this

getSpace

If your Chat app authenticates as a user, the output populates the space name.

Returns
Type Description
Google\Apps\Chat\V1\Space|null

hasSpace

clearSpace

setSpace

If your Chat app authenticates as a user, the output populates the space name.

Parameter
Name Description
var Google\Apps\Chat\V1\Space
Returns
Type Description
$this

getFallbackText

A plain-text description of the message's cards, used when the actual cards can't be displayed—for example, mobile notifications.

Returns
Type Description
string

setFallbackText

A plain-text description of the message's cards, used when the actual cards can't be displayed—for example, mobile notifications.

Parameter
Name Description
var string
Returns
Type Description
$this

getActionResponse

Input only. Parameters that a Chat app can use to configure how its response is posted.

Returns
Type Description
Google\Apps\Chat\V1\ActionResponse|null

hasActionResponse

clearActionResponse

setActionResponse

Input only. Parameters that a Chat app can use to configure how its response is posted.

Parameter
Name Description
var Google\Apps\Chat\V1\ActionResponse
Returns
Type Description
$this

getArgumentText

Output only. Plain-text body of the message with all Chat app mentions stripped out.

Returns
Type Description
string

setArgumentText

Output only. Plain-text body of the message with all Chat app mentions stripped out.

Parameter
Name Description
var string
Returns
Type Description
$this

getSlashCommand

Output only. Slash command information, if applicable.

Returns
Type Description
Google\Apps\Chat\V1\SlashCommand|null

hasSlashCommand

clearSlashCommand

setSlashCommand

Output only. Slash command information, if applicable.

Parameter
Name Description
var Google\Apps\Chat\V1\SlashCommand
Returns
Type Description
$this

getAttachment

User-uploaded attachment.

Returns
Type Description
Google\Protobuf\Internal\RepeatedField

setAttachment

User-uploaded attachment.

Parameter
Name Description
var array<Google\Apps\Chat\V1\Attachment>
Returns
Type Description
$this

getMatchedUrl

Output only. A URL in spaces.messages.text that matches a link preview pattern. For more information, see Preview links.

Returns
Type Description
Google\Apps\Chat\V1\MatchedUrl|null

hasMatchedUrl

clearMatchedUrl

setMatchedUrl

Output only. A URL in spaces.messages.text that matches a link preview pattern. For more information, see Preview links.

Parameter
Name Description
var Google\Apps\Chat\V1\MatchedUrl
Returns
Type Description
$this

getThreadReply

Output only. When true, the message is a response in a reply thread. When false, the message is visible in the space's top-level conversation as either the first message of a thread or a message with no threaded replies.

If the space doesn't support reply in threads, this field is always false.

Returns
Type Description
bool

setThreadReply

Output only. When true, the message is a response in a reply thread. When false, the message is visible in the space's top-level conversation as either the first message of a thread or a message with no threaded replies.

If the space doesn't support reply in threads, this field is always false.

Parameter
Name Description
var bool
Returns
Type Description
$this

getClientAssignedMessageId

Optional. A custom ID for the message. You can use field to identify a message, or to get, delete, or update a message. To set a custom ID, specify the messageId field when you create the message. For details, see Name a message.

Returns
Type Description
string

setClientAssignedMessageId

Optional. A custom ID for the message. You can use field to identify a message, or to get, delete, or update a message. To set a custom ID, specify the messageId field when you create the message. For details, see Name a message.

Parameter
Name Description
var string
Returns
Type Description
$this

getEmojiReactionSummaries

Output only. The list of emoji reaction summaries on the message.

Returns
Type Description
Google\Protobuf\Internal\RepeatedField

setEmojiReactionSummaries

Output only. The list of emoji reaction summaries on the message.

Parameter
Name Description
var array<Google\Apps\Chat\V1\EmojiReactionSummary>
Returns
Type Description
$this

getPrivateMessageViewer

Immutable. Input for creating a message, otherwise output only. The user that can view the message. When set, the message is private and only visible to the specified user and the Chat app. Link previews and attachments aren't supported for private messages.

Only Chat apps can send private messages. If your Chat app authenticates as a user to send a message, the message can't be private and must omit this field. For details, see Send private messages to Google Chat users.

Returns
Type Description
Google\Apps\Chat\V1\User|null

hasPrivateMessageViewer

clearPrivateMessageViewer

setPrivateMessageViewer

Immutable. Input for creating a message, otherwise output only. The user that can view the message. When set, the message is private and only visible to the specified user and the Chat app. Link previews and attachments aren't supported for private messages.

Only Chat apps can send private messages. If your Chat app authenticates as a user to send a message, the message can't be private and must omit this field. For details, see Send private messages to Google Chat users.

Parameter
Name Description
var Google\Apps\Chat\V1\User
Returns
Type Description
$this

getDeletionMetadata

Output only. Information about a deleted message. A message is deleted when delete_time is set.

Returns
Type Description
Google\Apps\Chat\V1\DeletionMetadata|null

hasDeletionMetadata

clearDeletionMetadata

setDeletionMetadata

Output only. Information about a deleted message. A message is deleted when delete_time is set.

Parameter
Name Description
var Google\Apps\Chat\V1\DeletionMetadata
Returns
Type Description
$this

getQuotedMessageMetadata

Output only. Information about a message that's quoted by a Google Chat user in a space. Google Chat users can quote a message to reply to it.

Returns
Type Description
Google\Apps\Chat\V1\QuotedMessageMetadata|null

hasQuotedMessageMetadata

clearQuotedMessageMetadata

setQuotedMessageMetadata

Output only. Information about a message that's quoted by a Google Chat user in a space. Google Chat users can quote a message to reply to it.

Parameter
Name Description
var Google\Apps\Chat\V1\QuotedMessageMetadata
Returns
Type Description
$this

getAttachedGifs

Output only. GIF images that are attached to the message.

Returns
Type Description
Google\Protobuf\Internal\RepeatedField

setAttachedGifs

Output only. GIF images that are attached to the message.

Parameter
Name Description
var array<Google\Apps\Chat\V1\AttachedGif>
Returns
Type Description
$this

getAccessoryWidgets

One or more interactive widgets that appear at the bottom of a message.

You can add accessory widgets to messages that contain text, cards, or both text and cards. Not supported for messages that contain dialogs. For details, see Add interactive widgets at the bottom of a message. Creating a message with accessory widgets requires app authentication.

Returns
Type Description
Google\Protobuf\Internal\RepeatedField

setAccessoryWidgets

One or more interactive widgets that appear at the bottom of a message.

You can add accessory widgets to messages that contain text, cards, or both text and cards. Not supported for messages that contain dialogs. For details, see Add interactive widgets at the bottom of a message. Creating a message with accessory widgets requires app authentication.

Parameter
Name Description
var array<Google\Apps\Chat\V1\AccessoryWidget>
Returns
Type Description
$this