# google-chat-samples ships ten Chat apps in four languages, and one toggle to get right

> This repository is a catalogue of Google Chat app code samples, with Node.js, Python, Java and Apps Script implementations of the same ten patterns, from a basic synchronous bot to Pub/Sub, user authorization and incoming webhooks. It covers apps that are not built as Workspace add-ons, and the README is emphatic about the configuration setting you must change before any of it works.

**googleworkspace/google-chat-samples** — Google Chat app samples.

- Repository: https://github.com/googleworkspace/google-chat-samples
- Website: https://developers.google.com/workspace/chat/overview
- Stars: 605 · Forks: 286
- Language: JavaScript
- License: Apache-2.0
- Published: 2026-10-22 · Updated: 2026-10-22 · Language: en
- Canonical page: https://hysenlabs.com/projects/googleworkspace-google-chat-samples

## Samples for Chat apps that are not Workspace add-ons

The repository states its scope in the first paragraph. It contains the code samples for interactive Google Chat apps not built as Google Workspace add-ons, and most of them are featured in guides and tutorials hosted in the Developer Website.

That qualifier is the whole point of the repository, because Google splits its Chat samples across several places and mixing them up wastes an afternoon. The samples for interactive Google Chat apps built as Google Workspace add-ons are in a different repository, the one dedicated to Google Workspace add-ons, with Node.js, Python, Java and Apps Script subdirectories.

There is a third family as well. The code samples for the Google Chat API are in the Git repositories dedicated to Google Workspace APIs, again with Node.js, Python, Java and Apps Script directories for chat.

So the choice is between three sets, and this repository is the one for apps that are not add-ons.

The top level of the repository reflects that structure. There are four language directories, apps-script, java, node and python, plus a SECURITY.md, a CONTRIBUTING.md and a .vscode directory, and nothing else of substance. Each language folder holds a language-specific implementation of the samples, and the README is explicit that each sample has its own README file with the details on how to set it up and run it.

That is the shape of a reference repository rather than a library. There is no package to install, no API to import, and nothing that runs on its own.

## Ten patterns, from a synchronous bot to webhook messages

The sample list is the substance of the repository, and it is worth reading as a map of the interaction styles Google Chat supports.

The basic app receives event notices and messages from Google Chat and responds synchronously with text responses after verifying the requests, and it demonstrates creating an HTTP endpoint app using Google App Engine. The avatar app is the same shape but responds with card-formatted responses and runs on Google Cloud Run Function instead.

The Pub/Sub app uses Google Cloud Pub/Sub to receive messages from Google Chat and responds back asynchronously, which is the pattern you need when the work takes longer than a request cycle. The vote app demonstrates updating interactive cards by providing a platform whereby users can vote on topics, and the samples can feature images or be text-only.

The remaining samples cover the interactive surface. The contact form app handles input forms and data using cards, dialogs, form inputs and action parameters. The preview link app uses preview links to provide more information for links in messages. The app home app handles app home event notices and responds synchronously with cards, with both initialization and updates implemented. The selection input app uses external data sources to dynamically provide selection items in card widgets.

Two of them are about plumbing rather than UI. The User Auth app obtains authorization to call the Chat API with user credentials and stores the user tokens in a database to be reused later. The webhook app sends messages to Google Chat with incoming webhooks, which is the direction of travel the other nine do not cover.

## The Workspace add-on toggle has to be turned off

The first warning in the README is the most practical line in the file. It says to make sure to clear Build this Chat app as a Workspace add-on and click DISABLE when you configure brand new Chat apps to run these code samples.

This is the price of the repository's scope. The apps here are plain HTTP endpoint apps that you deploy and configure yourself, and the add-on packaging path in the Chat app configuration is a different model with its own expectations. If the setting is left in its default state, the sample you deployed will not behave the way the sample in front of you says it should, and the mismatch is not obvious from the code.

So the first action for anyone following along is a configuration change in the Google Workspace admin or Chat app setup, before the first request arrives. It is also the step most likely to be missed, because the failure appears later and looks like a bug in the sample rather than a packaging mismatch.

The other configuration note in the README is about who can even do this. The Google Chat application and the developer platform are only available to Google Workspace accounts, and you will not be able to develop or test an app with an @gmail.com account.

For a personal developer without a Workspace seat, that is a hard stop rather than a hurdle. It is worth checking the account type before you set up a local environment, because the sample code itself will look correct either way.

## Three deployment shapes: App Engine, Cloud Run Functions and Pub/Sub

The samples deliberately cover more than one hosting model, and the difference between them is the real architectural decision in the repository.

The basic app is an HTTP endpoint app on Google App Engine. The avatar app is an HTTP endpoint app on Google Cloud Run Function. Both respond synchronously: the request arrives, the handler verifies it, and the response goes back in the same cycle.

The Pub/Sub app breaks that pattern. It uses Google Cloud Pub/Sub to receive messages from Google Chat and responds to Google Chat asynchronously, which means the request handling and the reply are separated by a queue. That is the correct shape when a handler needs to do slow work, call other services, or survive a timeout, and it is the difference between a sample that demonstrates the API and a sample that demonstrates a real deployment.

Reading the list this way also explains why some samples exist at all. The User Auth app needs a database to store user tokens, and it is the one sample in the list whose state outlives a request. The webhook app inverts the direction, showing how a service pushes a message into a Chat space rather than responding to one.

Each of these choices is a different infrastructure bill and a different local development story, which is why the README defers the specifics to the per-sample README files rather than describing them here.

## How to actually run one of these

There is no install step to describe, because there is nothing to install. The repository is a set of source trees in four languages, and the README's guidance for running anything is: for additional details about how to set up and run each sample, consult the README file included with the sample.

That per-sample README is where the concrete steps live, and it is also where the sample-specific dependencies appear. The Node.js samples bring in the Google Chat API client and the Cloud Functions or App Engine plumbing, the Python samples have their own set, the Java samples use the Jetty or Spring style server that the Google samples normally use, and the Apps Script samples run in the Apps Script environment with no local server at all.

What the top level README does give you is the ordering of the work, and it is worth following it. You configure a Chat app in the Google Workspace admin or Chat developer console, with the add-on toggle disabled. You deploy the sample to its target platform. You point the app configuration at the deployed endpoint. Then you send a message in a Chat space where the app is present and watch the response come back.

The verification step is easy to overlook and useful to do early. The samples respond with identifiable output, so a message that comes back with the expected text confirms the whole path, including the request verification that the basic app performs.

## Licence, ownership and what the repository is not

Two lines in the licensing section are worth reading together. The repository says it is not an official product, and it is licensed under Apache 2.0 with the full licence text in the LICENSE file.

The distinction matters for what you can expect from it. The code is covered by a well known permissive licence, so you can copy it into a project, modify it, and use it commercially, with attribution and the notice retained. What it does not carry is any commitment from Google to maintain the samples, to keep them in step with API changes, or to support them.

The maintenance facts are modest. The repository has no GitHub releases, and the last push was on 2026-06-22. It is not archived.

For a samples repository, that is a normal position. Samples exist to show a pattern at a point in time, and the durable documentation is the Developer Website guides and tutorials that the README links, which are maintained separately and are the place to look for whether a given sample still reflects current practice.

The SECURITY.md file at the root tells you where security issues go, and CONTRIBUTING.md is the entry point for changes. A per-language directory is the unit of contribution, since each sample has to be maintained in four implementations.

## Conclusion

google-chat-samples suits an engineer who needs a working reference for a Google Chat interaction pattern and would rather read a sample than read the API documentation, especially if you work in more than one of the four supported languages. It is the wrong tool if you are building a Workspace add-on, if you are only calling the Chat API, or if you want a framework rather than examples. Verify first that you are in the right repository for your case, because the add-on samples and the Chat API samples live in separate ones, and check that your Google account is a Workspace account before you start, since an @gmail.com account cannot develop or test a Chat app.

## FAQ

### Do I need a Google Workspace account to develop a Google Chat app?

Yes. The README states that the Google Chat application and the developer platform are only available to Google Workspace accounts, and that you will not be able to develop or test an app with an @gmail.com account.

### What configuration change do the Google Chat samples require?

When you configure a brand new Chat app, clear the Build this Chat app as a Workspace add-on option and click DISABLE, so that the app runs as a plain HTTP endpoint app the way these samples expect.

### Where are the Google Chat samples for Workspace add-ons and for the Chat API?

Samples for apps built as Workspace add-ons are in the repository dedicated to Google Workspace add-ons, and samples for the Google Chat API are in the repositories dedicated to Google Workspace APIs, each with Node.js, Python, Java and Apps Script directories.

### Which languages do the Google Chat code samples cover?

Each language folder holds a language-specific implementation of the samples, and the repository covers Node.js, Python, Java and Apps Script, with a README file included with each sample explaining how to set it up and run it.

## Sources

- [googleworkspace/google-chat-samples on GitHub](https://github.com/googleworkspace/google-chat-samples)
- [Issues](https://github.com/googleworkspace/google-chat-samples/issues)
- [License: Apache-2.0](https://github.com/googleworkspace/google-chat-samples/blob/main/LICENSE)
- [Project website](https://developers.google.com/workspace/chat/overview)
- [README](https://github.com/googleworkspace/google-chat-samples/blob/main/README.md)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/googleworkspace-google-chat-samples
