選擇 Google Workspace Events API 範圍

本文件內容包含 Google Workspace Event API 專屬的授權,以及 驗證資訊閱讀這份文件之前,請務必詳閱 如需 Google Workspace 的一般驗證和授權資訊,請造訪 瞭解驗證和授權

設定授權所需的 OAuth 2.0

設定 OAuth 同意畫面並選擇範圍 定義要對使用者和應用程式審查者顯示的資訊,並註冊 供您日後發布

Google Workspace 事件 API 範圍

如要定義授予應用程式的存取權層級,您必須找出 宣告授權範圍。授權範圍是 OAuth 2.0 URI 字串 ,該資料包含 Google Workspace 應用程式名稱、應用程式存取的資料類型,以及 存取層級「範圍」是應用程式對 Google Workspace 資料提出的要求,包括 使用者Google 帳戶資料。

安裝應用程式後,系統會要求使用者驗證應用程式所使用的範圍 。一般而言,您應選擇最精確的範圍 並避免要求應用程式不需要的範圍使用者更多 清楚地將存取權授予受限制、說明範圍。

如果可以,建議您使用非機密範圍,因為此範圍可對個別檔案產生授權 限制存取應用程式所需的特定功能。

Google Workspace Event API 會使用 Google Workspace 的範圍 支援訂閱的應用程式如果您的應用程式已經使用範圍 範圍。

下表列出 Google Workspace 事件 API:

範圍程式碼 說明 用量
Google Chat  
https://www.googleapis.com/auth/chat.bot 允許 Google Chat 應用程式查看即時通訊及傳送訊息。提供 可使用所有 Chat 擴充應用程式可用的功能。 不敏感
https://www.googleapis.com/auth/chat.memberships 在 Google Chat 的對話中查看、新增及移除成員。
敏感
https://www.googleapis.com/auth/chat.memberships.readonly 查看 Google Chat 對話中的成員。
敏感
https://www.googleapis.com/auth/chat.spaces 在 Google Chat 中建立對話和聊天室,以及查看或更新中繼資料 (包括記錄設定)。 敏感內容
https://www.googleapis.com/auth/chat.spaces.readonly 在 Google Chat 中查看即時通訊和聊天室。
敏感
https://www.googleapis.com/auth/chat.messages.reaction 在 Chat 中查看、新增和刪除訊息回應。
敏感
https://www.googleapis.com/auth/chat.messages.reactions.readonly 在 Chat 中查看訊息的回應。
敏感
https://www.googleapis.com/auth/chat.messages 查看、撰寫、傳送、更新及刪除訊息,以及新增、查看和刪除訊息的回應。 受限制
https://www.googleapis.com/auth/chat.messages.readonly 在 Google Chat 中查看訊息和回應。
受限
Google Meet  
https://www.googleapis.com/auth/meetings.space.created 允許應用程式建立、修改及讀取會議空間的相關中繼資料 您應用程式所建立的資料檢視
敏感
https://www.googleapis.com/auth/meetings.space.readonly 允許應用程式讀取使用者可存取的任何會議空間相關中繼資料。
敏感

上表的「用量」欄會指出各範圍的機密程度 定義如下:

如果應用程式需要存取任何其他 Google API,您可以新增這些範圍 如要進一步瞭解 Google API 範圍,請參閱將 OAuth 2.0 用於 存取 Google API。

如要進一步瞭解特定 OAuth 2.0 範圍,請參閱「OAuth 2.0 範圍: Google API

OAuth 驗證

若要使用特定 OAuth 範圍,您的應用程式可能需要透過 Google 的 OAuth 驗證 程序。 閱讀 OAuth API 驗證 常見問題 用於判斷應用程式何時應完成驗證,以及 需要驗證另請參閱《Google 雲端硬碟附加服務條款》 服務

必要驗證類型

本節將說明需要或支援的驗證類型。 並為 Google Workspace 事件 API。

如果是 Google Chat 事件的訂閱方案,請使用 Google Workspace Events API 支援使用者和應用程式驗證,以呼叫其部分方法。如果 API 方法支援這兩種憑證,即呼叫中所使用的憑證類型 會影響傳回的結果舉例來說,如果您呼叫 subscriptions.list() 方法,則 API 會傳回訂閱清單。 已驗證使用者可以存取。如果您使用應用程式驗證,API 會傳回應用程式可存取的訂閱項目清單。如要進一步瞭解 即時通訊驗證類型,請參閱驗證與授權 即時通訊應用程式和 Google Chat API 要求

下表列出 需要進行驗證,或支援各種 Google Workspace Event API 方法:

方法 需要或支援使用者驗證 支援應用程式驗證 (僅限 Google Chat 應用程式) 支援的授權範圍
建立訂閱項目

需要每個事件類型的支援範圍

  • chat.messages
  • chat.messages.readonly
  • chat.messages.reactions
  • chat.messages.reactions.readonly
  • chat.memberships
  • chat.memberships.readonly
  • chat.spaces
  • chat.spaces.readonly
  • meetings.space.created
  • meetings.space.readonly
訂閱 採用使用者驗證機制時,這個方法需要為訂閱項目支援至少一個事件類型

使用應用程式驗證功能 (僅限 Google Chat 應用程式):

  • chat.bot
列出訂閱項目 採用使用者驗證機制時,這個方法需要為訂閱項目支援至少一個事件類型

使用應用程式驗證功能 (僅限 Google Chat 應用程式):

  • chat.bot
更新訂閱項目

需要每個事件類型的支援範圍

  • chat.messages
  • chat.messages.readonly
  • chat.messages.reactions
  • chat.messages.reactions.readonly
  • chat.memberships
  • chat.memberships.readonly
  • chat.spaces
  • chat.spaces.readonly
  • meetings.space.created
  • meetings.space.readonly
重新啟用訂閱項目

需要每個事件類型的支援範圍

  • chat.messages
  • chat.messages.readonly
  • chat.messages.reactions
  • chat.messages.reactions.readonly
  • chat.memberships
  • chat.memberships.readonly
  • chat.spaces
  • chat.spaces.readonly
  • meetings.space.created
  • meetings.space.readonly
刪除訂閱項目 採用使用者驗證機制時,這個方法需要為訂閱項目支援至少一個事件類型

使用應用程式驗證功能 (僅限 Google Chat 應用程式):

  • chat.bot

按事件類型顯示範圍

透過使用者驗證機制呼叫 Google Workspace Events API 時, 必須指定一個以上的範圍,這些範圍必須與 訂閱項目中的所有進階功能!

下表顯示了各個 活動類型:

事件 事件類型 支援的授權範圍
Google Chat  
使用者張貼或更新訊息
  • google.workspace.chat.message.v1.created
  • google.workspace.chat.message.v1.updated
  • chat.messages
  • chat.messages.readonly
新增或刪除回應,或是變更多個回應。
  • google.workspace.chat.reaction.v1.created
  • google.workspace.chat.reaction.v1.deleted
  • google.workspace.chat.reaction.v1.batchChanged
  • chat.messages.reactions
  • chat.messages.reactions.readonly
  • chat.messages
  • chat.messages.readonly
會員方案 建立、更新或移除,或者建立多個 有哪些變更
  • google.workspace.chat.membership.v1.created
  • google.workspace.chat.membership.v1.updated
  • google.workspace.chat.membership.v1.deleted
  • google.workspace.chat.membership.v1.batchChanged
  • chat.memberships
  • chat.memberships.readonly
聊天室會經過更新或刪除。
  • google.workspace.chat.space.v1.updated
  • google.workspace.chat.space.v1.deleted
  • chat.spaces
  • chat.spaces.readonly
Google Meet  
每個「會議」的開始或結束。
  • google.workspace.meet.conference.v2.started
  • google.workspace.meet.conference.v2.ended
  • meetings.space.created
  • meetings.space.readonly
參與者加入或離開會議。
  • google.workspace.meet.participant.v2.joined
  • google.workspace.meet.participant.v2.left
  • meetings.space.created
  • meetings.space.readonly
系統產生錄製內容
  • google.workspace.meet.recording.v2.fileGenerated
  • meetings.space.created
  • meetings.space.readonly
已產生轉錄稿
  • google.workspace.meet.transcript.v2.fileGenerated
  • meetings.space.created
  • meetings.space.readonly