Google Chat API (chat:v1)

2023-05-17

12 new methods | 3 updated methods

Additions

    Methods
  • chat.spaces.create

      Parameters :

        requestId

          Location : query

          Type : string

          Description : Optional. A unique identifier for this request. A random UUID is recommended. Specifying an existing request ID returns the space created with that ID instead of creating a new space. Specifying an existing request ID from the same Chat app with a different authenticated user returns an error.

      Flat Path : v1/spaces

      Scopes :

    • https://www.googleapis.com/auth/chat.spaces
    • https://www.googleapis.com/auth/chat.spaces.create
    • HTTP Method : POST

      Path : v1/spaces

      Description : [Developer Preview](https://developers.google.com/workspace/preview): Creates a named space. Spaces grouped by topics or that have guest access are not supported. Requires [user authentication](https://developers.google.com/chat/api/guides/auth/users) and the `chat.spaces.create` or `chat.spaces` scope.

  • chat.spaces.findDirectMessage

      Scopes :

    • https://www.googleapis.com/auth/chat.bot
    • https://www.googleapis.com/auth/chat.spaces
    • https://www.googleapis.com/auth/chat.spaces.readonly
    • Parameters :

        name

          Description : Required. Resource name of the user to find direct message with. Format: users/{user}, where `{user}` is either the `{person_id}` for the [person](https://developers.google.com/people/api/rest/v1/people) from the People API, or the `id` for the [user](https://developers.google.com/admin-sdk/directory/reference/rest/v1/users) in the Admin SDK Directory API. For example, if the People API `Person.resourceName` is `people/123456789`, you can find a direct message with that person by using `users/123456789` as the `name`.

          Type : string

          Location : query

      HTTP Method : GET

      Description : [Developer Preview](https://developers.google.com/workspace/preview): Returns the existing direct message with the specified user. With [user authentication](https://developers.google.com/chat/api/guides/auth/users), returns the direct message space between the specified user and the authenticated user. With [service account authentication](https://developers.google.com/chat/api/guides/auth/service-accounts), returns the direct message space between the specified user and the calling Chat app. If no direct message space is found, returns a `404 NOT_FOUND` error. Requires [user authentication](https://developers.google.com/chat/api/guides/auth/users) or [service account authentication](https://developers.google.com/chat/api/guides/auth/service-accounts).

      Path : v1/spaces:findDirectMessage

      Flat Path : v1/spaces:findDirectMessage

  • chat.spaces.patch

      Parameters :

        updateMask

          Type : string

          Location : query

          Format : google-fieldmask

          Description : Required. The field paths to be updated, comma separated if there are multiple. Currently supported field paths: - display_name (Only supports changing the display name of a space with the SPACE type, or when also including the `space_type` mask to change a GROUP_CHAT space type to SPACE. Trying to update the display name of a GROUP_CHAT or a DIRECT_MESSAGE space results in an invalid argument error.) - space_type (Only supports changing a GROUP_CHAT space type to SPACE. Include `display_name` together with `space_type` in the update mask and ensure that the specified space has a non-empty display name and the SPACE space type. Including the `space_type` mask and the SPACE type in the specified space when updating the display name is optional if the existing space already has the SPACE type. Trying to update the space type in other ways results in an invalid argument error). - space_details - space_history_state (Supports [turning history on or off for the space](https://support.google.com/chat/answer/7664687) if [the organization allows users to change their history setting](https://support.google.com/a/answer/7664184). Warning: mutually exclusive with all other field paths.)

        name

          Description : Resource name of the space. Format: spaces/{space}

          Location : path

          Pattern : ^spaces/[^/]+$

          Type : string

          Required : Yes

      Path : v1/{+name}

      Parameter Order : name

      Description : [Developer Preview](https://developers.google.com/workspace/preview): Updates a space. Requires [user authentication](https://developers.google.com/chat/api/guides/auth/users) and the `chat.spaces` scope.

      Flat Path : v1/spaces/{spacesId}

      HTTP Method : PATCH

      Scopes : https://www.googleapis.com/auth/chat.spaces

  • chat.spaces.setup

      Description : [Developer Preview](https://developers.google.com/workspace/preview): Creates a space and adds specified users to it. The calling user is automatically added to the space, and shouldn't be specified as a membership in the request. To specify the human members to add, add memberships with the appropriate `member.name` in the `SetUpSpaceRequest`. To add a human user, use `users/{user}`, where `{user}` is either the `{person_id}` for the [person](https://developers.google.com/people/api/rest/v1/people) from the People API, or the `id` for the [user](https://developers.google.com/admin-sdk/directory/reference/rest/v1/users) in the Admin SDK Directory API. For example, if the People API `Person` `resourceName` is `people/123456789`, you can add the user to the space by including a membership with `users/123456789` as the `member.name`. For a space or group chat, if the caller blocks or is blocked by some members, then those members aren't added to the created space. To create a direct message (DM) between the calling user and another human user, specify exactly one membership to represent the human user. If one user blocks the other, the request fails and the DM isn't created. To create a DM between the calling user and the calling app, set `Space.singleUserBotDm` to true and don't specify any memberships. You can only use this method to add app memberships to DMs. To add the calling app as a member of other space types, use [create membership](https://developers.google.com/chat/api/reference/rest/v1/spaces.members/create) If a DM already exists between two users, even when one user blocks the other at the time a request is made, then the existing DM is returned. Spaces with threaded replies or guest access are not supported. Requires [user authentication](https://developers.google.com/chat/api/guides/auth/users) and the `chat.spaces.create` or `chat.spaces` scope.

      Flat Path : v1/spaces:setup

      Scopes :

    • https://www.googleapis.com/auth/chat.spaces
    • https://www.googleapis.com/auth/chat.spaces.create
    • HTTP Method : POST

      Path : v1/spaces:setup

  • chat.spaces.delete

      Scopes : https://www.googleapis.com/auth/chat.delete

      Parameters :

        name

          Description : Required. Resource name of the space to delete. Format: spaces/{space}

          Type : string

          Required : Yes

          Pattern : ^spaces/[^/]+$

          Location : path

      Path : v1/{+name}

      HTTP Method : DELETE

      Flat Path : v1/spaces/{spacesId}

      Parameter Order : name

      Description : [Developer Preview](https://developers.google.com/workspace/preview): Deletes a named space. Always performs a cascading delete, which means that the space's child resources - like messages posted in the space and memberships in the space - are also deleted. Requires [user authentication](https://developers.google.com/chat/api/guides/auth/users) from a user who has permission to delete the space, and the `chat.delete` scope.

  • chat.spaces.members.delete

      HTTP Method : DELETE

      Parameters :

        name

          Description : Required. Resource name of the membership to delete. Chat apps can delete human users' or their own memberships. Chat apps can't delete other apps' memberships. When deleting a human membership, requires the `chat.memberships` scope and `spaces/{space}/members/{member}` format. When deleting an app membership, requires the `chat.memberships.app` scope and `spaces/{space}/members/app` format. Format: spaces/{space}/members/{member} or spaces/{space}/members/app

          Type : string

          Required : Yes

          Location : path

          Pattern : ^spaces/[^/]+/members/[^/]+$

      Scopes :

    • https://www.googleapis.com/auth/chat.memberships
    • https://www.googleapis.com/auth/chat.memberships.app
    • Path : v1/{+name}

      Description : [Developer Preview](https://developers.google.com/workspace/preview): Deletes a membership. Requires [user authentication](https://developers.google.com/chat/api/guides/auth/users) and the `chat.memberships` or `chat.memberships.app` authorization scope.

      Flat Path : v1/spaces/{spacesId}/members/{membersId}

      Parameter Order : name

  • chat.spaces.members.create

      Parameters :

        parent

          Type : string

          Location : path

          Description : Required. The resource name of the space for which to create the membership. Format: spaces/{space}

          Required : Yes

          Pattern : ^spaces/[^/]+$

      Flat Path : v1/spaces/{spacesId}/members

      HTTP Method : POST

      Scopes :

    • https://www.googleapis.com/auth/chat.memberships
    • https://www.googleapis.com/auth/chat.memberships.app
    • Parameter Order : parent

      Path : v1/{+parent}/members

      Description : [Developer Preview](https://developers.google.com/workspace/preview): Creates a human membership or app membership for the calling app. Creating memberships for other apps is not supported. Requires [user authentication](https://developers.google.com/chat/api/guides/auth/users) and the `chat.memberships` (for human membership) or `chat.memberships.app` (for app membership) scope. To specify the member to add, set the `membership.member.name` in the `CreateMembershipRequest`: - To add the calling app to the space, use `users/app`. - To add a human user, use `users/{user}`, where `{user}` is either the `{person_id}` for the [person](https://developers.google.com/people/api/rest/v1/people) from the People API, or the `id` for the [user](https://developers.google.com/admin-sdk/directory/reference/rest/v1/users) in the Admin SDK Directory API. For example, if the People API `Person` `resourceName` is `people/123456789`, the user can be added to the space by setting the `membership.member.name` to `users/123456789`.

  • chat.spaces.messages.list

      Parameter Order : parent

      Scopes :

    • https://www.googleapis.com/auth/chat.messages
    • https://www.googleapis.com/auth/chat.messages.readonly
    • Path : v1/{+parent}/messages

      Flat Path : v1/spaces/{spacesId}/messages

      Parameters :

        showDeleted

          Location : query

          Description : Whether to include deleted messages. Deleted messages include deleted time and metadata about their deletion, but message content is unavailable.

          Type : boolean

        pageSize

          Type : integer

          Description : The maximum number of messages returned. The service may return fewer messages than this value. If unspecified, at most 25 are returned. The maximum value is 1000; values above 1000 are coerced to 1000. Negative values return an `INVALID_ARGUMENT` error.

          Location : query

          Format : int32

        orderBy

          Type : string

          Location : query

          Description : Optional, if resuming from a previous query. How the list of messages is ordered. Specify a value to order by and an ordering operation. Valid ordering operation values are: - `ASC` for ascending. - `DESC` for descending. The default ordering is `create_time ASC`.

        pageToken

          Type : string

          Description : Optional, if resuming from a previous query. A page token received from a previous list messages call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided should match the call that provided the page token. Passing different values to the other parameters may lead to unexpected results.

          Location : query

        parent

          Location : path

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

          Pattern : ^spaces/[^/]+$

          Type : string

          Required : Yes

        filter

          Description : A query filter. You can filter messages by date (`create_time`) and thread (`thread.name`). To filter messages by the date they were created, specify the `create_time` with a timestamp in [RFC-3339](https://www.rfc-editor.org/rfc/rfc3339) format and double quotation marks. For example, `"2023-04-21T11:30:00-04:00"`. You can use the greater than operator `>` to list messages that were created after a timestamp, or the less than operator `<` to list messages that were created before a timestamp. To filter messages within a time interval, use the `AND` operator between two timestamps. To filter by thread, specify the `thread.name`, formatted as `spaces/{space}/threads/{thread}`. You can only specify one `thread.name` per query. To filter by both thread and date, use the `AND` operator in your query. For example, the following queries are valid: ``` create_time > "2012-04-21T11:30:00-04:00" create_time > "2012-04-21T11:30:00-04:00" AND thread.name = spaces/AAAAAAAAAAA/threads/123 create_time > "2012-04-21T11:30:00+00:00" AND create_time < "2013-01-01T00:00:00+00:00" AND thread.name = spaces/AAAAAAAAAAA/threads/123 thread.name = spaces/AAAAAAAAAAA/threads/123 ``` Invalid queries are rejected by the server with an `INVALID_ARGUMENT` error.

          Location : query

          Type : string

      HTTP Method : GET

      Description : [Developer Preview](https://developers.google.com/workspace/preview): Lists messages in a space that the caller is a member of, including messages from blocked members and spaces. Requires [user authentication](https://developers.google.com/chat/api/guides/auth/users) and the `chat.messages` or `chat.messages.readonly` authorization scope. This method is only supported in spaces that don't allow users from outside the Workspace organization to join.

  • chat.spaces.messages.reactions.delete

      HTTP Method : DELETE

      Scopes :

    • https://www.googleapis.com/auth/chat.messages
    • https://www.googleapis.com/auth/chat.messages.reactions
    • Path : v1/{+name}

      Flat Path : v1/spaces/{spacesId}/messages/{messagesId}/reactions/{reactionsId}

      Parameter Order : name

      Parameters :

        name

          Description : Required. Name of the reaction to delete. Format: spaces/{space}/messages/{message}/reactions/{reaction}

          Required : Yes

          Pattern : ^spaces/[^/]+/messages/[^/]+/reactions/[^/]+$

          Location : path

          Type : string

      Description : [Developer Preview](https://developers.google.com/workspace/preview): Deletes a reaction to a message. Requires [user authentication](https://developers.google.com/chat/api/guides/auth/users) and the `chat.messages` or `chat.messages.reactions` scope.

  • chat.spaces.messages.reactions.create

      Parameter Order : parent

      Flat Path : v1/spaces/{spacesId}/messages/{messagesId}/reactions

      Path : v1/{+parent}/reactions

      Scopes :

    • https://www.googleapis.com/auth/chat.messages
    • https://www.googleapis.com/auth/chat.messages.reactions
    • https://www.googleapis.com/auth/chat.messages.reactions.create
    • HTTP Method : POST

      Description : [Developer Preview](https://developers.google.com/workspace/preview): Creates a reaction and adds it to a message. Requires [user authentication](https://developers.google.com/chat/api/guides/auth/users) and the `chat.messages`, `chat.messages.reactions`, or `chat.messages.reactions.create` scope. Only unicode emoji are supported.

      Parameters :

        parent

          Required : Yes

          Description : Required. The message where the reaction is created. Format: spaces/{space}/messages/{message}

          Pattern : ^spaces/[^/]+/messages/[^/]+$

          Location : path

          Type : string

  • chat.spaces.messages.reactions.list

      Parameter Order : parent

      Parameters :

        parent

          Location : path

          Description : Required. The message users reacted to. Format: spaces/{space}/messages/{message}

          Pattern : ^spaces/[^/]+/messages/[^/]+$

          Required : Yes

          Type : string

        pageToken

          Location : query

          Description : Optional. (If resuming from a previous query.) A page token received from a previous list reactions call. Provide this to retrieve the subsequent page. When paginating, the filter value should match the call that provided the page token. Passing a different value may lead to unexpected results.

          Type : string

        pageSize

          Type : integer

          Description : Optional. The maximum number of reactions returned. The service may return fewer reactions than this value. If unspecified, the default value is 25. The maximum value is 200; values above 200 are changed to 200.

          Location : query

          Format : int32

        filter

          Description : Optional. A query filter. You can filter reactions by [emoji](https://developers.google.com/chat/api/reference/rest/v1/Emoji) (either `emoji.unicode` or `emoji.custom_emoji.uid`) and [user](https://developers.google.com/chat/api/reference/rest/v1/User) (`user.name`). To filter reactions for multiple emojis or users, join similar fields with the `OR` operator, such as `emoji.unicode = "🙂" OR emoji.unicode = "👍"` and `user.name = "users/AAAAAA" OR user.name = "users/BBBBBB"`. To filter reactions by emoji and user, use the `AND` operator, such as `emoji.unicode = "🙂" AND user.name = "users/AAAAAA"`. If your query uses both `AND` and `OR`, group them with parentheses. For example, the following queries are valid: ``` user.name = "users/{user}" emoji.unicode = "🙂" emoji.custom_emoji.uid = "{uid}" emoji.unicode = "🙂" OR emoji.unicode = "👍" emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "{uid}" emoji.unicode = "🙂" AND user.name = "users/{user}" (emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "{uid}") AND user.name = "users/{user}" ``` The following queries are invalid: ``` emoji.unicode = "🙂" AND emoji.unicode = "👍" emoji.unicode = "🙂" AND emoji.custom_emoji.uid = "{uid}" emoji.unicode = "🙂" OR user.name = "users/{user}" emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "{uid}" OR user.name = "users/{user}" emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "{uid}" AND user.name = "users/{user}" ``` Invalid queries are rejected by the server with an `INVALID_ARGUMENT` error.

          Location : query

          Type : string

      HTTP Method : GET

      Scopes :

    • https://www.googleapis.com/auth/chat.messages
    • https://www.googleapis.com/auth/chat.messages.reactions
    • https://www.googleapis.com/auth/chat.messages.reactions.readonly
    • https://www.googleapis.com/auth/chat.messages.readonly
    • Path : v1/{+parent}/reactions

      Description : [Developer Preview](https://developers.google.com/workspace/preview): Lists reactions to a message. Requires [user authentication](https://developers.google.com/chat/api/guides/auth/users) and `chat.messages`, `chat.messages.readonly`, `chat.messages.reactions`, or `chat.messages.reactions.readonly` scope.

      Flat Path : v1/spaces/{spacesId}/messages/{messagesId}/reactions

  • chat.media.upload

      HTTP Method : POST

      Supportsmediaupload : Yes

      Parameter Order : parent

      Description : [Developer Preview](https://developers.google.com/workspace/preview): Uploads an attachment. Requires user [authentication](https://developers.google.com/chat/api/guides/auth/users). You can upload attachments up to 200 MB. Certain file types aren't supported. For details, see [File types blocked by Google Chat](https://support.google.com/chat/answer/7651457?&co=GENIE.Platform%3DDesktop#File%20types%20blocked%20in%20Google%20Chat).

      Mediaupload :

        Accept : */*

        Maxsize : 209715200

        Protocols :

          Resumable :

            Multipart : Yes

            Path : /resumable/upload/v1/{+parent}/attachments:upload

          Simple :

            Path : /upload/v1/{+parent}/attachments:upload

            Multipart : Yes

      Parameters :

        parent

          Location : path

          Required : Yes

          Description : Required. Resource name of the Chat space in which the attachment is uploaded. Format "spaces/{space}".

          Pattern : ^spaces/[^/]+$

          Type : string

      Flat Path : v1/spaces/{spacesId}/attachments:upload

      Scopes :

    • https://www.googleapis.com/auth/chat.messages
    • https://www.googleapis.com/auth/chat.messages.create
    • Path : v1/{+parent}/attachments:upload

Updates

    Methods
  • chat.spaces.list

      Parameters :

        filter

          Description : Optional. A query filter. Requires [user authentication](https://developers.google.com/chat/api/guides/auth/users). You can filter spaces by the space type ([`space_type`](https://developers.google.com/chat/api/reference/rest/v1/spaces#spacetype)). To filter by space type, you must specify valid `enum` value, such as `SPACE` or `GROUP_CHAT` (the `space_type` cannot be `SPACE_TYPE_UNSPECIFIED`). To query for multiple space types, use the `OR` operator. For example, the following queries are valid: ``` space_type = "SPACE" spaceType = "GROUP_CHAT" OR spaceType = "DIRECT_MESSAGE" ``` Invalid queries are rejected by the server with an `INVALID_ARGUMENT` error. With [service account authentication](https://developers.google.com/chat/api/guides/auth/service-accounts), this field is ignored and the query always returns all spaces. But Chat API still validates the query syntax with service accounts, so invalid queries are still rejected. [Developer Preview](https://developers.google.com/workspace/preview).

          Type : string

          Location : query

  • chat.spaces.members.list

      Parameters :

        filter

          Description : Optional. A query filter. You can filter memberships by a member's role ([`role`](https://developers.google.com/chat/api/reference/rest/v1/spaces.members#membershiprole)) and type ([`member.type`](https://developers.google.com/chat/api/reference/rest/v1/User#type)). To filter by role, set `role` to `ROLE_MEMBER` or `ROLE_MANAGER`. To filter by type, set `member.type` to `HUMAN` or `BOT`. To filter by both role and type, use the `AND` operator. To filter by either role or type, use the `OR` operator. For example, the following queries are valid: ``` role = "ROLE_MANAGER" OR role = "ROLE_MEMBER" member.type = "HUMAN" AND role = "ROLE_MANAGER" ``` The following queries are invalid: ``` member.type = "HUMAN" AND member.type = "BOT" role = "ROLE_MANAGER" AND role = "ROLE_MEMBER" ``` Invalid queries are rejected by the server with an `INVALID_ARGUMENT` error.

          Location : query

          Type : string

        showInvited

          Description : Optional. When `true`, also returns memberships associated with invited members, in addition to other types of memberships. If a filter is set, invited memberships that don't match the filter criteria aren't returned. Currently requires [user authentication](https://developers.google.com/chat/api/guides/auth/users).

          Type : boolean

          Location : query

  • chat.spaces.messages.delete

      Parameters :

        force

          Location : query

          Type : boolean

          Description : When `true`, deleting a message also deletes its threaded replies. When `false`, if a message has threaded replies, deletion fails. Only applies when [authenticating as a user](https://developers.google.com/chat/api/guides/auth/users). Has no effect when [authenticating with a service account] (https://developers.google.com/chat/api/guides/auth/service-accounts).