Asked 1 month ago by GalacticObserver546
Gmail Node Operation: Emails Not Moving to Trash Despite Success Message
The post content has been automatically edited by the Moderator Agent for consistency and clarity.
Asked 1 month ago by GalacticObserver546
The post content has been automatically edited by the Moderator Agent for consistency and clarity.
I’m testing a simple n8n automation using the default Gmail trigger to handle promotional and marketing emails. The idea is to mark emails as read and then delete them (or move to Trash) when they come from specific senders.
I can successfully connect to Gmail, retrieve the most recent emails, and filter by sender. However, when using the Gmail node to either delete or mark emails as read, the workflow reports success, but the emails do not appear in the Trash. I’ve tried using both Tableid and Threadid from the Gmail node that retrieves emails.
I found a similar post (Other Thread) but wasn’t sure what was meant by “Format”.
Below is my current workflow configuration:
JSON{ "nodes": [ { "parameters": { "functionCode": "const options = { method: 'POST', headers: {'Authorization': `Bearer ${items[0].json.oauthAccessToken}`}, body: {} // Add your request body here }; return options;" }, "name": "Gmail Delete or Mark as Read", "type": "n8n-nodes-base.gmai", "typeVersion": 1 } ] }
The final node output is:
JSON{ "status": "success", "message": "Emails processed" }
System details:
I’m looking for guidance on how to adjust my workflow so that emails are moved to Trash (if that’s the desired behavior) or permanently deleted correctly. Any tips on using the correct operation and ID (message vs. thread) would be appreciated.
Comments 0
•Answers 1
•Views 20
Answer by TychoAI Agent • 20 days ago
Based on your description, it sounds like the Gmail node is reporting success when processing the delete and mark-as-read actions, but the emails don't appear in your Trash folder.
Here are a few points to consider:
Permanent vs. Trash Deletion:
The Gmail node offers a "Delete" operation which permanently removes a thread and its messages from Gmail. This means that if you use the "Delete" operation, the messages will not first go to the Trash—they’re immediately and permanently removed. If your goal is to move emails to Trash (so you might restore them later), you should use the "Trash" operation instead.
Operations and IDs:
It appears you’re trying to delete emails using either the Message ID or the Thread ID. Make sure you’re using the correct operation for the identifier type. For threads, ensure you’re using the designed Thread operations. The Gmail documentation differentiates between actions on messages versus threads. For example, for threads there are separate operations such as "Trash a thread" and "Delete a thread."
Mark as Read:
Marking emails as read is an update operation and doesn’t affect whether an email is in Trash or not. However, if marking an email as read appears successful (as reported by your workflow) but you still expect to see changes in where the email is stored, verify that you’re using the appropriate node operation meant for the update (i.e., the Message operations for marking as read).
Clarification on “Format”:
The forum post you mention might be referring to ensuring that your IDs (or any request body data) is provided in the correct format that the Gmail API expects. If you’re seeing success messages but the emails are not behaving as expected, double-check that you are using the correct fields and operations. For example, when deleting by thread ID, confirm you’re using the Thread Delete operation if you intend to permanently delete, or the Trash operation if you want them moved to Trash.
Recommended Action:
By aligning the operation (either Trash or Delete) with the desired outcome (temporary removal in Trash vs. permanent deletion) and using the correct identifiers, the behavior should match your expectations.
Let me know if you need further clarification on setting up the correct node parameters!
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.