mxHERO reads your Google Workspace directory and Gmail mailboxes through a Google service account with domain-wide delegation. A Workspace super administrator grants this once, for the whole domain. This page covers the directory source (users, aliases, groups and domains) and Gmail access for User Mailboxes rules.
For Google Drive storage, see Connecting Google Drive. For mail routing, see Google Workspace configuration.
Before you begin
- You need a Google Workspace super administrator account.
- You need the Owner or Administrator role in the Admin Dashboard.
- The Admin SDK API must not be blocked for third-party apps in your Workspace. See Google's Control which third-party & internal apps access Google Workspace data.
Scopes mxHERO needs
Domain-wide delegation lets the mxHERO service account act as users in your domain, limited to these OAuth scopes.
| Scope | Used for |
|---|---|
https://mail.google.com/ |
Mailbox rules: read, label, move and replace Gmail messages |
https://www.googleapis.com/auth/admin.directory.user.readonly |
Directory: users |
https://www.googleapis.com/auth/admin.directory.user.alias.readonly |
Directory: user aliases |
https://www.googleapis.com/auth/admin.directory.group.readonly |
Directory: groups |
https://www.googleapis.com/auth/admin.directory.group.member.readonly |
Directory: group members |
https://www.googleapis.com/auth/admin.directory.domain.readonly |
Directory: your domains |
Google Drive storage needs further Drive scopes, which the Marketplace app requests.
Note: If the domain scope is missing (older installs), the sync still imports users and groups but can't read your domains. Add the domains by hand in Settings › Organization and domains.
Grant access to mxHERO
Install the mxHERO app for your domain from the Google Workspace Marketplace. Installing it domain-wide grants the delegation.
In the Admin Dashboard, open Settings › Integrations and select the Applications tab.
-
On the Google Apps for Organization card, click Verify. If the app is not installed yet, the dashboard explains the steps and opens the Marketplace listing:
https://workspace.google.com/marketplace/app/mxhero_mail2cloud/197328540342. In the Marketplace, sign in as a super administrator, click Domain Install , and accept the requested access for everyone in your organization.
Back in the dashboard, click Verify on the Google Apps for Organization card and enter a super administrator's email address.
Check the user, organization name and Google Customer ID shown, and click Confirm.
The card then shows that the connection is verified.
To check the grant in Google, open the Google Admin console at Security › Access and data control › API controls › Manage Domain Wide Delegation. The mxHERO client should list the scopes above.
Using your own Google Cloud project
Some organizations don't allow Marketplace apps. mxHERO can instead use a service account in your own Google Cloud project. This needs mxHERO support to load your credentials. Contact support before you start; see Getting support.
In outline: create a project, enable the Admin SDK API and Gmail API (and Google Drive API for Drive), create a service account, and in the Admin console add its client ID under Manage Domain Wide Delegation with all six scopes in the table above.
Connect the Google directory
Open Settings › Accounts and Groups.
In Directory Sources, click Add Source › Google Apps.
-
In Email Address, enter a super administrator's address. mxHERO acts as this user to read the directory ("We need a domain administrator account to collect the accounts and groups").
Optional: turn on Schedule Daily Synchronization to run the sync at a fixed hour.
-
Optional: expand Advanced Filters to limit the import:
-
Users filter: an Admin SDK user query, for example
email:admin*. See Google's Search for users. -
Groups filter: an Admin SDK group query, for example
email:support*. See Google's Search for groups. - Only import email accounts that belong to a filtered group: available after you enter a groups filter.
- Exclude domains: accounts and groups in these domains are not imported.
-
Users filter: an Admin SDK user query, for example
Click Add Source.
What gets imported
-
Users: each user's primary address, plus
aliasesand non-editable aliases that are in your mxHERO domains. - Groups: each group with its aliases and its user members.
- Domains: your Workspace domains are added to Settings › Organization and domains. A domain that belongs to another mxHERO organization is skipped with a warning.
Important: Google groups nested inside other groups are not expanded. A user who is a member only through a nested group is not a member of the parent group in mxHERO. Add users to the parent group directly, or target the nested group in rules.
Accounts that leave the directory, or your filters, are deleted from mxHERO at the next sync.
Use Gmail mailboxes in rules
After the app is installed, User Mailboxes rules can use the provider Organization: Google™ Apps. No further setup is needed. mxHERO watches for new mail itself for continuously updating rules.
If the app is not installed when you pick this provider, the dashboard opens the Marketplace listing.
What mailbox rules do in Gmail:
- They skip the
DRAFT,SPAM,CHATandTRASHlabels. -
Mark email as processed adds a Gmail label (default
mxHERO). - Move Emails moves messages to the trash by default.
To connect one Gmail account with the user's own sign-in instead, see IMAP and individual mailboxes.
Verify
- In Settings › Accounts and Groups, the Google Apps source shows a recent synchronization with no errors.
- Search for a few users and groups.
- For mailbox access, create a test Copy Emails rule with the User Mailboxes target, the Organization: Google™ Apps provider and one test account, for a short date range. Watch it in Rules › Rules List and check the files in storage.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| Verify fails with "app is not installed" | The Marketplace app isn't installed for the domain. | Install it domain-wide from the Marketplace, then verify again. |
| Verify fails because the user must be an admin | The address you entered isn't a super administrator. | Use a super administrator's address. |
Mailbox error mxhero_does_not_have_permission
|
Domain-wide delegation is missing, or a scope is missing. | Check Manage Domain Wide Delegation in the Admin console and reinstall the app if needed. |
Mailbox error invalid_user
|
The account doesn't exist in Google, or is suspended. | Fix the address, or remove the account from the rule. |
Sync fails with ERROR_USERS_FILTER or ERROR_GROUPS_FILTER
|
The Admin SDK query is not valid. | Check the query syntax in Google's search guides linked above. |
| Domains are not imported | The domain scope wasn't granted (older custom apps). | Add admin.directory.domain.readonly to the delegation, or add domains by hand. |
Comments
0 comments
Please sign in to leave a comment.