Google Chat supports team collaboration by providing:
- Direct messages between users.
- Threaded conversations within spaces.
- Chat spaces that let you dedicate discussion space on a per-project, per-team, or other basis.
- Chat apps that can participate in spaces or respond to direct messages.
Interactions between Google Chat and apps take place using messages in the context of particular spaces. For example, an app may send some simple text (a type of message) into a specific chat space (a type of space).
The preceding diagram shows the different types of interactions and contexts available for messages and spaces:
Messages can have the following interactions:
- Event to an app.
- Simple text from an app.
- Card from an app.
Spaces can have the following contexts:
- Chat room
- Direct message
Messages
Messages between Google Chat and an app implementation follow a defined message format, where each message consists of a JSON object whose components specify the user ID, style, content, and other aspects of the message.
There are several kinds of messages used in the interaction of apps with Google Chat.
To apps
Messages from Google Chat to an app are known as events, and can be of several different types.
From apps
Messages from an app to Google Chat can have either or both of two kinds of content:
- Simple text contains plain text content with limited text formatting.
- Cards define the format, content, and behavior of cards to be displayed in the target space.
In the following example, a project management app replies to a query by building a list of data into a card data structure, and returning it to the chat. Google Chat then displays the card:
Spaces
A space in Google Chat is a generalization of chat spaces and direct messages. While each type of space has specific properties (for example, a chat space is visible to multiple users, while a direct message is not) the general concept of a space is often used.
For example, an app can send a message to a space, regardless of what kind of space it is. However, there can be constraints on that message that affect how it's handled, depending on the target space's specific type.