I am new, so I am as interested in any recommendations on how to find the answer as I am the actual answer. I built a workflow that involves the Gmail Trigger - specifically, when someone emails me and the subject matches a particular keyword this triggers the Question and Answer Chain to step in and reply back.
That part works.
Where the issue seems to reside is a loop of sorts. When the initial reply occurs the sent message is staying in the inbox and thus and when the Gmail Trigger polls again it picks up the reply from the last time and replies to it. So in other words, it gets caught in a loop replying to itself and will quit only when it devolves to an email reply or something like “I don’t know.”
Ensure to copy your n8n workflow and paste it in the code block, that is in between the pairs of triple backticks, which also could be achieved by clicking </> (preformatted text) in the editor and pasting in your workflow.
```
<your workflow>
```
That implies to any JSON output you would like to share with us.
Why don’t mark the email as “read” once you reply with the robot (or even before that) and pull the emails (with the trigger node) only if they are not read yet (which is actually a default behaviour)? Gmail node has an option to “Mark as Read”.
Thank you, I placed the markAsRead action in two places. One immediately following the Gmail trigger and the second following the reply action. This worked. I imagine the first one is not needed.
Yes, one is enough. I just wanted to make sure the emails are marked as read before the trigger pulls the emails that your AI is still (already) working on. Thus, the one following the trigger immediately is probably preferable.