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

# Connect Google Workspace

> Connect Automagically to your clients' Google Workspace: add Thread's app under domain-wide delegation, sign in as the client's Google admin, and fix common problems.

> [!NOTE]
>
> Automagically is currently in a **closed beta**, and Google Workspace is a limited-availability part of it. Ask your Customer Success contact to turn Google Workspace on for your workspace before you look for the **Google Workspace** card.

Automagically can run runbooks in a client's Google Workspace, the same way it runs them in Microsoft 365: create and offboard users, change group membership, set an out-of-office reply or forwarding, assign licenses, wipe a phone, and report on sign-ins and storage. Google has no GDAP, so each client lets Thread in once through domain-wide delegation, and Thread then acts as one Google admin you choose.

This page covers how the connection works, what the client's Google admin does, what you do in Automagically, what runbooks can do, and how to fix common problems.

## How the connection works

Each client is connected in two layers, and you need both:

1. **The delegation (the client's Google super admin, once per client).** In the client's Google Admin console, a super admin adds Thread's app under domain-wide delegation, with the list of permissions (scopes) the connect dialog gives you. This allows Thread's app to act in that domain.
2. **The connected admin (you, in Automagically, once per client).** You enter one Google admin's email and the client's domain, then sign in to Google as that admin once. Thread checks the delegation works and saves the connection. Runs for that client then act as that admin.

If a client connects but some runbooks fail with a permissions error, the cause is usually layer 1: a scope is missing from the delegation.

| Connection | Who sets it up | Where | Needed for |
| - | - | - | - |
| Domain-wide delegation for Thread's app | The client's Google super admin, once per client | Google Admin console: **Security** → **Access and data control** → **API controls** → **Manage domain-wide delegation** | Everything |
| Client connection (connected admin) | An Automagically member with **Manage integrations**, once per client | Automagically: **Integrations** → **Google Workspace** → **Connect clients** | Running Google runbooks for that client |
| Staging domain | An Automagically member with **Manage integrations**, optional | Automagically: **Integrations** → **Google Workspace** → **Connect staging domain** | Testing Google runbooks before they reach clients |

## Before you start

* **In Automagically:** the **Google Workspace** card on the **Integrations** page. If you don't see it, ask your Customer Success contact to turn on Google Workspace for your workspace.
* **Your Automagically permissions:** **Manage integrations** to connect, test, change or disconnect a client or the staging domain. Without it, the Google Workspace pages are view only.
* **In each client's Google Workspace:**
  * A super admin who can add an app under domain-wide delegation.
  * An admin account for Thread to act as. A super admin is simplest. A delegated admin also works if its role includes **Admin roles read** and read access to users and domains, plus the privileges your runbooks need.
  * Someone who can sign in as that admin, once, in the window Thread opens.
* **Your browser** allows pop-ups for this site. The Google sign-in opens in a new window.
* Optional: a test Google Workspace domain for staging.

## Set up Google Workspace

### Open the connect dialog for a client

1. In Automagically, go to **Integrations**. On the **Google Workspace** card, click the **Connect clients** row. The **Google Workspace clients** page lists your clients.
2. On the client's row, click **Connect**. A dialog titled **Connect *client name* to Google Workspace** opens with four steps.

### Add Thread's app in the client's Google Admin console

The dialog gives the client's super admin everything they need. Send them the details or do this together.

1. **Copy Thread's client ID.** Click the copy button next to the client ID.
2. **Copy the scopes.** Click the copy button next to **Scopes**. This copies the full list, comma-separated.
3. **Add them in the Google Admin console.** Click **Open the Google Admin console**, or go to **Security** → **Access and data control** → **API controls** → **Manage domain-wide delegation**. Click **Add new**, paste the client ID and the scopes, then click **Authorize**.

Paste both values exactly as copied. Don't type them.

### Sign in as the client's Google admin

1. In the dialog's last step, **Sign in as the client's Google admin**, enter:
   * **Admin email**: the Google admin Thread will act as. It must be on the client's domain or one of its sub-domains.
   * **Domain**: the client's domain, for example `example.com`.
2. Click **Sign in and connect**. A Google sign-in window opens.
3. Sign in as that admin, in that window. The sign-in asks Google for the admin's identity only (`openid email`).
4. The window shows **Signed in to Google**. Close it. Thread finishes the connection in the tab where you clicked **Sign in and connect**.
5. Back in Automagically, you see **Google Workspace connected.** and the client's status shows **Connected**.

The connection only finishes in the tab where you started it. If the client's admin signs in themselves, they do it in the window that opens on your screen.

Before it saves the connection, Thread checks, in this order:

* Google gives Thread a token for that admin with the required admin scopes, which shows the delegation is in place.
* The account exists and is a Google admin (super admin or delegated admin).
* The admin can read admin roles.
* The domain belongs to that Google Workspace. A secondary domain works, and Thread uses the account's primary domain.
* The two Gmail settings scopes are delegated.

If a check fails, the client shows **Failed** with the reason, and the dialog shows **Last attempt failed:** with it the next time you open it. See [Fix common problems](#fix-common-problems).

### Connect a staging domain (optional)

On the **Google Workspace** card, click **Connect** on the **Connect staging domain** row. The **Connect a staging Google Workspace** dialog has the same steps. Use a test domain: it links a test Google Workspace so you can try runbook changes before they reach clients.

## Google scopes

The connect dialog asks for 22 scopes. The first 13 are required: the client can't connect unless all of them are delegated. The other 9 are optional. The client still connects without them, and only the runbooks that need them fail. Every scope starts with `https://www.googleapis.com/auth/`. Copy the list from the dialog rather than from this table.

| Scope | Required? | What it's for |
| - | - | - |
| `admin.directory.user` | Required | Read, create, update and suspend users, and reset passwords |
| `admin.directory.user.security` | Required | Sign a user out everywhere, and reset 2-step verification backup codes |
| `admin.directory.orgunit` | Required | Read organizational units |
| `admin.directory.domain.readonly` | Required | Read the client's domains |
| `admin.directory.group` | Required | Read groups, and add and remove group members |
| `apps.groups.settings` | Required | Group settings |
| `admin.datatransfer` | Required | Move a user's Drive files to another user |
| `apps.licensing` | Required | Read, assign and remove licenses |
| `admin.directory.device.chromeos` | Required | Find and disable Chromebooks |
| `admin.directory.device.mobile.action` | Required | Block or wipe a mobile device |
| `admin.directory.rolemanagement.readonly` | Required | Read admin roles, so Thread can check whether a user holds an admin role |
| `gmail.settings.basic` | Required | Out-of-office reply |
| `gmail.settings.sharing` | Required | Forwarding, mailbox delegates and send-as addresses |
| `admin.reports.audit.readonly` | Optional | Read sign-in activity, for sign-in reports |
| `admin.reports.usage.readonly` | Optional | Read usage, for storage and activity reports |
| `admin.directory.customer.readonly` | Optional | Read the organization profile |
| `drive` | Optional | Shared drives: list and create them, and add and remove members. Only runbooks that declare they need Drive get this permission. |
| `calendar` | Optional | Asked for, but no Google step uses it yet |
| `admin.directory.rolemanagement` | Optional | Asked for, but no Google step uses it yet |
| `admin.directory.device.mobile` | Optional | Asked for, but no Google step uses it yet |
| `admin.directory.userschema` | Optional | Asked for, but no Google step uses it yet |
| `apps.alerts` | Optional | Asked for, but no Google step uses it yet |

The Gmail scopes only change mailbox settings. None of the scopes Thread asks for lets it read email.

**Optional scopes added later.** If the client adds an optional scope after connecting, Thread can keep using what it last knew for up to 6 hours. Click **Test** on the client's row right after the change, then run again.

### The connected admin's role

The delegation sets the maximum. The connected admin's own Google role still decides what each run can do: Google refuses any step the role doesn't allow.

| Connected admin | Works? | Notes |
| - | - | - |
| Super admin | Yes | Simplest option. |
| Delegated admin (custom role) | Yes, within its role | The role must include **Admin roles read** and read access to users and domains, or the connection fails. Add the privileges your runbooks need. |
| A user who isn't an admin | No | The connection fails with "This user is not a Google admin." |

### Automagically permissions

| To do this | You need |
| - | - |
| Connect, test, change the admin of, or disconnect a client or the staging domain | **Manage integrations** |
| Run Google runbooks | **Run runbooks** |

Without **Manage integrations**, the **Google Workspace clients** page shows a **View only** tag.

## What runbooks can do in Google Workspace

Google runbooks call Google's APIs as the connected admin, or as the mailbox owner for Gmail settings. What they do is limited to the steps inside the approved runbook, the delegated scopes and the admin's role.

* **Users:** create a user, suspend a user, sign a user out everywhere, reset a password, reset 2-step verification backup codes, and onboard a user (create the account, assign a license, add to groups).
* **Groups:** add or remove a group member.
* **Gmail settings:** set an out-of-office reply, set or turn off forwarding, add a mailbox delegate, add a send-as address.
* **Licenses:** assign or remove a Google Workspace license.
* **Devices:** disable a Chromebook, block or wipe a mobile device.
* **Reports (read only):** sign-in activity and usage.
* **Shared drives:** list and create Shared drives, and add and remove members, in runbooks that declare they need Drive.

Dropdowns in run forms, such as users, groups, licenses, organizational units and domains, are read from the client's Google Workspace.

**What they can't do**

* Read, search or send email. Gmail steps only change mailbox settings.
* Reset the password or backup codes of a Google admin, or of a user who holds an admin role directly or through a group.
* Use the Calendar, admin role management, full mobile device management, custom user fields or alerts scopes. They are asked for, but no Google step uses them yet.

Other steps that change a user who holds an admin role are refused too. If Google can't confirm whether the target holds an admin role, the step is refused. In that case, make the change in the Google Admin console.

> [!WARNING]
>
> Adding a mailbox delegate lets that user read, send and delete mail in the mailbox. Check that a request is genuine before you approve or run a runbook that does it.

## Confirm the connection works

1. **Check the client's status.** In Automagically, go to **Integrations** → **Google Workspace** → **Connect clients**. The client shows **Connected**, with its domain and admin. The card shows how many clients are connected, for example **1 client connected**.
2. **Click Test.** On a connected client's row, click **Test**. For the staging domain, use the **⋮** menu → **Test**. Thread checks the connection with Google again and shows "Connected to" followed by the domain.

## What technicians see

If a client isn't connected, a run is blocked with: Google Workspace is not connected for client "*client name*". Connect it in the admin app before running this automation. A staging test with no staging domain connected is blocked with: Google Workspace staging is not connected. Connect it in the admin app before testing in staging.

## Change the admin or disconnect

| What you change | How | What happens |
| - | - | - |
| The connected admin for a client | Client's row → **⋮** → **Change admin** | You sign in as another admin. |
| The connected admin for staging | **Change admin** on the **Connect staging domain** row | You sign in as another admin. |
| A client | Client's row → **⋮** → **Disconnect** | Runbooks won't run on that client's Google Workspace until you connect it again. The row shows **Disconnected** and a **Reconnect** button. |
| The staging domain | **Connect staging domain** row → **⋮** → **Disconnect** | You can't test Google runbooks in staging until you connect it again. |

Disconnecting in Automagically doesn't remove Thread's app from the client's Google Admin console. To remove it there, the client's super admin deletes Thread's client ID under **Manage domain-wide delegation**.

## Fix common problems

| What you see | Likely cause | What to do |
| - | - | - |
| **Failed** with "Delegation is missing for this app or one of its scopes." | Thread's client ID isn't in the client's domain-wide delegation, or a required scope is missing. | Ask the client's super admin to check the entry against the connect dialog: the client ID and the full scope list. Then click **Reconnect**. |
| "Delegation is missing the Gmail settings scopes for this app." | The two Gmail settings scopes aren't delegated. | Paste the full scope list again in the delegation entry, then click **Reconnect**. |
| "This user is not a Google admin." | The admin email belongs to a user with no admin role, or a delegated admin's role can't read users. | Use a super admin, or a delegated admin whose role can read users. |
| "This user does not exist in Google." | The admin email is mistyped, or the account was deleted. | Check the email and connect again. |
| "This admin cannot read admin roles in Google. Use a super admin, or add the Admin roles read privilege to its role." | The delegated admin's role doesn't include **Admin roles read**. | Add the privilege to the role in the Google Admin console, or use a super admin. |
| "This domain is not in that Google account." | The domain you typed isn't one of that Google Workspace's domains. | Enter one of the client's domains. |
| "The admin's email must be on *your domain*." | The admin email isn't on the domain you typed or one of its sub-domains. | Use an admin on that domain, or correct the domain. |
| "Allow pop-ups for this site, then try again." | The browser blocked the Google sign-in window. | Allow pop-ups for this site, then click **Sign in and connect** again. |
| "Finish signing in to Google in the window that opened." and nothing happens | The sign-in window was closed, or the sign-in happened in another browser. | Click **Stop waiting**, then **Sign in and connect** again, and sign in in the window that opens. |
| "Google is limiting requests for this account. Try again shortly." | Google is rate-limiting the client's Google Workspace. | Wait a few minutes and try again. |
| "Google rejected the connection check." or "Google could not be reached." | Google answered with an unexpected error, didn't answer, or a delegated admin's role can't read domains. | Try again. If it repeats, contact Thread support. |
| "This admin now belongs to a different Google account. Connect it again." | The admin's address moved to another Google Workspace. | Connect the client again with an admin of the right Google Workspace. |
| The sign-in window says **We could not connect Google Workspace**, with a support reference | The connection didn't complete. One cause is a sign-in that finishes more than 30 minutes after you clicked **Sign in and connect**. | Start again from **Sign in and connect**. If it repeats, contact Thread support and quote the support reference. |
| The sign-in window says **Sign-in was not finished** | The Google sign-in was cancelled, or you signed in with a different account from the admin email you entered, or the account isn't a Google Workspace account. | Sign in with exactly the admin email you entered, using the client's Google Workspace admin account. |
| "The setup details could not be loaded." | Thread couldn't load the client ID and scopes. | Click **Try again**. If it repeats, contact Thread support. |
| "Google Workspace is not available for this workspace yet." | Google Workspace isn't turned on for your workspace. | Ask your Customer Success contact to turn it on. |
| A run is blocked with "Google Workspace is not connected for client…" | The client isn't connected, or its connection failed or was disconnected. | Check the client's status and reason on the **Google Workspace clients** page, fix it, then click **Reconnect**. |
| A staging test is blocked with "Google Workspace staging is not connected…" | No staging domain is connected. | Connect one. See [Connect a staging domain](#connect-a-staging-domain-optional). |
| **Test** says "This connection is not authorized. Connect it again before testing." | The client's connection is **Failed** or **Disconnected**. | Click **Reconnect**. |
| A runbook fails with a permissions error even though the client added a scope | Thread may still be using what it knew before the change, for up to 6 hours. | Click **Test** on the client's row, then run again. |

## FAQ

> [accordion] Does the client need to create anything in Google Cloud?
>
> No. The client's super admin only adds Thread's client ID and the scopes under domain-wide delegation in the Google Admin console.

> [accordion] Can Thread read my clients' email?
>
> No scope Thread asks for reads mail. The two Gmail scopes only change settings: out-of-office, forwarding, delegates and send-as.

> [accordion] Which account does a run act as?
>
> The connected admin you chose when you connected the client. For Gmail settings, the step acts as the mailbox owner.

> [accordion] What happens if the connected admin leaves?
>
> Connect another admin with **Change admin** or **Reconnect**. Click **Test** to see why a connection stopped working.

> [accordion] How does the client remove Thread's access?
>
> Their super admin deletes Thread's client ID under **Manage domain-wide delegation** in the Google Admin console.


## Related topics

- [Connect Halo MCP to Super Magic](https://docs.getthread.com/super-magic/connect-halo-mcp-to-super-magic.md)
- [Use ConnectWise RMM with Super Magic](https://docs.getthread.com/super-magic/connect-connectwise-rmm.md)
- [Connect IT Glue Documentation to Super Magic](https://docs.getthread.com/integrations/it-glue-super-magic.md)
