Reputation: 5389
I'd like to monitor a users gmail account for new messages and take an appropriate action. Is there a way to fetch the history events for just new messages but NOT for things like starring an email or changing its labels, etc.?
Upvotes: 2
Views: 685
Reputation: 7159
Another route I've seen done, is if you have the ability to add a filter (e.g. user's can do that, or use the Google Admin SDK for Google Apps users, or do it through HTML/DOM hacking) then you can simply setup a filter to apply a label to all new messages. Then just messages.list(labelId=THAT_LABEL) when you do your polling (and remove it after you process them).
Upvotes: 1
Reputation: 5389
So I ended up using messages.list and storing the timestamp of the most recent message. Then on subsequent calls to messages.list I'd supply a query of "after:theMostRecentTimestampIKnowOf" to find new messages since the last time we synced.
Upvotes: 1
Reputation: 7159
There is not any ability now to filter history based on change type, though it's something that would be nice to provide at some point.
Upvotes: 0