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.
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.
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.
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 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.
Spaceresource 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 are users and Chat apps that have joined or are invited to a space.
Memberresource represents a member.
Members support the following methods:
- Create a membership to add a user or app to a space.
- Get a membership to see details about a membership.
- List memberships to see a paginated, filterable list of memberships in a space.
- Delete a membership to remove a user or app from a space.
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.
Messageresource represents a message.
Messages support the following methods:
- Create a message to post a text or card message. You can also start or reply to a message thread.
- Get a message to get details about a message, like when it was sent or what it says.
- List messages to see a paginated, filterable list of messages in a space.
- Update a message to change message attributes, such as what it says. You can also append text to a card message, or a card to a text message.
- Delete a message when it's no longer needed.
Reactions represent the emoji people use to react to a message, such as 👍, 🚲, and 🌞.
Reactionresource represents a reaction.
Reactions support the following methods:
- Create a reaction to append an emoji to a message.
- List reactions to see a paginated, filterable list of reactions to a message.
- Delete a reaction to remove an emoji from the message.
- Media and attachments
Media represents a file uploaded to Google Chat, like images, videos, and documents.
Mediaresource represents media attached to messages.
Attachments are instances of media (files) attached to messages.
Attachmentresource represents an attachment. An attachment includes the media and associated metadata attached to a message.
Media and attachments support the following methods:
- Upload media as an attachment to upload media to Google Chat and then attach it to a message.
- Download media as an attachment to download media from Google Chat as a binary file.
- Get an attachment to retrieve metadata about a message attachment.
Locate the discovery document
The discovery document for this API is located at the following URL: