Explore ↓
Create Chat Space
Create a chat space from apps script. Very cool to do so you can Assign Tasks to people in that chat space.
function onOpen() {
var ui = SpreadsheetApp.getUi()
ui.createMenu('Custom Menu')
.addItem('Create Chat Space', 'createSpace')
.addToUi()
}
// ✅ add "Google Chat" Chat in Services.
// ✅ add https://www.googleapis.com/auth/chat.spaces in oauthScopes in appsscript.json
// 🎉 add to Google Project , with Number
// ✅ Oauth Consent screen
// ✅ Enable Google Chat API in Console.cloud.google.com
// ✅ Admin Console > Apps > Google Workspace > Google Chat > External Chat Settings. It must be set to "ON".
function createSpace() {
var displayName = SpreadsheetApp.getActiveSpreadsheet().getActiveRange().getValue()
var space = {
displayName: displayName,
spaceType: "SPACE",
externalUserAllowed: true,
spaceDetails: {
description: "a new space"
}
}
var chatInfo = Chat.Spaces.create(space)
SpreadsheetApp.getActiveSpreadsheet().getSheetByName("SPACES").appendRow([chatInfo.spaceUri,displayName])
}