Gmail workflow: perform action based on specific phrase in body

Describe the problem/error/question

I have a workflow that polls gmail for messages with “invoice paid” in the subject. When it finds one a message is sent to gchat. That all works great. I want to add a new step:

When an “invoice paid” message is received I still want it to send the message to gchat, but I also want it to look for a specific phrase in the body: “starter package”. And when it matches both to perform another action: send an email (I can figure that out.) This is where I am stuck. I’m assuming I’d use an IF node but I can’t seem to get that to work. It doesn’t seem to be looking at the body of the message.

I’d appreciate any advice!

What is the error message (if any)?

No error messages

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 1.3.1
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker
  • Operating system:

A better way I’ve found to approach this is to use a google mail filter to check if the message contains the text, then put it in a folder/label in gmail. Then have your Gmail trigger search for new items in that folder. Once the processing is done, remove the label in gmail via n8n, and move it to a different folder/label so you know n8n processed it. I find it easier to do the logic in gmail and then query the folders/labels needed to form a kind of queu.

Hope this helps!


Thanks for the suggestion I will give that a try!

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.