允許 Google Workspace 機構中的特定使用者搜尋 Google Chat 聊天室
本頁面說明如何使用 Google Chat API,與 Google Workspace 機構中的特定使用者共用 Google Chat 聊天室,讓他們能夠找到並加入聊天室。
如要指定貴機構中可探索及加入聊天室的使用者,請建立目標對象。目標對象是一群使用者 (例如特定部門或整個機構),您可以與他們分享 Chat 聊天室,藉此提高聊天室的知名度和分享率。您也可以透過目標對象管理及自訂聊天室會員資格,而無須邀請個別使用者加入聊天室。詳情請參閱「關於指定目標對象」。
只有目標對象才能發現已命名的聊天室。您無法將其他聊天室類型 (例如即時訊息或群組對話) 分享給目標對象。
必要條件
取得目標對象 ID
如要取得目標對象的 ID,請按照下列步驟操作:
在 Google 管理控制台中,依序點選「選單」圖示 menu「目錄」「目標對象」。
前往「目標對象」
在「目標對象」表格中,按一下目標對象的「名稱」欄位。
在網頁網址中找出目標對象 ID。網址格式為 https://admin.google.com/ac/targetaudiences/TARGET_AUDIENCE_ID
,其中 TARGET_AUDIENCE_ID
是目標對象的英數 ID。
在下一節中,您將使用目標對象 ID 建立可供探索的空間,或是更新現有空間,讓目標對象能夠探索。
在 Chat API 要求中指定目標對象
如要為特定目標對象建立聊天室,請在 Space
資源上使用 create()
或 setup()
方法。如要讓現有空間可供探索,請在 Space
資源上使用 update()
方法。由於只有命名聊天室可與目標對象共用,因此聊天室類型 (在 spaceType
欄位中表示) 必須為 SPACE
。
如要讓目標對象能夠搜尋到聊天室,請在 Chat API 要求中,將 AccessSettings
物件加入 Space
資源。 在物件中指定 audience
欄位:
"accessSettings": {
"audience": "audiences/TARGET_AUDIENCE_ID"
}
將 TARGET_AUDIENCE_ID
替換為您在上一個部分取得的目標對象 ID。如要使用 Google Workspace 機構的預設 Chat 聊天室分享設定,請將其替換為 default
。
如要進一步瞭解如何使用 Chat API 建立或更新聊天室,請參閱下列指南:
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-02-16 (世界標準時間)。
[null,null,["上次更新時間:2025-02-16 (世界標準時間)。"],[[["This page guides Google Workspace admins on how to use the Google Chat API to share named spaces with specific users within their organization."],["Target audiences are used to control which users can discover and join a space, replacing the need to invite individuals."],["To share a space, the `AccessSettings` object in the Chat API request should contain the target audience ID within the `audience` field."],["Prerequisites include a Business or Enterprise Google Workspace account with super admin privileges, an available target audience, and user authentication when calling the Chat API."],["Admins can get the target audience ID from the Google Admin console under Directory \u003e Target Audiences, then locate it within the URL of the specific target audience page."]]],["The core content details sharing Google Chat spaces with specific users within a Google Workspace organization using the Google Chat API. It focuses on creating or updating spaces to be discoverable to target audiences—groups of users like departments or the entire organization. To achieve this, users must obtain a target audience ID from the Google Admin console and include it in the API request's `AccessSettings` object when creating or updating a named space. This makes the space discoverable and allows customized memberships.\n"]]