📩 Filtering Emails in Zenphi Using the "List Emails (Gmail)" Action — Especially by Date
Zenphi makes automation intuitive and powerful, especially when working with Gmail. One of the actions available in Zenphi is “List Emails (Gmail)”, which lets you retrieve a list of emails from a connected Gmail account. While the basics are easy, there are a few advanced tips worth knowing—especially when filtering emails by date.
Let’s walk through how to use this action effectively, including how to apply Gmail queries and handle tricky filters like filtering by date using Unix time.
🔍 The Basics: How to Use the “List Emails” Action
Label Ids: If you want to filter emails by labels (like “INBOX”, “STARRED”, etc.), you can input the label IDs here. Multiple labels can be specified by separating them with commas.
Query: This is where the magic happens. Use Gmail's search query syntax to filter emails based on specific parameters—sender, subject, status, and even dates.
✨ Example Queries for the “Query” Field
Here are a few commonly used examples:
from:someone@example.com — Emails from a specific sender
subject:"Invoice July" — Emails with a specific phrase in the subject
is:unread — Only unread emails
label:IMPORTANT — Emails marked as important
has:attachment — Emails that contain attachments
Combine filters like this:
from:someone@example.com is:unread subject:report
⚠️ The Tricky Part: Filtering by Date (e.g. After July 1, 2025)
You might assume this would work:
after:2025-07-01
But this will NOT return results in the Zenphi List Emails action. Gmail's advanced query does support after: and before:, but in this context, this action expects the date in Unix time (in seconds) — not in a human-readable format.
âś… Correct Way: Use Unix Time in Query
To properly filter emails after a specific date, you need to provide the Unix timestamp in seconds.
đź”§ How to Do That in Zenphi
Use the "Convert to Unix Time in Seconds" Action
Add this action to your flow and pass your desired date (e.g. 2025-07-01) as input.Use the Output in Your Query
Let’s say the converted Unix timestamp is 1751932800. Your query would now look like:after:1751932800Similarly, for filtering before a specific date:
before:1754611200Insert the Query into “List Emails” Action
Use dynamic content to pass the converted timestamp from the previous step into your query string.
📝 Summary
Use Label Ids for filtering by labels.
Use the Query field for more advanced filters (sender, subject, read/unread, etc.).
For date filtering, convert the date to Unix time using Zenphi’s "Convert to Unix Time in Seconds" action.
If you have other tricky use cases or want to share your tips with the community, feel free to drop them here! Happy automating 🚀