Hi everyone,
I’m trying to build an automation workflow that automatically applies Gmail labels to emails based on sender domains, and I need this to work for multiple users in my organization.
What I’m trying to achieve:
-
When a new project is created in our system, I retrieve the client’s domain (e.g.,
client-company.com) -
Create a Gmail label with the client’s name
-
Automatically apply this label to all emails from
@client-company.comfor specific team members working on that project
My questions:
-
Is it possible to create Gmail filters/labels programmatically for multiple users in a Google Workspace organization without each user manually authorizing access?
-
Should I use Domain-Wide Delegation for this? If so, what are the required OAuth scopes?
-
Has anyone successfully implemented this with automation tools like n8n, Zapier, or (URL Removed by Staff)?
-
Or do I need to build a custom backend application with the Gmail API to achieve this?
What I’ve tried:
I’m currently using n8n and can successfully:
-
Create labels using the Gmail API (
gmail.labels.create) -
Create filters for a single authenticated user (
gmail.users.settings.filters.create)
However, I’m stuck on how to:
-
Apply these filters/labels to multiple team members’ Gmail accounts without requiring each person to manually authenticate
-
Manage this at scale for our organization
Technical details:
-
We have Google Workspace
-
Team size: 5-15 people per project
-
Need to automate label creation for dozens of clients
Is Domain-Wide Delegation the right approach here? Or is there a simpler way to manage Gmail labels/filters across multiple users in an organization?
Any guidance, documentation links, or code examples would be greatly appreciated!
Thanks in advance!