> ## Documentation Index
> Fetch the complete documentation index at: https://hc.saas-manager.biz.nuro.jp/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Chat integration

> Learn how to connect AI Helpdesk to Google Chat so that users can send inquiries to the AI bot from spaces, threads, and direct messages.

When you connect AI Helpdesk to Google Chat, users can send inquiries to the AI bot from Google Chat spaces, threads, and direct messages.

Google Chat integration uses the **Custom Bot** method, in which you configure a GCP project and a Google Chat app in your own environment. Replies in threads are supported.

## Prerequisites

<Info>
  * You must have the **Admin** role in AI Helpdesk.
  * You must have **Google Workspace super admin** access (required to configure domain-wide delegation).
  * You need access to the **Google Cloud Console (GCP)** (it can be the same account as your Google Workspace admin, or a different one).
</Info>

## Required information

The connection form asks for the four values below. You will collect them as you go through the steps.

| Item                     | Description                                                                             |
| ------------------------ | --------------------------------------------------------------------------------------- |
| **GCP Project Number**   | The **Project number** of your GCP project (numeric — not the Project ID)               |
| **Service Account JSON** | The full JSON key file of the service account                                           |
| **Bot Display Name**     | The bot's display name in Google Chat (same value as the App name set in Step 5)        |
| **Admin Email**          | The Google Workspace **super admin** email address the service account will impersonate |

## Step 1: Create a GCP project

<Steps>
  <Step title="Open the Google Cloud Console">
    Go to [https://console.cloud.google.com](https://console.cloud.google.com) and click the project selector at the top of the page, then click **New Project**.
  </Step>

  <Step title="Create the project">
    Enter a project name (e.g. `minabot-chat`) and click **Create**.
    Once created, select the project.
  </Step>

  <Step title="Copy the Project Number">
    From the **Dashboard**, copy the **Project number** in the **Project info** card (e.g. `123456789012`).
    This is the **GCP Project Number** in the connection form.

    <Warning>
      Use the **Project number** (numeric value), not the **Project ID**.
    </Warning>
  </Step>
</Steps>

## Step 2: Enable the required APIs

In the GCP project, open **APIs & Services > Library** and enable the following two APIs.

* **Google Chat API**
* **Admin SDK API**

## Step 3: Create a service account

<Steps>
  <Step title="Create the service account">
    Open **IAM & Admin > Service Accounts** in the GCP project and click **Create Service Account**.

    * Name: any value (e.g. `minabot-chat-bot`)
    * Description: optional

    Click **Create and Continue**, then click **Done** without assigning roles.
  </Step>

  <Step title="Download the JSON key">
    Click the service account you just created and open the **Keys** tab.
    Click **Add Key > Create new key**, choose **JSON**, and click **Create**.

    A JSON file is downloaded automatically.

    <Warning>
      The JSON file cannot be re-downloaded. Store it securely.
    </Warning>

    The **entire JSON** (including the surrounding braces) is the value you will paste into the **Service Account JSON** field.
  </Step>
</Steps>

## Step 4: Set up domain-wide delegation (DWD)

This allows the service account to look up users in your Google Workspace directory.

<Steps>
  <Step title="Enable DWD on the service account">
    In GCP, open **IAM & Admin > Service Accounts** and select your service account.
    On the **Details** tab, expand **Advanced settings** and enable **Domain-wide delegation**, then save.

    Take note of the **Client ID** (numeric) that appears after saving.
  </Step>

  <Step title="Authorize the OAuth scopes in the Google Workspace Admin Console">
    Open [https://admin.google.com](https://admin.google.com) and go to **Security > Access and data control > API controls**.
    Under **Manage Domain Wide Delegation**, click **Add new**.

    * **Client ID**: the value noted in the previous step
    * **OAuth scopes**: enter the three scopes below as a **single comma-separated line**

      * `https://www.googleapis.com/auth/chat.spaces.create`
      * `https://www.googleapis.com/auth/admin.directory.user.readonly`
      * `https://www.googleapis.com/auth/chat.bot`

      Copy the following line as-is (no whitespace between commas):

      ```text theme={null}
      https://www.googleapis.com/auth/chat.spaces.create,https://www.googleapis.com/auth/admin.directory.user.readonly,https://www.googleapis.com/auth/chat.bot
      ```

    Click **Authorize**.
  </Step>

  <Step title="Decide on the Admin Email">
    Decide which Google Workspace super admin email address the service account will impersonate (e.g. `admin@example.com`).
    This is the **Admin Email** value in the connection form.
  </Step>
</Steps>

## Step 5: Configure the Google Chat app

<Steps>
  <Step title="Open the Google Chat API configuration">
    In your GCP project, open **APIs & Services > Google Chat API > Configuration**.
  </Step>

  <Step title="Fill in basic information">
    * **App name**: the bot's display name (e.g. `Mina`)
    * **Avatar URL**: optional (URL of the bot's icon)
    * **Description**: optional
  </Step>

  <Step title="Configure functionality and connection">
    Under **Functionality**, enable:

    * **Receive 1:1 messages**
    * **Join spaces and group conversations**

    Under **Connection settings**, choose **App URL** and enter:

    ```text theme={null}
    https://assist.i.moneyforward.com/chat/googlechat
    ```
  </Step>

  <Step title="Set the visibility">
    Under **Permissions**, choose the visibility:

    * **Specific people and groups in your domain** (recommended for testing)
    * **Everyone in your domain**

    Click **Save**.
  </Step>
</Steps>

## Step 6: Add the bot to a space

In Google Chat, open the space where you want to use the bot and:

1. Click the space name > **Apps & integrations** > **Add apps**.
2. Search for your configured app name and click **Add**.

The bot is now active in that space.

## Step 7: Finish the connection in AI Helpdesk

<Steps>
  <Step title="Open integration settings">
    In **Settings > Integrations > Messaging** of AI Helpdesk, click **Add connection** and choose **Google Chat — Custom Bot**.

    {/* ![Screenshot: Settings > Integrations > Google Chat (Custom Bot) form](/images/ai-helpdesk/placeholder.png) */}
  </Step>

  <Step title="Enter the credentials">
    Enter the following values:

    * **GCP Project Number**: the numeric value from Step 1
    * **Service Account JSON**: the entire JSON downloaded in Step 3
    * **Bot Display Name**: the App name configured for the Google Chat app in Step 5
    * **Admin Email**: the Google Workspace super admin email from Step 4
  </Step>

  <Step title="Complete the connection">
    Click **Connect**.
    If the credentials are valid, the connected card appears in the **Messaging** section.
  </Step>
</Steps>

## Using the bot

Once connected, users can interact with the bot from Google Chat.

### Ask questions via direct message

Send a question to the bot in a direct message to receive an AI response.

### Mention the bot in a space

Mention the bot inside a space to receive an AI response in a thread.
Continue replying in the same thread to keep the session going.

## Disconnect Google Chat

In the **Messaging** section of **Settings > Integrations**, click the trash icon on the card to disconnect.

<Warning>
  Disconnecting stops accepting new inquiries from that Google Workspace.
</Warning>

## Troubleshooting

**"Invalid credentials"**

* Confirm that the **GCP Project Number** is the numeric value (not the Project ID).
* Confirm that the Service Account JSON includes the outer braces `{` `}` and is pasted in full.
* Confirm that the **Admin Email** is a Google Workspace **super admin** account.

**"Insufficient permissions"**

* Confirm that **Google Chat API** and **Admin SDK API** are both enabled (Step 2).
* Confirm that all required OAuth scopes are authorized in the Google Workspace Admin Console (Step 4).

**The bot is not responding**

* Confirm that the **Connection settings > App URL** in Step 5 points to the correct webhook URL.
* Confirm that the bot has been added to the space in Step 6.
* Confirm that you are correctly mentioning the bot in the space.

## Related pages

* [Slack integration](/en/ai-helpdesk/integrations/slack)
* [Microsoft Teams integration](/en/ai-helpdesk/integrations/teams)
* [LINE WORKS integration](/en/ai-helpdesk/integrations/line-works)
