Package google.chat.v1

索引

ChatService

開發人員可在 Google Chat 平台上建構 Chat 應用程式和整合功能。

CompleteImportSpace

rpc CompleteImportSpace(CompleteImportSpaceRequest) returns (CompleteImportSpaceResponse)

完成指定空間的匯入程序,並向使用者顯示。

需要使用者驗證和全網域委派,並使用以下授權範圍

  • https://www.googleapis.com/auth/chat.import

詳情請參閱「授權 Google Chat 應用程式匯入資料」。

授權範圍

需要下列 OAuth 範圍:

  • https://www.googleapis.com/auth/chat.import

詳情請參閱授權指南

CreateCustomEmoji

rpc CreateCustomEmoji(CreateCustomEmojiRequest) returns (CustomEmoji)

建立自訂表情符號。

自訂表情符號僅適用於 Google Workspace 帳戶,且管理員必須為機構啟用自訂表情符號。詳情請參閱「瞭解 Google Chat 中的自訂表情符號」和「管理自訂表情符號權限」。

需要使用授權範圍進行使用者驗證

  • https://www.googleapis.com/auth/chat.customemojis
授權範圍

需要下列 OAuth 範圍:

  • https://www.googleapis.com/auth/chat.customemojis

詳情請參閱授權指南

CreateMembership

rpc CreateMembership(CreateMembershipRequest) returns (Membership)

為通話 Chat 應用程式、使用者或 Google 群組建立成員資格。目前不支援為其他 Chat 應用程式建立成員資格。建立成員時,如果指定成員關閉了自動接受政策,系統會邀請對方加入,且對方必須接受邀請才能加入。否則,建立成員資格會直接將成員新增至指定聊天室。

支援下列類型的驗證

  • 應用程式驗證 (須經管理員核准),授權範圍如下:

    • https://www.googleapis.com/auth/chat.app.memberships
  • 使用者驗證,並使用下列其中一個授權範圍:

    • https://www.googleapis.com/auth/chat.memberships
    • https://www.googleapis.com/auth/chat.memberships.app (將通話應用程式加入聊天室)
    • https://www.googleapis.com/auth/chat.import (僅限匯入模式聊天室)
    • 當管理員帳戶通過驗證時,使用者驗證會授予管理員權限,use_admin_accesstrue,且使用下列授權範圍:
      • https://www.googleapis.com/auth/chat.admin.memberships

應用程式驗證不支援下列用途:

  • 邀請不屬於聊天室所屬 Workspace 機構的使用者。
  • 將 Google 群組新增至聊天室。
  • 將 Chat 應用程式新增至聊天室。

如需使用範例,請參閱:

授權範圍

需要下列其中一種 OAuth 範圍:

  • https://www.googleapis.com/auth/chat.app.memberships
  • https://www.googleapis.com/auth/chat.admin.memberships
  • https://www.googleapis.com/auth/chat.import
  • https://www.googleapis.com/auth/chat.memberships
  • https://www.googleapis.com/auth/chat.memberships.app

詳情請參閱授權指南

CreateMessage

rpc CreateMessage(CreateMessageRequest) returns (Message)

在 Google Chat 聊天室中建立訊息。如需範例,請參閱「傳送訊息」。

支援下列類型的驗證

  • 使用授權範圍進行應用程式驗證
    • https://www.googleapis.com/auth/chat.bot
  • 透過下列任一授權範圍進行使用者驗證
    • https://www.googleapis.com/auth/chat.messages.create
    • https://www.googleapis.com/auth/chat.messages
    • https://www.googleapis.com/auth/chat.import (僅限匯入模式聊天室)

Chat 會根據您在要求中使用的驗證類型,以不同方式歸因訊息傳送者。

下圖顯示使用應用程式驗證時,Chat 如何將訊息歸因於應用程式。Chat 會將 Chat 應用程式顯示為訊息傳送者。訊息內容可包含文字 (text)、資訊卡 (cardsV2) 和配件小工具 (accessoryWidgets)。

透過應用程式驗證傳送的訊息

下圖說明使用使用者驗證時,Chat 如何將訊息歸因於使用者。Chat 會將使用者顯示為訊息傳送者,並顯示 Chat 應用程式的名稱,將訊息歸給該應用程式。訊息內容只能包含文字 (text)。

透過使用者驗證傳送的訊息

郵件大小上限為 32,000 個位元組,包括郵件內容。

如果是 Webhook 要求,回應不會包含完整訊息。除了要求中的資訊外,回應只會填入 namethread.name 欄位。

授權範圍

需要下列其中一種 OAuth 範圍:

  • https://www.googleapis.com/auth/chat.bot
  • https://www.googleapis.com/auth/chat.import
  • https://www.googleapis.com/auth/chat.messages
  • https://www.googleapis.com/auth/chat.messages.create

詳情請參閱授權指南

CreateReaction

rpc CreateReaction(CreateReactionRequest) returns (Reaction)

建立回應並新增至訊息。如需範例,請參閱「對訊息新增回應」。

需要使用者驗證,並使用下列其中一個授權範圍

  • https://www.googleapis.com/auth/chat.messages.reactions.create
  • https://www.googleapis.com/auth/chat.messages.reactions
  • https://www.googleapis.com/auth/chat.messages
  • https://www.googleapis.com/auth/chat.import (僅限匯入模式聊天室)
授權範圍

需要下列其中一種 OAuth 範圍:

  • https://www.googleapis.com/auth/chat.import
  • https://www.googleapis.com/auth/chat.messages
  • https://www.googleapis.com/auth/chat.messages.reactions
  • https://www.googleapis.com/auth/chat.messages.reactions.create

詳情請參閱授權指南

CreateSpace

rpc CreateSpace(CreateSpaceRequest) returns (Space)

建立聊天室。可用於在 Import mode 中建立具名聊天室或群組對話。如需範例,請參閱「建立聊天室」。

支援下列類型的驗證

  • 應用程式驗證 (須經管理員核准),以及下列其中一個授權範圍:

    • https://www.googleapis.com/auth/chat.app.spaces.create
    • https://www.googleapis.com/auth/chat.app.spaces
  • 使用者驗證,並使用下列其中一個授權範圍:

    • https://www.googleapis.com/auth/chat.spaces.create
    • https://www.googleapis.com/auth/chat.spaces
    • https://www.googleapis.com/auth/chat.import (僅限匯入模式聊天室)

以應用程式身分驗證時,必須在要求中設定 space.customer 欄位。

以應用程式身分驗證時,Chat 應用程式會新增為聊天室成員。不過,與真人驗證不同的是,Chat 應用程式不會新增為聊天室管理員。根據預設,所有聊天室成員都能從聊天室中移除 Chat 應用程式。如要只允許聊天室管理員從聊天室移除應用程式,請將 space.permission_settings.manage_apps 設為 managers_allowed

建立聊天室時的成員資格取決於聊天室是否在 Import mode 中建立:

  • 匯入模式:不會建立任何成員。
  • 所有其他模式:系統會將通話使用者新增為成員。包括:
    • 使用應用程式驗證時,應用程式本身。
    • 使用使用者驗證時的人類使用者。

如果在建立聊天室時收到 ALREADY_EXISTS 錯誤訊息,請嘗試使用其他 displayName。Google Workspace 機構中現有的聊天室可能已使用這個顯示名稱。

授權範圍

需要下列其中一種 OAuth 範圍:

  • https://www.googleapis.com/auth/chat.app.spaces.create
  • https://www.googleapis.com/auth/chat.app.spaces
  • https://www.googleapis.com/auth/chat.import
  • https://www.googleapis.com/auth/chat.spaces
  • https://www.googleapis.com/auth/chat.spaces.create

詳情請參閱授權指南

DeleteCustomEmoji

rpc DeleteCustomEmoji(DeleteCustomEmojiRequest) returns (Empty)

刪除自訂表情符號。根據預設,使用者只能刪除自己建立的自訂表情符號。管理員指派的表情符號管理員可以刪除機構中的任何自訂表情符號。請參閱「瞭解 Google Chat 中的自訂表情符號」。

自訂表情符號僅適用於 Google Workspace 帳戶,且管理員必須為機構啟用自訂表情符號。詳情請參閱「瞭解 Google Chat 中的自訂表情符號」和「管理自訂表情符號權限」。

需要使用授權範圍進行使用者驗證

  • https://www.googleapis.com/auth/chat.customemojis
授權範圍

需要下列 OAuth 範圍:

  • https://www.googleapis.com/auth/chat.customemojis

詳情請參閱授權指南

DeleteMembership

rpc DeleteMembership(DeleteMembershipRequest) returns (Membership)

刪除會員資格。如需範例,請參閱「從聊天室中移除使用者或 Google Chat 應用程式」。

支援下列類型的驗證

  • 應用程式驗證 (須經管理員核准),授權範圍如下:

    • https://www.googleapis.com/auth/chat.app.memberships
  • 使用者驗證,並使用下列其中一個授權範圍:

    • https://www.googleapis.com/auth/chat.memberships
    • https://www.googleapis.com/auth/chat.memberships.app (從聊天室中移除通話應用程式)
    • https://www.googleapis.com/auth/chat.import (僅限匯入模式聊天室)
    • 當管理員帳戶通過驗證時,使用者驗證會授予管理員權限,use_admin_accesstrue,且使用下列授權範圍:
      • https://www.googleapis.com/auth/chat.admin.memberships

應用程式驗證不支援下列用途:

  • 從聊天室中移除 Google 網路論壇。
  • 從聊天室移除 Google Chat 應用程式。

如要刪除聊天室管理員的成員資格,要求者必須是聊天室管理員。如果使用應用程式驗證,則必須由 Chat 應用程式建立聊天室。

授權範圍

需要下列其中一種 OAuth 範圍:

  • https://www.googleapis.com/auth/chat.app.memberships
  • https://www.googleapis.com/auth/chat.admin.memberships
  • https://www.googleapis.com/auth/chat.import
  • https://www.googleapis.com/auth/chat.memberships
  • https://www.googleapis.com/auth/chat.memberships.app

詳情請參閱授權指南

DeleteMessage

rpc DeleteMessage(DeleteMessageRequest) returns (Empty)

刪除訊息。如需範例,請參閱「刪除訊息」一文。

支援下列類型的驗證

  • 應用程式驗證 (授權範圍):

    • https://www.googleapis.com/auth/chat.bot
  • 使用者驗證,並使用下列其中一個授權範圍:

    • https://www.googleapis.com/auth/chat.messages
    • https://www.googleapis.com/auth/chat.import (僅限匯入模式聊天室)

使用應用程式驗證時,要求只能刪除呼叫的 Chat 應用程式建立的訊息。

授權範圍

需要下列其中一種 OAuth 範圍:

  • https://www.googleapis.com/auth/chat.bot
  • https://www.googleapis.com/auth/chat.import
  • https://www.googleapis.com/auth/chat.messages

詳情請參閱授權指南

DeleteReaction

rpc DeleteReaction(DeleteReactionRequest) returns (Empty)

刪除訊息的回應。如需範例,請參閱刪除回應

需要使用者驗證,並使用下列其中一個授權範圍

  • https://www.googleapis.com/auth/chat.messages.reactions
  • https://www.googleapis.com/auth/chat.messages
  • https://www.googleapis.com/auth/chat.import (僅限匯入模式聊天室)
授權範圍

需要下列其中一種 OAuth 範圍:

  • https://www.googleapis.com/auth/chat.import
  • https://www.googleapis.com/auth/chat.messages
  • https://www.googleapis.com/auth/chat.messages.reactions

詳情請參閱授權指南

DeleteSpace

rpc DeleteSpace(DeleteSpaceRequest) returns (Empty)

刪除具名空間。一律執行連鎖刪除作業,也就是一併刪除聊天室的子項資源,例如聊天室中發布的訊息和成員資格。如需範例,請參閱「刪除聊天室」。

支援下列類型的驗證

  • 應用程式驗證 (須經管理員核准),授權範圍如下:

    • https://www.googleapis.com/auth/chat.app.delete (僅限應用程式建立的聊天室)
  • 使用者驗證,並使用下列其中一個授權範圍:

    • https://www.googleapis.com/auth/chat.delete
    • https://www.googleapis.com/auth/chat.import (僅限匯入模式聊天室)
    • 當管理員帳戶通過驗證時,使用者驗證會授予管理員權限,use_admin_accesstrue,且使用下列授權範圍:
      • https://www.googleapis.com/auth/chat.admin.delete
授權範圍

需要下列其中一種 OAuth 範圍:

  • https://www.googleapis.com/auth/chat.app.delete
  • https://www.googleapis.com/auth/chat.admin.delete
  • https://www.googleapis.com/auth/chat.import
  • https://www.googleapis.com/auth/chat.delete

詳情請參閱授權指南

FindDirectMessage

rpc FindDirectMessage(FindDirectMessageRequest) returns (Space)

傳回與指定使用者現有的即時訊息。如果找不到任何直接訊息空間,則會傳回 404 NOT_FOUND 錯誤。如需範例,請參閱「尋找即時訊息」。

透過