Develop with Google Chat (original) (raw)
This page provides an overview of the Google Chat API and Google Chat apps.
Google Chat API overview
The Chat API consists ofgRPC services or REST resources and methodsthat grant access to Chat, including spaces, space members, messages, message reactions, message attachments, space events, and user read states.
Concepts
The following section defines the services, resources, and methods for the Chat API:
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.
Resource reference:
For example usage, see:
- Create a space
- Set up a space
- Get a space
- List spaces
- Update a space
- Delete a space
- Find a direct message (DM)
Members
Members are users and Chat apps that have joined or are invited to a space.
Resource reference:
For example usage, see:
Messages
Messages includetextandcardcommunications posted in spaces. Messages can have files attached to them. People can react to messages by appending emoji to them.
Resource reference:
For example usage, see:
Reactions
Reactions represent the emoji people use to react to a message, such as 👍, 🚲, and 🌞.
Resource reference:
For example usage, see:
Custom emoji
Custom emoji represent custom emoji created and shared within the organization in Google Chat. Custom emoji can be included in the content of a message or used to react to a message.
Resource reference:
For example usage, see:
- Create a custom emoji
- Delete a custom emoji
- Get details about a custom emoji
- List custom emojis in an organization
Media and attachments
Media represents a file uploaded to Google Chat, like images, videos, and documents.
Media resource reference (Unavailable in RPC):
Attachments are instances of media (files) attached to messages.
Resource reference:
For example usage, see:
Space events
Space events represent changes to a space or its child resources, including its members, messages, and reactions.
Resource reference:
For example usage, see:
User read states
User read states are singleton resources that represent details about a specified user's last read message in a Google Chat space or a message thread.
Space read state resource reference:
Thread read state resource reference:
For example usage, see:
User space notification settings
User space notification settings are singleton resources that represent a specified user notification settings in a Google Chat space.
Resource reference:
Authentication
Calling the Chat API requires authentication. Each Chat API method requires eitheruser authentication(to perform actions or access data on behalf of a user) orapp 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, seeAuthentication overview.
Client libraries
The recommended way for most developers to call the Google Chat API is with our officially supportedCloud Client Librariesfor your preferred language, like Python, Java, or Node.js.
If you're coding with Google Apps Script, use theAdvanced Chat serviceinstead of installing a client library.
Build Chat apps
The Chat API lets you build Google Chat apps that bring your services and resources right into Google Chat. You can build Chat apps to do any of the following:
- Retrieve information based on structured or free text queries entered by the user.
- Generate incident reports or other artifacts, using information provided by the user.
- Enhance team collaboration, such as providing "team memory" or scheduling resources.
You can design your Chat app using several different architecture styles, including the following:
- Interactive apps: Respond to user interaction, such as @mentions or slash commands, and present information or guide users through a workflow with cards and dialogs.
- Command-line apps or webhooks: Send proactive messages, such as alarms or notifications, from another system into a space. Users can't directly interact with this type of app.
- Event-driven apps: Subscribe to and react to activity in a Chat space, such as a new member joining. In response to an event, the app can send a message or perform another action.
For details about designing your Chat app, seeChoose a Google Chat app architecture.