# Installation

## Setup a Google Chat service account

[Service accounts](https://developers.google.com/hangouts/chat/how-tos/service-accounts) are the primary way to interact with Google Cloud resources, and setting up a chatbot is no different.

The first step is to create a new Google Cloud project. Visit <https://console.cloud.google.com/projectcreate> and fill the required fields:

![](/files/-MOlBaf9YscO6XgpOVsx)

Then, [visit this page](https://console.cloud.google.com/marketplace/product/google/chat.googleapis.com) to enable the Google Chat API for this project:

![](/files/-MOlBtpZhhvK4WnWP469)

Then, go to Identity > Service Accounts in the menu (or visit <https://console.cloud.google.com/identity/serviceaccounts>) and create a service account for the project.

![](/files/-MOlCde0GJsixxFNyKoo)

In the next screen, grant the **Project > Editor** role to the service account:

![](/files/-MOlCl6iBIm4PFWDQydr)

The third step (*Grant users access to this service account*) is optional and can be skipped. Click on Done to create the service account.&#x20;

Once the service account is created, you will need to generate a key. Select the service account, click on **Add Key > Create New Key**, select **JSON** as the Key type, and save the file.

## Setup the channel in CSML Studio

In CSML Studio, under **Channels > Connect a new channel**, select the Google Chat channel. In the next screen, give your channel a name, a description and upload your service account credentials.

![](/files/-MOlcu3Dr6_lXn8brBR2)

In the next screen, you can configure the bot's Welcome Flow, and copy the **Chatbot Endpoint URL**, which we will use in the next step.

## Connect the chatbot with Google Chat

To finalize the configuration, visit <https://console.developers.google.com/apis/api/chat.googleapis.com/hangouts-chat> (make sure that the selected project is still the same one as before) and fill the information as requested.

![](/files/-MOle6I9UTNOdfN5KePo)

You can select **Bot works in direct messages** or **Bot works in rooms...** depending on the experience you want to give to users.

Under **Bot URL**, paste the **Chatbot Endpoint URL** from the previous step.

Click **Save**, and you are all set!

## Finding the bot in Google Chat

To find your bot in Google Chat, users have to navigate to the Bot catalog, which can be reached either by clicking the + icon next to the bot section of the left sidebar, or by searching for the name of the bot directly:

![](/files/-MOlpYr3fYgJahxue1XY)

Upon activating the bot for the first time, the Welcome Message will be displayed:

![](/files/-MOlpow9TiGy9x1Usd-N)


---

# Agent Instructions: 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:

```
GET https://docs.csml.dev/studio/channels/google-chat/installation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
