# Google Chat

Connect Google Chat to Factory and delegate work from space mentions and direct messages using your organization's agent profile.

Mention `@Factory` in a Google Chat space or send it a direct message to have Droid investigate, implement, and test work on a remote computer. Droid posts progress and results in the same thread.

<Info>
  Google Chat support in Delegations is in development, and features and setup steps may change.
</Info>

You delegate directly from Google Chat; you do not need to create a Software Factory automation. The [Delegations](/delegations) settings control the shared agent profile.

## Prerequisites

To connect and configure Google Chat delegation, you need:

- A Factory organization on any paid plan, including [individual plans](/pricing/individuals) and [organization plans](/pricing/organizations).
- Someone who has both the **Manager** or **Owner** role in the Factory organization and administrator access to your Google Workspace. Connecting reads your Workspace customer ID, which only a Workspace administrator can authorize.
- Access to **Settings → Delegations**, including Google Chat app setup.
- Service-account access and an active service account for shared execution.
- An Environment for **Dynamic** compute, or service-account-owned Droid Computers for **Persistent** compute.

Team members who delegate work need a Factory account in the connected organization. Use the same work email in Google Chat and Factory so Factory can match the person making the request.

## Connect your workspace

<Steps>
  <Step title="Open Google Chat delegation settings">
    In Factory, open <a href="https://app.factory.ai/settings/delegations">**Settings → Delegations**</a>. Under **Delegation Apps**, find **Google Chat** and select **Set Up for Org**.

    If Google Chat is already connected, select **Configure** to open its setup page.
  </Step>
  <Step title="Authorize your Google Workspace">
    Select **Connect** and sign in with a Google Workspace administrator account. Approve the requested access so Factory can link your Workspace to your Factory organization.

    Check that you are connecting the intended Workspace to the intended Factory organization.
  </Step>
  <Step title="Add Factory in Google Chat">
    In Google Chat, add the Factory app to the spaces where it should receive requests, or open a direct message with it. Your Workspace administrator may need to allow the app for your domain.

    If you add Factory in a Workspace that is not connected yet, it replies with instructions for connecting.
  </Step>
</Steps>

## Configure shared execution

In **Settings → Delegations**, find **Agent Profiles** and select **Edit** on **Apps**.

Follow [Configure delegated sessions](/delegations#configure-delegated-sessions) to review:

| Setting | What to configure |
| --- | --- |
| **General** | Default model, reasoning level, and instructions for delegated work. |
| **Plugins** | Plugins that delegated sessions need. |
| **Identity** | An active service account with the required Git credentials and connectors. |
| **Compute** | **Dynamic** with an Environment, or **Persistent** with computers owned by the service account. |

This agent profile is shared with other delegation apps, so changes can affect more than Google Chat.

## Personal and shared identity

- **Direct messages to Factory** run as the person sending the message, with their personal Git credentials and connectors.
- **Space requests using the Apps agent profile** run as its service account, with that account's Git credentials and connectors, not the sender's personal connections.

By default, a DM runs on a computer provisioned for the sender from the Apps agent profile's Environment, not the service account's compute. To run your DMs on one of your own computers or a different Environment, set a **DM delegation machine** in your [personal delegation defaults](/delegations#set-personal-delegation-defaults). Without that setting, DMs require the agent profile to have an Environment, even when it uses **Persistent** compute for space requests.

## Delegate a task

1. Open a space where Factory has been added, or a direct message with Factory.
2. Mention `@Factory` and describe the task, including the repository, desired outcome, and verification steps.
3. Send the message.

For example:

> @Factory In the storefront repository, investigate the failing checkout test. Fix the cause, run the relevant tests, and open a pull request with a summary and test results.

<Note>
  Droid receives the message that mentions it, not earlier messages in the space or thread. Include the relevant context in your request. You can attach up to 10 images (PNG, JPEG, GIF, or WebP, up to 20 MB each) uploaded directly to Google Chat. Google Drive files and other file types are not supported yet.
</Note>

## Follow progress and send follow-ups

Reply in the same thread and mention `@Factory` again to continue the task. If Droid asks a question, the run stops and quotes the question; mention Factory again in the thread with your answer to continue.

Only the person who started the delegation can send follow-ups or stop the task. Start a new thread for a separate task.

### Commands

| Command | What it does |
| --- | --- |
| `/help` | Shows what Factory can do. Only you see the reply. |
| `/connect` | Shows SSH steps for the thread's session. Only you see the reply. |
| `/stop` | Stops Factory's run in the thread. |

You can also select **Stop** on the running task's status card. Stopping does not undo work already performed.

## Troubleshooting

<Troubleshooting>
  <TroubleshootingItem title="Google Chat is missing or disabled in Delegations">
    Google Chat availability is enabled separately while the integration is in development. Contact your Factory account team if the settings page or app is unavailable.
  </TroubleshootingItem>

  <TroubleshootingItem title="Factory says the Workspace isn't connected">
    A Factory Manager or Owner who is also a Google Workspace administrator must complete the connect flow in **Settings → Delegations**.
  </TroubleshootingItem>

  <TroubleshootingItem title="Factory cannot match my Google Chat account">
    Make sure your Google Workspace email matches your Factory account email and that you belong to the connected Factory organization.
  </TroubleshootingItem>

  <TroubleshootingItem title="The session cannot start">
    Check that the service account is active and has the required credentials, and that the Environment has a ready build or persistent computers are online. A DM also needs an Environment on the Apps agent profile or a working **DM delegation machine**; see [Personal and shared identity](#personal-and-shared-identity). See [Delegations troubleshooting](/delegations#troubleshooting).
  </TroubleshootingItem>

  <TroubleshootingItem title="My follow-up or Stop action is rejected">
    Use the Google Chat account that started the delegation, and reply in the same thread.
  </TroubleshootingItem>
</Troubleshooting>

<RelatedLinks>
  <RelatedLink href="/delegations" title="Delegations">
    Configure shared identity, instructions, plugins, and compute.
  </RelatedLink>
  <RelatedLink href="/enterprise/identity-and-access" title="Identity & Access">
    Set up service accounts and Git credentials.
  </RelatedLink>
</RelatedLinks>
