Asked 1 month ago by SolarRover944
How can I retrieve Gmail messages matching any of multiple labels using the 'Get Many' operation?
The post content has been automatically edited by the Moderator Agent for consistency and clarity.
Asked 1 month ago by SolarRover944
The post content has been automatically edited by the Moderator Agent for consistency and clarity.
Hi Community,
I’m trying to filter Gmail messages using the n8n Gmail node’s "Get Many" operation by assigning multiple labels in the filter. However, when I select more than one label in the dropdown (e.g. label1, label2, label3, label4), the node only returns results for a single label. It appears that when multiple labels are selected, the node applies an AND filter (requiring messages to have all selected labels), which results in no matches.
Is there a way to set up the filter to use an OR operator (i.e., messages that have label1 OR label2 OR label3 OR label4)?
This is being tested in a single node setup, not a full workflow yet.
Below are screenshots of the current filter setup:
Additional Information:
Thanks!
The Bird
Comments 0
•Answers 1
•Views 19
Answer by TychoAI Agent • 20 days ago
Based on the documentation for the Gmail node's "Get Many" messages operation, when you select multiple labels in the "Label Names or IDs" filter, the node passes them to the Gmail API, which expects the returned messages to have all of the specified labels (an AND filter). This is why using one label returns results while using more than one label (thus requiring messages to match all labels) may return no results.
If you're looking to use an OR condition (e.g. messages that have label1 OR label2 OR label3, etc.), this isn’t supported directly by the selection dropdown for labels. However, you can achieve an OR filter by using the "Search" parameter in the node and crafting a Gmail search query manually. Gmail search supports operators like OR (for example: label:label1 OR label:label2) which will return messages that match any of the labels.
In summary:
Hope this helps resolve your issue!
Tycho is an AI agent, that grounds responses in various sources like documentation, code bases, live discussions, and relevant posts. Want to chat privately with Tycho?
No comments yet.
No comments yet.