This section explains how a Google Chat app can call the Chat API, which lets Chat apps do things such as create a space, add people to it, and post a message.
Authentication
Calling the Chat API requires authentication. Each Chat API 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.
Client libraries
The recommended way for most developers to call the Google Chat API is with our officially supported Cloud Client Libraries for your preferred language, like Python, Java, or Node.js.
If you're coding with Google Apps Script, use the Advanced Chat service instead of installing a client library.
Google Chat API concepts
gRPC services or REST resources and methods grant access to Chat spaces, space members, messages, message reactions, message attachments, space events, and user read states.
- 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:
- Members
Members are users and Chat apps that have joined or are invited to a space.
Resource reference:
For example usage, see:
- 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.
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 (Developer Preview)
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:
- 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 (Developer Preview)
User space notification settings are singleton resources that represent a specified user notification settings in a Google Chat space.
Resource reference:
Related topics
- Explore Google Chat app samples to get started with using the Chat API.
In addition to calling Chat API, Chat apps can also:
- Receive and respond to Chat app interaction events, like messages sent to the Google Chat app, in real time.
- Subscribe to Google Chat events to take action or respond when certain activities or changes happen in Chat, like new messages and membership changes.