> ## Documentation Index
> Fetch the complete documentation index at: https://developers.chatwoot.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GCS Bucket

> Configure Google Cloud Storage bucket as storage in Chatwoot

Chatwoot supports Google Cloud storage as the storage provider. To enable GCS in Chatwoot, follow the below mentioned steps.

Set google as the active storage service in the environment variables

```bash theme={null}
ACTIVE_STORAGE_SERVICE='google'
```

## Get project ID variable

Login to your Google Cloud console. On your home page of your project you will be able to see the project id and project name as follows.

<img src="https://mintcdn.com/chatwoot-447c5a93/qGPxFBLJOb0CiH-G/self-hosted/images/get-your-project-id.png?fit=max&auto=format&n=qGPxFBLJOb0CiH-G&q=85&s=b777295304487749a148292f0ca13d68" alt="get-your-project-id" width="3104" height="1974" data-path="self-hosted/images/get-your-project-id.png" />

```bash theme={null}
GCS_PROJECT=your-project-id
```

## Setup GCS Bucket

Go to Storage -> Browser. Click on "Create Bucket". You will be presented with a screen as shown below. Select the default values and continue.

<img src="https://mintcdn.com/chatwoot-447c5a93/0ZKii1AePO4f9gzo/self-hosted/images/create-a-bucket.png?fit=max&auto=format&n=0ZKii1AePO4f9gzo&q=85&s=3a7e06ddbeaa51538254770b9df5b722" alt="create-a-bucket" width="3104" height="1974" data-path="self-hosted/images/create-a-bucket.png" />

Once this is done you will get the bucket name. Set this as GCS\_BUCKET.

```bash theme={null}
GCS_BUCKET=your-bucket-name
```

## Setup a service account

Go to `Identity & Services -> Identity -> Service Accounts`. Click on "Create Service Account".

Provice a name and an ID for the service account, click on create. You will be asked to "Grant this service account access to the project" Select Cloud Storage -> Storage Admin as shown below.

<img src="https://mintcdn.com/chatwoot-447c5a93/B9wOdsckmqTHx3J4/self-hosted/images/storage-admin.png?fit=max&auto=format&n=B9wOdsckmqTHx3J4&q=85&s=1c12700e1a870be86eb58d19aed661cc" alt="storage-admin" width="3104" height="1974" data-path="self-hosted/images/storage-admin.png" />

## Add service account to the bucket

Go to Storage -> Browser -> Your bucket -> Permissions. Click on add. On "New members" field select the service account you just created.

Select role as `Cloud Storage -> Storage Admin` and save.

<img src="https://mintcdn.com/chatwoot-447c5a93/B9wOdsckmqTHx3J4/self-hosted/images/permissions.png?fit=max&auto=format&n=B9wOdsckmqTHx3J4&q=85&s=9798e9dc3dd7d06258b2002afa9649c4" alt="permissions" width="3104" height="1974" data-path="self-hosted/images/permissions.png" />

## Generate a key for the service account

Go to `Identity & Services -> Identity -> Service Accounts -> Your service account`. There is a section called **Keys**. Click on **Add Key**. You will be presented with an option like the one below. Select JSON from the option.

<img src="https://mintcdn.com/chatwoot-447c5a93/B9wOdsckmqTHx3J4/self-hosted/images/json.png?fit=max&auto=format&n=B9wOdsckmqTHx3J4&q=85&s=cc79430589122b9acbfb642f8c9509c6" alt="json" width="1122" height="706" data-path="self-hosted/images/json.png" />

Copy the json file content and set it as GCS\_CREDENTIALS

A sample credential file is of the following format.

```json theme={null}
{
  "type": "service_account",
  "project_id": "",
  "private_key_id": "",
  "private_key": "",
  "client_email": "",
  "client_id": "",
  "auth_uri": "",
  "token_uri": "",
  "auth_provider_x509_cert_url": "",
  "client_x509_cert_url": ""
}
```

When pasting the credentials to the ENV file, make sure to remove the new lines and paste it into a single line.

```bash theme={null}
GCS_CREDENTIALS={"type": "service_account","project_id": "","private_key_id": "","private_key": "","client_email": "","client_id": "","auth_uri": "","token_uri": "","auth_provider_x509_cert_url": "","client_x509_cert_url": ""}
```

<Note>
  If you are running Chatwoot v2.17+, make sure to wrap `GCS_CREDENTIALS` in single quotes.
</Note>
