Google Chat API 總覽
本頁面概略說明如何使用 Google Chat API 及其參考文件。
Google Chat API 提供 gRPC 和 REST 介面,以及支援這兩者的用戶端程式庫。如果提供的用戶端程式庫無法滿足您的需求,您可以自行編寫使用 gRPC 或 REST 介面的用戶端程式庫。
用戶端程式庫
對於大多數開發人員而言,建議您使用官方支援的 Cloud 用戶端程式庫,以您偏好的語言 (例如 Python、Java 或 Node.js) 呼叫 Google Chat API。
如果您使用 Google Apps Script 編寫程式碼,請使用進階 Chat 服務,而非安裝用戶端程式庫。
類型、方法和欄位名稱
視您是否使用用戶端程式庫、gRPC 或 REST,Google Chat API 的類型、方法和欄位名稱會有所不同:
- Cloud 用戶端程式庫會依 gRPC 服務和方法排列。Google API 用戶端程式庫會以服務的形式排列,其中包含與 REST 資源相對應的物件或類別,而這些資源也包含對應的方法。
- gRPC 會依服務和方法排序。
- REST 會依資源階層和方法排序。
- gRPC 欄位名稱使用蛇形命名法。
- REST 欄位名稱使用駝峰式大小寫,但 API 服務會接受駝峰式大小寫或蛇形大小寫。
- 用於用戶端程式庫的欄位名稱,會採用大寫、駝峰式或蛇形命名規則,視所用語言的慣用命名方式而定。
通訊協定緩衝區
無論您使用的是用戶端程式庫、REST 還是 gRPC,底層服務都是使用通訊協定緩衝區定義。具體來說,這項服務會使用 proto3。
呼叫 API 時,部分要求或回應欄位可能需要對通訊協定緩衝區已知類型有基本瞭解。
此外,在呼叫 REST API 時,通訊協定緩衝區的預設值行為可能會導致 JSON 回應中缺少欄位。這些欄位會設為預設值,因此不會包含在回應中。
API 版本
可用的 API 版本如下:
開發人員預覽版
說明文件中可能會顯示僅透過開發人員預覽計畫提供的 API 方法或欄位。如要測試及預覽最新的預先發布版功能,並提供意見回饋,請加入開發人員預覽版計畫。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-02-16 (世界標準時間)。
[null,null,["上次更新時間:2025-02-16 (世界標準時間)。"],[[["This page offers guidance on utilizing the Google Chat API and navigating its reference documentation, including gRPC and REST interfaces."],["Developers are encouraged to use the provided client libraries for Python, Java, Node.js, or the Advanced Chat service for Google Apps Script."],["Type, method, and field names may vary slightly depending on whether you are using client libraries, gRPC, or REST, with details provided on their respective conventions."],["The Google Chat API is built upon protocol buffers, specifically proto3, which may require a basic understanding for certain request and response fields."],["Stable API version v1 is currently available, with access to developer preview features obtainable through the Developer Preview Program."]]],["The Google Chat API offers gRPC and REST interfaces, with corresponding client libraries or the option to create custom ones. Developers can use Cloud Client Libraries, or the Advanced Chat service with Google Apps Script. Type, method, and field names vary across libraries, gRPC, and REST. The API relies on protocol buffers (proto3), which can impact JSON responses due to default value behavior. The current stable version is v1, with a Developer Preview program for testing new features.\n"]]