Zadbaj o dobrą organizację dzięki kolekcji Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Na tej stronie znajdziesz omówienie interfejsu Google Chat API i jego dokumentacji referencyjnej.
Interfejs Google Chat API ma interfejsy gRPC i REST oraz biblioteki klienta, które obsługują oba te interfejsy. Opcjonalnie, jeśli udostępnione biblioteki klienta nie spełniają Twoich potrzeb, możesz napisać własne biblioteki klienta, które korzystają z interfejsu gRPC lub REST.
Biblioteki klienta
Zalecanym sposobem wywoływania interfejsu Google Chat API dla większości deweloperów jest korzystanie z naszych oficjalnie obsługiwanych bibliotek klienta Cloud w wybranym języku, np. Python, Java lub Node.js.
Jeśli piszesz kod w Google Apps Script, użyj zaawansowanej usługi Chat zamiast instalować bibliotekę klienta.
Typ, metoda i nazwy pól
W zależności od tego, czy używasz bibliotek klienta, gRPC czy REST, typ, metoda i nazwy pól interfejsu Google Chat API różnią się nieco:
Biblioteki klienta Cloud są uporządkowane według usług gRPC i ich metod. Biblioteki klienta interfejsu API Google są uporządkowane jako usługi zawierające obiekty lub klasy odpowiadające zasobom REST, które również zawierają odpowiednie metody.
gRPC jest uporządkowany według usług i ich metod.
REST jest uporządkowany według hierarchii zasobów i ich metod.
Nazwy pól gRPC są zapisywane w formacie snake case.
Nazwy pól REST używają notacji camel case, ale usługa API akceptuje zarówno notację camel case, jak i snake case.
Nazwy pól biblioteki klienta są zapisywane w formacie Jak nazwy własne, camel case lub snake case, w zależności od tego, który z nich jest typowy dla danego języka.
Bufory protokołu
Niezależnie od tego, czy używasz bibliotek klienta, REST czy gRPC, podstawowa usługa jest zdefiniowana za pomocą buforów protokołu. Usługa korzysta w szczególności z proto3.
Dodatkowo podczas wywoływania interfejsu REST API wartość domyślna buforów protokołu może powodować brakujące pola w odpowiedzi JSON. Te pola mają wartość domyślną, więc nie są uwzględniane w odpowiedzi.
Wersje interfejsu API
Dostępne są te wersje interfejsu API:
v1: stabilna.
wersja przedpremierowa dla programistów
W dokumentacji możesz zobaczyć metody lub pola interfejsu API, które są dostępne tylko w ramach programu Developer Preview. Aby testować najnowsze funkcje w wersji przedpremierowej, wyświetlać ich podgląd i przesyłać na ich temat opinie, dołącz do Programu testowania wersji przedpremierowych dla programistów.
[[["Łatwo zrozumieć","easyToUnderstand","thumb-up"],["Rozwiązało to mój problem","solvedMyProblem","thumb-up"],["Inne","otherUp","thumb-up"]],[["Brak potrzebnych mi informacji","missingTheInformationINeed","thumb-down"],["Zbyt skomplikowane / zbyt wiele czynności do wykonania","tooComplicatedTooManySteps","thumb-down"],["Nieaktualne treści","outOfDate","thumb-down"],["Problem z tłumaczeniem","translationIssue","thumb-down"],["Problem z przykładami/kodem","samplesCodeIssue","thumb-down"],["Inne","otherDown","thumb-down"]],["Ostatnia aktualizacja: 2025-08-04 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,["This 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\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\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\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\nThe following API versions are available:\n\n- **v1**: Stable.\n\nDeveloper Preview\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- [Call the Google Chat API](/workspace/chat/api-overview)"]]