Client libraries optimize the developer experience for calling the Google Chat API by reducing the boilerplate code you have to write. This guide introduces the client libraries and explains how to install them.
Chat API has gRPC and REST interfaces, and client libraries that support both. Cloud Client Libraries support gRPC and REST interfaces, Google API Client Libraries only support the REST interface, but you can use both client libraries in the same project. Optionally, if the provided client libraries don't meet your needs, you can write your own client libraries that use the gRPC or REST interface.
To learn more about the types of client libraries Google supports, see Client libraries explained .
Install Cloud Client Libraries (recommended)
Cloud Client Libraries are the latest and recommended client libraries for calling Chat API. Cloud Client Libraries support both gRPC and REST interfaces.
Chat API provides Cloud Client Libraries for the following languages. Select the language that you want to use:
Node.js
To install the client library:
npm
install
@google-apps/chat
Learn more:
Python
To install the client library:
python -m venv <your-env>
source <your-env>/bin/activate
pip install google-apps-chat
Learn more:
Java
Select your build environment from the following tabs. Whichever you use, remember to update the version to the most recent release available on GitHub.
Maven with BOM
If you're using Maven with BOM
,
add this to your pom.xml
file:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>26.42.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-chat</artifactId>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-chat</artifactId>
<version>0.10.0</version>
</dependency>
Maven without BOM
If you're using Maven without BOM , add this to your dependencies:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-chat</artifactId>
<version>0.9.0</version>
</dependency>
Gradle
If you're using Gradle without BOM , add this to your dependencies:
implementation 'com.google.cloud:google-cloud-chat:0.10.0'
SBT
If you are using SBT, add this to your dependencies:
libraryDependencies += "com.google.cloud" % "google-cloud-chat" % "0.10.0"
Learn more:
Go
Import the Go packages for Google Cloud services.
import
"cloud.google.com/go"
To install the package on your system:
- Change to your project directory:
cd /my/cloud/project
. - Get the package you want to use:
go
get
cloud.google.com/go/chat
Learn more:
Ruby
To install the client library:
gem
install
google-apps-chat
Learn more:
PHP
To install the client library:
- If necessary, install the dependency manager Composer .
- From your command line interface, run:
composer
require
google/apps-chat
Learn more:
.NET
To install the client library:
Install the Google.Apps.Chat.V1
package from NuGet. Add it to your
project in the normal way (for example by right-clicking on the project in
Visual Studio and choosing "Manage NuGet Packages..."). Make sure you
enable pre-release packages (for example, in the Visual Studio NuGet user
interface, check the "Include prerelease" box).
To install the NuGet package, visit Google.Apis at NuGet.org .
Learn more:
Install Google API Client Libraries
An alternative to Cloud Client Libraries, Google API Client Libraries provide programmatic access to Chat API using REST resources and methods. You might prefer to use Google API Client Libraries if you use a language that does not have a Cloud Client Library, or if you are extending a project that already uses them.
Chat API provides Google API Client Libraries for the following languages. Select the language that you want to use:
Go
Get the latest Google Chat API client library for Go () . Read the client library's developer's guide .
Java
This page contains information about getting started with the Google Chat API by using the Google API Client Library for Java. For more information, see the following documentation:
Add the client library to your project
Select your build environment (Maven or Gradle) from the following tabs:
Add the following to your pom.xml
file:
See all versions available on the Maven Central Repository .