Get details about a membership (original) (raw)

This guide explains how to use theget()method on the Membership resource of the Google Chat API to get details about a membership in a space.

If you're a Google Workspace administrator, you can call the get() method to retrieve details about any membership in your Google Workspace organization.

TheMembership resourcerepresents whether a human user or Google Chat app is invited to, part of, or absent from a space.

Authenticating withapp authenticationlets a Chat app get memberships from spaces that it has access to in Google Chat (for example, spaces it's a member of), but excludes Chat app memberships, including its own. Authenticating withuser authenticationreturns memberships from spaces that the authenticated user has access to.

Prerequisites

Node.js

Python

Java

Apps Script

To get details about a membership in Google Chat, pass the following in your request:

Get a membership with user authentication

Here's how to get a membership withuser authentication:

Node.js

Python

Java

Apps Script

To run this sample, replace the following:

The Chat API returns an instance ofMembershipdetailing the specified membership.

Get a membership with app authentication

Here's how to get a membership withapp authentication:

Node.js

Python

Java

Apps Script

To run this sample, replace the following:

The Chat API returns an instance ofMembershipdetailing the specified membership.

Get details about memberships as a Google Workspace administrator

If you're a Google Workspace administrator, you can call theGetMembership() method to retrieve details about a membership for any user in your Google Workspace organization.

To call this method as a Google Workspace administrator, do the following:

For more information and examples, seeManage Google Chat spaces as a Google Workspace administrator.