Handling flow when no items returned from Gmail Get Messages Node

I’m working on a flow where I have a Cron that runs to check a Gmail account for messages that have a specific label. If a message is returned with that label, the flow continues. I’d like to have an IF statement or something else that can perform other logic if there are no messages returned.

I was looking to see how I might be able to use $items or another n8n variable but don’t seem to have any luck.

Any suggestions?

You will need to open the Gmail node and click on settings, and then select Always Output Data. This will continue the workflow even though nothing came out of the node. Then use the IF node to generate a String then choose the Is Empty operation and refer back to the output for that node.

Here is an example:


Awesome - this works great!

Glad to hear it! Have fun!