ภาพรวมของ Google Chat API
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
หน้านี้จะแสดงภาพรวมของวิธีใช้ Google Chat API และเอกสารอ้างอิง
Google Chat API มีทั้งอินเทอร์เฟซ gRPC และ REST รวมถึงไลบรารีของไคลเอ็นต์ที่รองรับทั้ง 2 อย่าง ไม่บังคับ: หากไลบรารีของไคลเอ็นต์ที่ให้มาไม่ตรงกับความต้องการ คุณสามารถเขียนไลบรารีของไคลเอ็นต์ของคุณเองที่ใช้อินเทอร์เฟซ gRPC หรือ REST ได้
ไลบรารีของไคลเอ็นต์
วิธีที่แนะนำสำหรับนักพัฒนาซอฟต์แวร์ส่วนใหญ่ในการเรียกใช้ Google Chat API
คือการใช้
ไลบรารีของไคลเอ็นต์ Cloud
ที่เรารองรับอย่างเป็นทางการสำหรับภาษาที่คุณต้องการ เช่น Python, Java หรือ Node.js
หากคุณเขียนโค้ดด้วย Google Apps Script ให้ใช้
บริการ Chat ขั้นสูง
แทนการติดตั้งไลบรารีของไคลเอ็นต์
ประเภท วิธีการ และชื่อฟิลด์
ประเภท,
เมธอด และชื่อช่องสำหรับ Google Chat API จะแตกต่างกันเล็กน้อยโดยขึ้นอยู่กับว่าคุณใช้ไลบรารีของไคลเอ็นต์, gRPC หรือ REST
- ไลบรารีของไคลเอ็นต์ Cloud จัดเรียงตามบริการ gRPC และเมธอดของบริการ
ไลบรารีของไคลเอ็นต์ Google API จัดเรียงเป็นบริการที่มีออบเจ็กต์หรือคลาสที่สอดคล้องกับทรัพยากร REST ซึ่งมีเมธอดที่สอดคล้องกันด้วย
- gRPC จัดเรียงตามบริการและเมธอดของบริการ
- REST จัดเรียงตามลำดับชั้นของทรัพยากรและเมธอดของทรัพยากร
- ชื่อฟิลด์ gRPC ใช้รูปแบบ Snake Case
- ชื่อฟิลด์ REST ใช้รูปแบบ Camel Case แต่บริการ API จะยอมรับทั้งรูปแบบ Camel Case และ Snake Case
- ชื่อฟิลด์ของไลบรารีไคลเอ็นต์จะใช้รูปแบบ Title Case, Camel Case หรือ Snake Case
ขึ้นอยู่กับว่าชื่อใดเป็นชื่อที่ใช้กันทั่วไปสำหรับภาษา
บัฟเฟอร์โปรโตคอล
ไม่ว่าคุณจะใช้ไลบรารีของไคลเอ็นต์, REST หรือ gRPC บริการพื้นฐานจะกำหนดโดยใช้บัฟเฟอร์โปรโตคอล โดยเฉพาะอย่างยิ่ง บริการนี้ใช้ proto3
เมื่อเรียกใช้ API ฟิลด์คำขอหรือการตอบกลับบางรายการอาจต้องมีความเข้าใจพื้นฐานเกี่ยวกับประเภทที่รู้จักกันดีของ Protocol Buffer
นอกจากนี้ เมื่อเรียกใช้ REST API ลักษณะการทำงานของค่าเริ่มต้นสำหรับ Protocol
Buffers อาจส่งผลให้ไม่มีฟิลด์ในการตอบกลับ JSON ฟิลด์เหล่านี้จะ
ตั้งค่าเป็นค่าเริ่มต้น จึงไม่รวมอยู่ในคำตอบ
เวอร์ชัน API
API เวอร์ชันต่อไปนี้พร้อมใช้งาน
ตัวอย่างสำหรับนักพัฒนาซอฟต์แวร์
ในเอกสารประกอบ คุณอาจเห็นเมธอดหรือฟิลด์ API ที่ใช้ได้ผ่านโปรแกรมตัวอย่างสำหรับนักพัฒนาซอฟต์แวร์เท่านั้น
หากต้องการทดสอบ ดูตัวอย่าง และแสดงความคิดเห็นเกี่ยวกับฟีเจอร์เวอร์ชันทดลองใช้ล่าสุด โปรดเข้าร่วมโปรแกรมเวอร์ชันทดลองใช้สำหรับนักพัฒนาแอป
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-29 UTC
[null,null,["อัปเดตล่าสุด 2025-08-29 UTC"],[[["\u003cp\u003eThis page offers guidance on utilizing the Google Chat API and navigating its reference documentation, including gRPC and REST interfaces.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers are encouraged to use the provided client libraries for Python, Java, Node.js, or the Advanced Chat service for Google Apps Script.\u003c/p\u003e\n"],["\u003cp\u003eType, 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.\u003c/p\u003e\n"],["\u003cp\u003eThe Google Chat API is built upon protocol buffers, specifically proto3, which may require a basic understanding for certain request and response fields.\u003c/p\u003e\n"],["\u003cp\u003eStable API version v1 is currently available, with access to developer preview features obtainable through the Developer Preview Program.\u003c/p\u003e\n"]]],["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"],null,["# Google Chat API overview\n\nThis page provides an overview of how to use Google Chat API and its reference\ndocumentation.\n\nGoogle Chat API has both [gRPC](/workspace/chat/api/reference/rpc) and\n[REST](/workspace/chat/api/reference/rest) interfaces, and\n[client libraries](/workspace/chat/libraries) that support both. Optionally, if\nthe provided client libraries don't meet your needs, you can write your own\nclient libraries that use the gRPC or REST interface.\n\nClient libraries\n----------------\n\nThe recommended way for most developers to call the Google Chat API\nis with our officially supported\n[Cloud Client Libraries](/workspace/chat/libraries)\nfor your preferred language, like Python, Java, or Node.js.\n\nIf you're coding with Google Apps Script, use the\n[Advanced Chat service](/apps-script/advanced/chat)\ninstead of installing a client library.\n\nType, method, and field names\n-----------------------------\n\nDepending on whether you're using client libraries, gRPC, or REST, the type,\nmethod, and field names for the Google Chat API vary somewhat:\n\n- Cloud Client Libraries are arranged by gRPC services and their methods. Google API Client Libraries are arranged as services that contain objects or classes that correspond with REST resources, which also contain corresponding methods.\n- gRPC is arranged by services and their methods.\n- REST is arranged by resource hierarchies and their methods.\n- gRPC field names use snake case.\n- REST field names use camel case, though the API service will accept either camel case or snake case.\n- Client library field names use either title case, camel case or snake case, depending on which name is idiomatic for the language.\n\nProtocol buffers\n----------------\n\nWhether you are using client libraries, REST, or gRPC, the underlying service is\ndefined using [protocol buffers](/protocol-buffers). In particular, the service\nuses [proto3](/protocol-buffers/docs/proto3).\n\nWhen calling the API, some request or response fields can require a basic\nunderstanding of\n[protocol buffer well-known types](/protocol-buffers/docs/reference/google.protobuf).\n\nIn addition, when calling the REST API, the\n[default value](/protocol-buffers/docs/proto3#default) behavior for protocol\nbuffers may result in missing fields in a JSON response. These fields are\nset to the default value, so they are not included in the response.\n\nAPI versions\n------------\n\nThe following API versions are available:\n\n- **v1**: Stable.\n\nDeveloper Preview\n-----------------\n\nIn the documentation, you might see API methods or fields that are only\navailable through the Developer Preview Program. To test and preview and offer\nfeedback on the latest preview features, join the\n[Developer Preview Program](/workspace/preview).\n\nRelated topics\n--------------\n\n- [Call the Google Chat API](/workspace/chat/api-overview)"]]