Creates a space and adds specified users to it. The calling user is automatically added to the space, and should not 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 from the People API, or the id
for the user 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
.
To create a direct message (DM) between the calling user and another human user, specify exactly one membership to represent the human user.
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
If a DM already exists between two users, then the DM is returned. Otherwise, a DM is created.
Spaces with threaded replies or guest access are not supported.
Requires user authentication and the chat.spaces.create
scope.
HTTP request
POST https://chat.googleapis.com/v1/spaces:setup
The URL uses gRPC Transcoding syntax.
Request body
The request body contains data with the following structure:
JSON representation |
---|
{ "space": { object ( |
Fields | |
---|---|
space |
Required. The To create a space, set To create a group chat, set To create a 1:1 conversation between humans, set To create an 1:1 conversation between a human and the calling Chat app, set |
requestId |
Optional. A unique identifier for this request. A random UUID is recommended. This request is only idempotent if a |
memberships[] |
Optional. The initial set of in-domain users or groups invited to join the space. The set currently allows 20 memberships maximum. The Required when setting Required when setting Required when setting Must be empty when creating a 1:1 conversation between a human and the calling Chat app (when setting Not supported: Inviting guest users, or adding other Chat apps. |
Response body
If successful, the response body contains an instance of Space
.
Authorization Scopes
Requires the following OAuth scope:
https://www.googleapis.com/auth/chat.spaces.create
For more information, see the Authorization guide.