This section explain 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 without being prompted by a Chat app interaction event.
Authentication
Calling the Chat API asynchronously 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.
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
spaces
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
spaces.members
resource 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.
- Update a membership to change attributes about a membership, like changing a space member to a space manager, or changing a space manager to a space member.
- Delete a membership to remove a user or app from a space.
- 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
spaces.messages
resource 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
Reactions represent the emoji people use to react to a message, such as 👍, 🚲, and 🌞.
The
spaces.messages.reactions
resource 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.
The
media
resource represents media attached to messages.Attachments are instances of media (files) attached to messages.
The
spaces.messages.attachments
resource 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.
- Space events
Space events represent changes to a space or its child resources, including its members, messages, and reactions.
The
spaces.spaceEvent
resource represents a space event.Space events support the following methods:
- Get a space event to return details about an event that occurred in a space.
- List space events to get a list of events that occurred in a space.
- 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.
The
users.spaces
resource represents a user's read state in a space.The
users.spaces.threads
resource represents a user's read state in a message thread.User read states support the following methods:
- Get space read state to return details about a user's read state within a space.
- Update space read state to update a user's read state within a space.
- Get thread read state to return details about a user's read state within a thread.
Related topics
- Explore Google Chat app samples to get started with using the Chat API.
- Google Chat API reference documentation