Skip to main content

Hi there
(I have found relevant topics, but the actual posts/comments within the topic end up being about something else so I’m making a new one)

I’m trying to figure out why my "Zap” ended up sending email replies to the same email continuously

It should trigger on a new email from a specific address
I guess that maybe I didn’t think of how the Zap would actually mark that email as Read? 😐
I guess that since it wasn’t being marked as Read, the Zap continuously triggered on this as a “new” email?
But I’m not sure

As a result I ended up sending probably 50 different messages (oops and yikes, though also still kinda fair given the circumstances)

This Zap is simply
1. Check new mail
2. Send mail body as prompt to chatgpt 
3. Chatgpt generates response
4. Response is sent as email body in reply

It worked fine when I tested, but I didn’t think of this issue. It just didn’t occur to me. But I definitely messed up, though it wasn’t easy to see that the script was doing anything. 

Gmail didn’t really send me notifications either so I only found out 6 hours later after being blocked. 

 

 

Hi @Moshiwakeda 

You likely created an infinite loop.

For us to have full context, post screenshots with how your Zap steps are outlined and configured in EDIT mode.


Thanks Troy

 

Does this create an infinite loop? 
 

 


There’s just too many variables to consider that could have caused this, I really don’t know where to even start
That it doesn’t mark the email as Read is the most logical explanation in my mind


@Moshiwakeda

We would need to see how your Zaps steps using Gmail are configured in EDIT mode.

Make sure to check the field descriptions for guidance, especially for the Zap trigger step.


Yes, my screenshot is from edit mode
I’m trying to figure out why it kept sending emails even though no new email was received


If you are unable to see the screenshot I embedded in my reply, you can see it here: https://i.imgur.com/XVID1cY.png


@Moshiwakeda 

The provided screenshots do not show us have your Zap trigger step is configured in the “Trigger” tab section.

 


 

Ah ok, well there isn’t much to see there. The correct email was targeted according to this setting, except for the fact that replying to it didn’t mark the email as read
So it continuously treated the same email as “New”. This was altogether unexpected

 


I haven’t tested it yet, but from what I can find it seems that marking an email (message or thread) as Read is technically a label removal where the ‘UNREAD’ label is removed

It should look something like this in python:

def remove_unread_label(service, thread_id):
  """Removes the "UNREAD" label from a thread.

  Args:
    service: The Gmail service object.
    thread_id: The ID of the thread to modify.
  """

  # Create the request body.
  request_body = {
    "removeLabelIds": "UNREAD"]
  }

  # Make the API call.
  service.users().threads().modify(userId="me", id=thread_id, body=request_body).execute()

 

But that requires these authorizations and I don’t know if/how Zapier deals with these:

I suppose that this is already taken care of when I connect my google account

https://developers.google.com/gmail/api/reference/rest/v1/users.threads/modify
https://developers.google.com/gmail/api/reference/rest/v1/users.messages/modify


@Moshiwakeda 

Make sure to check the field description for guidance.

You’ll need to specify which folder to watch.