class SpacesMessages extends Resource (View source)

The "messages" collection of methods.

Typical usage is:

 $chatService = new Google\Service\HangoutsChat(...);
 $messages = $chatService->spaces_messages;

Methods

create(string $parent, Message $postBody, array $optParams = [])

Creates a message in a Google Chat space. The maximum message size, including text and cards, is 32,000 bytes. For an example, see Send a message.

delete(string $name, array $optParams = [])

Deletes a message. For an example, see Delete a message.

get(string $name, array $optParams = [])

Returns details about a message. For an example, see Get details about a message. Requires authentication. Supports app authentication and user authentication. Note: Might return a message from a blocked member or space. (messages.get)

listSpacesMessages(string $parent, array $optParams = [])

Lists messages in a space that the caller is a member of, including messages from blocked members and spaces. For an example, see List messages. Requires user authentication. (messages.listSpacesMessages)

patch(string $name, Message $postBody, array $optParams = [])

Updates a message. There's a difference between the patch and update methods. The patch method uses a patch request while the update method uses a put request. We recommend using the patch method. For an example, see Update a message. Requires authentication. Supports app authentication and user authentication. When using app authentication, requests can only update messages created by the calling Chat app. (messages.patch)

update(string $name, Message $postBody, array $optParams = [])

Updates a message. There's a difference between the patch and update methods. The patch method uses a patch request while the update method uses a put request. We recommend using the patch method. For an example, see Update a message. Requires authentication. Supports app authentication and user authentication. When using app authentication, requests can only update messages created by the calling Chat app. (messages.update)

Details

Message create(string $parent, Message $postBody, array $optParams = [])

Creates a message in a Google Chat space. The maximum message size, including text and cards, is 32,000 bytes. For an example, see Send a message.

Calling this method requires authentication and supports the following authentication types: - For text messages, user authentication or app authentication are supported. - For card messages, only app authentication is supported. (Only Chat apps can create card messages.) (messages.create)

Parameters

string $parent

Required. The resource name of the space in which to create a message. Format: spaces/{space}

Message $postBody
array $optParams

Optional parameters.

Return Value

Message

Exceptions

Exception

ChatEmpty delete(string $name, array $optParams = [])

Deletes a message. For an example, see Delete a message.

Requires authentication. Supports app authentication and user authentication. When using app authentication, requests can only delete messages created by the calling Chat app. (messages.delete)

Parameters

string $name

Required. Resource name of the message. Format: spaces/{space}/messages/{message} If you've set a custom ID for your message, you can use the value from the clientAssignedMessageId field for {message}. For details, see [Name a message] (https://developers.google.com/workspace/chat/create- messages#name_a_created_message).

array $optParams

Optional parameters.

Return Value

ChatEmpty

Exceptions

Exception

Message get(string $name, array $optParams = [])

Returns details about a message. For an example, see Get details about a message. Requires authentication. Supports app authentication and user authentication. Note: Might return a message from a blocked member or space. (messages.get)

Parameters

string $name

Required. Resource name of the message. Format: spaces/{space}/messages/{message} If you've set a custom ID for your message, you can use the value from the clientAssignedMessageId field for {message}. For details, see [Name a message] (https://developers.google.com/workspace/chat/create- messages#name_a_created_message).

array $optParams

Optional parameters.

Return Value

Message

Exceptions

Exception

ListMessagesResponse listSpacesMessages(string $parent, array $optParams = [])

Lists messages in a space that the caller is a member of, including messages from blocked members and spaces. For an example, see List messages. Requires user authentication. (messages.listSpacesMessages)

Parameters

string $parent

Required. The resource name of the space to list messages from. Format: spaces/{space}

array $optParams

Optional parameters.

Return Value

ListMessagesResponse

Exceptions

Exception

Message patch(string $name, Message $postBody, array $optParams = [])

Updates a message. There's a difference between the patch and update methods. The patch method uses a patch request while the update method uses a put request. We recommend using the patch method. For an example, see Update a message. Requires authentication. Supports app authentication and user authentication. When using app authentication, requests can only update messages created by the calling Chat app. (messages.patch)

Parameters

string $name

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.

Message $postBody
array $optParams

Optional parameters.

Return Value

Message

Exceptions

Exception

Message update(string $name, Message $postBody, array $optParams = [])

Updates a message. There's a difference between the patch and update methods. The patch method uses a patch request while the update method uses a put request. We recommend using the patch method. For an example, see Update a message. Requires authentication. Supports app authentication and user authentication. When using app authentication, requests can only update messages created by the calling Chat app. (messages.update)

Parameters

string $name

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.

Message $postBody
array $optParams

Optional parameters.

Return Value

Message

Exceptions

Exception