Google Chat API overview

The Google Chat API includes REST resources, methods, and Chat events.

The guides in this section explain how a Google Chat app can call the Chat API, which lets Chat apps create a space, add people to it, and post a message without being prompted by an event.

Authentication

Chat apps can respond to events without authentication.

Calling Chat API asynchronously requires authentication. Each method requires either user authentication (to perform actions or access data on behalf of a user) or app authentication (to perform actions or access data as a Chat app). Some methods support both user authentication and app authentication.

To learn more about authentication in Chat, see Authentication overview.

Events

Chat events represent actions that Chat apps can respond to in real time, such as receiving messages, card clicks, and being added to or removed from a space. The event type represents events.

When an event (like receiving a message) occurs, a Chat app receives a JSON-formatted payload of information about the event (like who sent the message and what it says), which the Chat app uses to process and send a JSON-formatted response (a message or other user interaction) in real time without asynchronously calling Chat API. Events make interactive features like slash commands, dialogs, and link previews possible. Because event reception and response are configured as part of building a Chat app, events are documented as part of building Chat apps.

API resources and methods

REST resources and methods grant asynchronous access to Chat spaces, space members, messages, message reactions, and message attachments.

Spaces

Spaces are places where people and apps can converse and share files. There are several types of spaces. Direct messages (DMs) are 1:1 conversations between two users or a user and a Chat app. Group chats are conversations between three or more users and Chat apps. Named spaces are persistent places where people send messages, share files, and collaborate.

The Space resource represents a space.

Spaces support the following methods:

  • Create a space, a place where people and apps can converse and share files.
  • Set up a space to create the space, and add people and Chat apps to that space.
  • Get a space to see details about a space.
  • List spaces to see a paginated, filterable list of spaces.
  • Update a space to change attributes about a space, like its user-visible display name, description, and guidelines.
  • Delete a space when it's no longer needed.
  • Find a direct message (DM) to return a DM between two users, or a DM between a user and the calling Chat apps.
Members

Members are users and Chat apps that have joined or are invited to a space.

The Member resource represents a member.

Members support the following methods:

Messages

Messages include text and card communications posted in spaces. Messages can have files attached to them. People can react to messages by appending emoji to them.

The Message resource represents a message.

Messages support the following methods:

Reactions

Reactions represent the emoji people use to react to a message, such as 👍, 🚲, and 🌞.

The Reaction resource represents a reaction.

Reactions support the following methods:

Media and attachments

Media represents a file uploaded to Google Chat, like images, videos, and documents.

The Media resource represents media attached to messages.

Attachments are instances of media (files) attached to messages.

The Attachment resource represents an attachment. An attachment includes the media and associated metadata attached to a message.

Media and attachments support the following methods:

Locate the discovery document

The discovery document for this API is located at the following URL: