Build Google Chat apps

You can build a Google Chat app using Google Apps Script, your own technical stack, or Google AppSheet.

To build a basic Chat app, see the following quickstarts:

Build interactive Google Chat apps

For users to interact with a Google Chat app, the app must receive and respond to Google Chat events. Chat apps can respond in a variety of way:

  • Send a simple text message, or interactive card message to users in Google Chat.
  • Open a dialog to help users complete multi-step processes, like filling in form data.
  • Unfurl links by attaching cards with helpful information that let users take action directly from the conversation.

Chat apps can also work with Chat data asynchronously by accessing REST resources with the Chat API. Common uses of Chat REST resources include the following tasks:

  • Create, delete, and update messages.
  • List people and Chat apps conversing in a space.
  • List all the spaces your Google Chat app has been added to.

Many Chat apps connect with external web apps and services to integrate them with Chat.

When you configure your Google Chat app, you must specify the endpoint of the service to receive and respond to events. To learn more about creating interactions, see the Events overview.

App access to user data

In order to operate in a useful way, when an app is invoked, it needs to know who is invoking it, in what context, and how to address the invoker. To access data beyond this basic identity data, the app must be granted access through authentication.

  • By default, apps can only read the basic identity of users that invoke them or users being @mentioned in the same message that invokes the app. This information includes the user's display name, user ID, email address, and avatar image.
  • For apps with link preview, the app can read URLs added to the message that match the app's configured URL patterns.
  • If an app needs to access other data to provide enhanced functionality to users, set up authentication so it can access that data. If accessing user data, the app prompts the user to ask for access, and the user must grant it.

Independence from users

Chat apps aren't associated with any particular user: anyone in your domain can add an app to a space or remove it. Once the app is added to a space, anyone in your domain can @mention it. Apps aren't accessible by external users who aren't in your domain.

Some use cases for apps

Adding apps to a conversational platform like Chat lets people ask questions, issue commands, and so on without changing context. On its backend, an app can access other systems, acting as an intermediary to those systems.

This ability to provide access to a wide range of resources and tools, while maintaining a unified cognitive experience, can provide an excellent framework for many types of applications, including the following:

  • Workflow management
  • Setup and configuration
  • Order generation
  • Search
  • Data collection

Some examples of things you might ask an app to do from within the Chat space include the following:

  • Look up information — An app can retrieve information based on structured or free text queries entered by the user.
  • File tickets — An app can generate incident reports or other artifacts, using information provided by the user.
  • Coordinate efforts — An app can enhance the way that team members interact with each other, such as providing "team memory" or scheduling resources.

Google Chat API

The Chat API provides a number of ways that you can integrate your apps into Chat spaces and DMs, but does not provide or dictate any particular way to implement the app logic. You can create a simple command-driven app or use any kind of language processing and AI services or modules that you like, and you can do this on a variety of platforms, including the following:

  • Apps Script
  • Google Cloud
  • Cloud or an on-premises HTTP server

For more information, see App implementation architectures.

Standard features

When you configure an app in Chat, it must provide an identity consisting of the following:

  • The app name
  • An avatar image for the app
  • Identity of the app developer

Apps should also provide a help command or the equivalent to help users get started using the app.

App communication with Chat

Apps can receive messages from, and send messages to, Chat. These messages use defined message formats, which can render as simple text messages or interactive cards in Chat.

Apps in direct messages (DM)

You can configure an app so that it responds to direct messages. This provides a one-to-one conversational interface that involves a single user.

Apps in Chat spaces

You can add an app to a Chat space, so that it can respond to specific content that appears in the space. For example, you can specify that any message that begins with "@altostrat" is passed to the altostrat app and the response appears in the chat space. The following sequence diagram summarizes the app behavior:

Sequence of a Google Chat app in a Chat space.

Chat communicates with your app via an endpoint, which can be one of the following types:

  • HTTP (web service) endpoints can accommodate various styles of interaction.
  • Cloud Pub/Sub endpoints let your app subscribe to a topic that relays messages from Chat, even if the implementation is behind a firewall.

For more information about the different ways that you can connect Chat with your app, see Endpoint types.

Chatbots in Chat

Chatbots, or "bots" for short, are computer programs that interact with people in a way that mimics human interaction to some degree. The interaction can vary in complexity from simple keyword-driven queries to elaborate conversational systems using natural language processing and AI techniques. This conversational form of human-computer interaction can act as a framework for many types of useful applications.

Early chatbots included academic curiosities like Eliza (1964) and Julia (1994), but now bots are at work all over the internet in customer support, as virtual assistants like Google Assistant, and in many other roles.

A Google Chat app can be called a chatbot, and including "bot" in your app name is a fun way to represent your service. Because Chat apps are fully functional web applications and services, we encourage you to think of Chat apps as more than "just bots".