Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add create membership for group code sample #488

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions chat/advanced-service/Main.gs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,33 @@ function createMembershipUserCredForApp() {
}
// [END chat_create_membership_user_cred_for_app]

// [START chat_create_membership_user_cred_for_group]
/**
* This sample shows how to create membership with user credential for a group
*
* It relies on the OAuth2 scope 'https://www.googleapis.com/auth/chat.memberships'
* referenced in the manifest file (appsscript.json).
*/
function createMembershipUserCredForGroup() {
// Initialize request argument(s)
// TODO(developer): Replace SPACE_NAME here.
const parent = 'spaces/SPACE_NAME';
const membership = {
groupMember: {
// TODO(developer): Replace GROUP_NAME here
name: 'groups/GROUP_NAME'
}
};

// Make the request
const response = Chat.Spaces.Members.create(membership, parent);

// Handle the response
console.log(response);
}
// [END chat_create_membership_user_cred_for_group]


// [START chat_create_message_app_cred]
/**
* This sample shows how to create message with app credential
Expand Down
Loading