Creates a human membership or app membership for the calling app. Creating memberships for other apps isn't supported. For an example, see Create a membership. When creating a membership, if the specified member has their auto-accept policy turned off, then they're invited, and must accept the space invitation before joining. Otherwise, creating a membership adds the member directly to the specified space. Requires user authentication 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 a space or a direct message between two human users, use
users/app
. Unable to add other apps to the space.To add a human user, use
users/{user}
, where{user}
is either the{person_id}
for the person from the People API, or theid
for the user in the Directory API. For example, if the People APIPerson
resourceName
ispeople/123456789
, you can add the user to the space by setting themembership.member.name
tousers/123456789
.
HTTP request
POST https://chat.googleapis.com/v1/{parent=spaces/*}/members
The URL uses gRPC Transcoding syntax.
Path parameters
Parameters | |
---|---|
parent |
Required. The resource name of the space for which to create the membership. Format: spaces/{space} |
Request body
The request body contains an instance of Membership
.
Response body
If successful, the response body contains a newly created instance of Membership
.
Authorization scopes
Requires one of the following OAuth scopes:
https://www.googleapis.com/auth/chat.memberships
https://www.googleapis.com/auth/chat.memberships.app
For more information, see the Authorization guide.