Uses a Text Classifier to categorize emails (e.g., Leads, Qualified Leads, etc.).
Adds labels to emails based on the classification.
This worked fine when I had just one Gmail account. However, I now need to add six more Gmail accounts, and I want to avoid creating six separate workflows.
I tried adding multiple Gmail Triggers in the same workflow and duplicating the logic for each account, but it quickly became unmanageable. Anytime I need to make a change, I would have to update everything for all accounts, which is time-consuming and error-prone.
Is there a way to:
Centralize the logic so I don’t have to duplicate it for each account?
Use dynamic inputs or parameters to handle multiple Gmail accounts within a single workflow?
Any guidance or best practices for handling this kind of scenario in n8n would be greatly appreciated!
This post is a few months old (and I’m new to n8n), so maybe this is a newer feature. Took me a while to find the answer; posting here, in case your research brings you here too.
I don’t think this will work for OAuth, since that flow is interactive, but for token-based auth, you can set an expression as the token value in a Credential.
Example:
{{ $json["your-access-token-field"] }}
You can ignore the message, “[ERROR: Referenced node doesn’t exist].” Once you’ve successfully run the step that collects the token, the expression will turn green if it can find the field and red if it can’t.
I’ve had successful tests with pulling the value from a form for the NASA api (from the demo workflow above) and from a webhook post for Slack. You can make Google app tokens here: https://myaccount.google.com/apppasswords.