> For the complete documentation index, see [llms.txt](https://docs.kognitos.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kognitos.com/legacy/legacy-experience/books/reference/googlechat.md).

# Google Chat

Procedures and concepts for the Google Chat integration.

{% hint style="info" %}
The following documentation is for **Google Chat v2.11.0** *(BDK)*.
{% endhint %}

## Overview

Google Chat is the team messaging service in Google Workspace. This integration enables automated message posting and space management workflows.

## Prerequisites

### 1. Required Books

The following Book(s) need to be added to your agent so it can learn and understand the automation procedures defined within them:

* **Google Chat**

#### How to Add the Book(s)

1. Go to **Books** → **All Books**.
2. Search for the name of the book and click on it.
3. Click on <kbd>**Install**</kbd> or <kbd>**Add Connection**</kbd> to add the book to your agent.
4. If adding a connection, you'll be prompted for [**connectivity**](#connectivity) details.

## Connectivity

This section outlines the available methods for connecting to the Book, along with the required configuration details for each.

## Procedures

### to add a (chat reaction) to a chat message

Add an emoji reaction to a Google Chat message.

**Input Concepts**

| Concept                           | Description                                      | Type                  | Required | Default Value |
| --------------------------------- | ------------------------------------------------ | --------------------- | -------- | ------------- |
| [`message`](#google-chat-message) | The message to add the reaction to.              | `google chat message` | Yes      | (no default)  |
| `emoji`                           | The emoji to react with (e.g. "👍", "😀", "🎉"). | `text`                | Yes      | (no default)  |

**Output Concepts**

| Concept                                  | Description           | Type                   |
| ---------------------------------------- | --------------------- | ---------------------- |
| [`chat reaction`](#google-chat-reaction) | The created reaction. | `google chat reaction` |

**Examples**

Add a thumbs up reaction to a message

```generic
get chat spaces from google chat
use the first chat space as the space
get the space's chat messages from google chat
use the first chat message as the message
add a reaction to the message in google chat with
... the emoji is "👍"
```

### to create a (direct message space) in *google chat*

Create a direct message space with a user, or return the existing one.

If a direct message space already exists with the specified user, that existing space is returned instead of creating a new one.

**Input Concepts**

| Concept | Description                                                    | Type   | Required | Default Value |
| ------- | -------------------------------------------------------------- | ------ | -------- | ------------- |
| `email` | The email address of the user to create a direct message with. | `text` | Yes      | (no default)  |

**Output Concepts**

| Concept                                      | Description                                       | Type                |
| -------------------------------------------- | ------------------------------------------------- | ------------------- |
| [`direct message space`](#google-chat-space) | The direct message space with the specified user. | `google chat space` |

**Examples**

Create a DM space with a user

```generic
create a direct message space in google chat whose email is "user@example.com"
```

Create a DM and send a notification

```generic
create a direct message space in google chat whose email is "user@example.com"
use the above as the space
send a chat message in google chat with
... the space is the space
... the text is "Your automation has completed successfully."
```

### to find a (direct message space) in *google chat*

Find an existing direct message space with a specific user.

**Input Concepts**

| Concept | Description                                                          | Type   | Required | Default Value |
| ------- | -------------------------------------------------------------------- | ------ | -------- | ------------- |
| `email` | The email address of the user to find the direct message space with. | `text` | Yes      | (no default)  |

**Output Concepts**

| Concept                                      | Description                                       | Type                |
| -------------------------------------------- | ------------------------------------------------- | ------------------- |
| [`direct message space`](#google-chat-space) | The direct message space with the specified user. | `google chat space` |

**Examples**

Find a DM space with a user by email

```generic
find a direct message space in google chat whose email is "user@example.com"
```

### to get a (chat message) from *google chat*

Get details about a specific Google Chat message.

**Input Concepts**

| Concept                           | Description                     | Type                  | Required | Default Value |
| --------------------------------- | ------------------------------- | --------------------- | -------- | ------------- |
| [`message`](#google-chat-message) | The message to get details for. | `google chat message` | Yes      | (no default)  |

**Output Concepts**

| Concept                                | Description                         | Type                  |
| -------------------------------------- | ----------------------------------- | --------------------- |
| [`chat message`](#google-chat-message) | The chat message with full details. | `google chat message` |

**Examples**

Get details about a message

```generic
get chat spaces from google chat
use the first chat space as the space
get the space's chat messages from google chat
use the first chat message as the message
get the message from google chat
```

### to get a (chat space's read state) from *google chat*

Get the read state of a Google Chat space for the authenticated user.

This indicates the last time the user read the space, which can be used to determine if there are unread messages.

**Input Concepts**

| Concept                       | Description                            | Type                | Required | Default Value |
| ----------------------------- | -------------------------------------- | ------------------- | -------- | ------------- |
| [`space`](#google-chat-space) | The space to check the read state for. | `google chat space` | Yes      | (no default)  |

**Output Concepts**

| Concept                                                    | Description                                        | Type                           |
| ---------------------------------------------------------- | -------------------------------------------------- | ------------------------------ |
| [`chat space's read state`](#google-chat-space-read-state) | The space read state including the last read time. | `google chat space read state` |

**Examples**

Check if there are unread messages in a space

```generic
get chat spaces from google chat
use the first chat space as the space
get the space's space read state from google chat
```

### to get a (chat space) from *google chat*

Get details about a specific Google Chat space.

**Input Concepts**

| Concept                       | Description                                                                              | Type                | Required | Default Value |
| ----------------------------- | ---------------------------------------------------------------------------------------- | ------------------- | -------- | ------------- |
| [`space`](#google-chat-space) | The space to get details for. Use the space's resource name (e.g. "spaces/AAAAAAAAAAA"). | `google chat space` | Yes      | (no default)  |

**Output Concepts**

| Concept                            | Description                       | Type                |
| ---------------------------------- | --------------------------------- | ------------------- |
| [`chat space`](#google-chat-space) | The chat space with full details. | `google chat space` |

**Examples**

Get details about a space

```generic
get chat spaces from google chat
use the first chat space as the space
get the space from google chat
```

### to get some (chat message's chat reactions)

Get reactions on a Google Chat message.

**Input Concepts**

| Concept                                | Description                         | Type                  | Required | Default Value |
| -------------------------------------- | ----------------------------------- | --------------------- | -------- | ------------- |
| [`chat message`](#google-chat-message) | The message to list reactions from. | `google chat message` | Yes      | (no default)  |

**Output Concepts**

| Concept                                                  | Description                        | Type                   |
| -------------------------------------------------------- | ---------------------------------- | ---------------------- |
| [`chat message's chat reactions`](#google-chat-reaction) | The chat message's chat reactions. | `google chat reaction` |

**Examples**

List reactions on a message

```generic
get chat spaces from google chat
use the first chat space as the space
get the space's chat messages from google chat
use the first chat message as the message
get the message's chat reactions from google chat
```

### to get some (chat message's thread messages) from *google chat*

Get all messages in a thread, given any message from that thread.

**Input Concepts**

| Concept                                | Description                                                  | Type                  | Required | Default Value |
| -------------------------------------- | ------------------------------------------------------------ | --------------------- | -------- | ------------- |
| [`chat message`](#google-chat-message) | A message belonging to the thread to retrieve messages from. | `google chat message` | Yes      | (no default)  |
| `max result count`                     | Maximum number of messages to retrieve (default: 25).        | `number`              | No       | 25            |

**Output Concepts**

| Concept                                                  | Description                         | Type                  |
| -------------------------------------------------------- | ----------------------------------- | --------------------- |
| [`chat message's thread messages`](#google-chat-message) | The chat message's thread messages. | `google chat message` |

**Examples**

Retrieve all replies in a thread

```generic
get chat spaces from google chat
use the first chat space as the space
get the space's chat messages from google chat
use the first chat message as the message
get the message's thread messages from google chat
```

### to get some (chat space's chat members) from *google chat*

![FILTER - CAPABLE](https://img.shields.io/static/v1?label=FILTER\&message=CAPABLE\&color=blue)

Get members of a Google Chat space.

**Input Concepts**

| Concept                            | Description                     | Type                | Required | Default Value |
| ---------------------------------- | ------------------------------- | ------------------- | -------- | ------------- |
| [`chat space`](#google-chat-space) | The space to list members from. | `google chat space` | Yes      | (no default)  |

**Output Concepts**

| Concept                                            | Description                    | Type                 |
| -------------------------------------------------- | ------------------------------ | -------------------- |
| [`chat space's chat members`](#google-chat-member) | The chat space's chat members. | `google chat member` |

**Examples**

List all members of a space

```generic
get chat spaces from google chat
use the first chat space as the space
get the space's chat members from google chat
```

Find a member by email

```generic
get chat spaces from google chat
use the first chat space as the space
get the space's chat members from google chat whose email is "user@example.com"
```

### to get some (chat space's chat messages) from *google chat*

![FILTER - CAPABLE](https://img.shields.io/static/v1?label=FILTER\&message=CAPABLE\&color=blue)

Get messages from a Google Chat space.

**Input Concepts**

| Concept                            | Description                                           | Type                | Required | Default Value |
| ---------------------------------- | ----------------------------------------------------- | ------------------- | -------- | ------------- |
| [`chat space`](#google-chat-space) | The space to retrieve messages from.                  | `google chat space` | Yes      | (no default)  |
| `max result count`                 | Maximum number of messages to retrieve (default: 25). | `number`            | No       | 25            |

**Output Concepts**

| Concept                                              | Description                     | Type                  |
| ---------------------------------------------------- | ------------------------------- | --------------------- |
| [`chat space's chat messages`](#google-chat-message) | The chat space's chat messages. | `google chat message` |

**Examples**

Retrieve messages from a space

```generic
get chat spaces from google chat
use the first chat space as the space
get the space's chat messages from google chat
```

Retrieve messages with a filter

```generic
get chat spaces from google chat
use the first chat space as the space
get the space's chat messages from google chat whose sender_display_name is "John"
```

### to get some (chat spaces) from *google chat*

![FILTER - CAPABLE](https://img.shields.io/static/v1?label=FILTER\&message=CAPABLE\&color=blue)

Get spaces from Google Chat that the authenticated user is a member of.

**Output Concepts**

| Concept                             | Description              | Type                |
| ----------------------------------- | ------------------------ | ------------------- |
| [`chat spaces`](#google-chat-space) | The list of chat spaces. | `google chat space` |

**Examples**

Retrieve all spaces

```generic
get chat spaces from google chat
```

Retrieve spaces with a specific name

```generic
get chat spaces from google chat whose display_name is "Engineering"
```

### to send a (chat message) in *google chat*

Send a message to a Google Chat space.

**Input Concepts**

| Concept                       | Description                            | Type                | Required | Default Value |
| ----------------------------- | -------------------------------------- | ------------------- | -------- | ------------- |
| [`space`](#google-chat-space) | The space to send the message to.      | `google chat space` | Yes      | (no default)  |
| `text`                        | The plain-text content of the message. | `text`              | Yes      | (no default)  |

**Output Concepts**

| Concept                                | Description            | Type                  |
| -------------------------------------- | ---------------------- | --------------------- |
| [`chat message`](#google-chat-message) | The sent chat message. | `google chat message` |

**Examples**

Send a message to a space

```generic
get chat spaces from google chat
use the first chat space as the space
send a chat message in google chat with
... the space is the space
... the text is "Hello, team!"
```

Send a notification to a user via direct message

```generic
find a direct message space in google chat whose email is "user@example.com"
use the above as the space
send a chat message in google chat with
... the space is the space
... the text is "Your automation has completed successfully."
```

### to send a (chat thread reply) in *google chat*

Reply to a message in a Google Chat thread.

**Input Concepts**

| Concept                           | Description                                                           | Type                  | Required | Default Value |
| --------------------------------- | --------------------------------------------------------------------- | --------------------- | -------- | ------------- |
| [`message`](#google-chat-message) | The message to reply to. The reply will be posted in the same thread. | `google chat message` | Yes      | (no default)  |
| `text`                            | The plain-text content of the reply.                                  | `text`                | Yes      | (no default)  |

**Output Concepts**

| Concept                                     | Description             | Type                  |
| ------------------------------------------- | ----------------------- | --------------------- |
| [`chat thread reply`](#google-chat-message) | The sent reply message. | `google chat message` |

**Examples**

Reply to a message in a thread

```generic
get chat spaces from google chat
use the first chat space as the space
get the space's chat messages from google chat
use the first chat message as the message
reply to the message in google chat with
... the text is "Thanks for the update!"
```

### to update a (chat message) in *google chat*

Update the text of an existing Google Chat message.

**Input Concepts**

| Concept                           | Description                                 | Type                  | Required | Default Value |
| --------------------------------- | ------------------------------------------- | --------------------- | -------- | ------------- |
| [`message`](#google-chat-message) | The message to update.                      | `google chat message` | Yes      | (no default)  |
| `text`                            | The new plain-text content for the message. | `text`                | Yes      | (no default)  |

**Output Concepts**

| Concept                                | Description               | Type                  |
| -------------------------------------- | ------------------------- | --------------------- |
| [`chat message`](#google-chat-message) | The updated chat message. | `google chat message` |

**Examples**

Update a message's text

```generic
get chat spaces from google chat
use the first chat space as the space
get the space's chat messages from google chat
use the first chat message as the message
update the message in google chat with
... the text is "Updated message content"
```

## Concepts

### Google chat message

A Google Chat Message represents a message in a Google Chat space.

| Field Name            | Description                                                          | Type                |
| --------------------- | -------------------------------------------------------------------- | ------------------- |
| `name`                | The resource name of the message (e.g. "spaces/AAAA/messages/BBBB"). | `text`              |
| `text`                | The plain-text body of the message.                                  | `optional[text]`    |
| `formatted_text`      | The message text with formatting markup.                             | `optional[text]`    |
| `sender_name`         | The resource name of the sender (e.g. "users/123456").               | `optional[text]`    |
| `sender_display_name` | The display name of the sender.                                      | `optional[text]`    |
| `sender_email`        | The email address of the sender.                                     | `optional[text]`    |
| `thread_name`         | The resource name of the thread this message belongs to.             | `optional[text]`    |
| `thread_reply`        | Whether this message is a reply in a thread.                         | `optional[boolean]` |
| `space_name`          | The resource name of the space containing this message.              | `optional[text]`    |
| `create_time`         | When the message was created.                                        | `optional[text]`    |
| `last_update_time`    | When the message was last edited.                                    | `optional[text]`    |

### Google chat reaction

A Google Chat Reaction represents a reaction on a message.

| Field Name          | Description                                  | Type             |
| ------------------- | -------------------------------------------- | ---------------- |
| `name`              | The resource name of the reaction.           | `text`           |
| `emoji_unicode`     | The unicode string of the emoji (e.g. "👍"). | `optional[text]` |
| `emoji_custom_name` | The name of the custom emoji, if applicable. | `optional[text]` |
| `user_name`         | The resource name of the user who reacted.   | `optional[text]` |
| `user_display_name` | The display name of the user who reacted.    | `optional[text]` |

### Google chat space

A Google Chat Space represents a conversation space in Google Chat.Spaces can be named spaces (rooms), group chats, or direct messages.

| Field Name         | Description                                                                           | Type               |
| ------------------ | ------------------------------------------------------------------------------------- | ------------------ |
| `name`             | The resource name of the space (e.g. "spaces/AAAAAAAAAAA").                           | `text`             |
| `display_name`     | The display name of the space.                                                        | `optional[text]`   |
| `space_type`       | The type of space (SPACE, GROUP\_CHAT, or DIRECT\_MESSAGE).                           | `optional[text]`   |
| `threading_state`  | The threading state (THREADED\_MESSAGES, GROUPED\_MESSAGES, or UNTHREADED\_MESSAGES). | `optional[text]`   |
| `description`      | The description of the space.                                                         | `optional[text]`   |
| `guidelines`       | The space's rules and expectations.                                                   | `optional[text]`   |
| `create_time`      | When the space was created.                                                           | `optional[text]`   |
| `last_active_time` | Timestamp of the last message in the space.                                           | `optional[text]`   |
| `member_count`     | The number of human members in the space.                                             | `optional[number]` |
| `space_uri`        | The URI for a user to access the space.                                               | `optional[text]`   |

### Google chat space read state

A Google Chat Space Read State indicates the last read time for a user in a space.

| Field Name       | Description                                 | Type             |
| ---------------- | ------------------------------------------- | ---------------- |
| `name`           | The resource name of the space read state.  | `text`           |
| `last_read_time` | The time when the user last read the space. | `optional[text]` |

### Google chat member

A Google Chat Member represents a membership in a Google Chat space.

| Field Name     | Description                                                            | Type             |
| -------------- | ---------------------------------------------------------------------- | ---------------- |
| `name`         | The resource name of the membership (e.g. "spaces/AAAA/members/BBBB"). | `text`           |
| `member_name`  | The resource name of the member user (e.g. "users/123456").            | `optional[text]` |
| `display_name` | The display name of the member.                                        | `optional[text]` |
| `email`        | The email address of the member.                                       | `optional[text]` |
| `member_type`  | The type of member (HUMAN or BOT).                                     | `optional[text]` |
| `role`         | The role of the member in the space (ROLE\_MEMBER or ROLE\_MANAGER).   | `optional[text]` |
| `state`        | The membership state (JOINED, INVITED, or NOT\_A\_MEMBER).             | `optional[text]` |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.kognitos.com/legacy/legacy-experience/books/reference/googlechat.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
